T
- the type of SchemaComponent
managed by the collectionpublic class SchemaComponents<T extends SchemaComponent> extends Object implements SchemaComponentContainer, Containable
SchemaComponent
objects.
Components can be added, deleted, edited. Components have a name, which can
be modified in edit mode. Names, when not null, must be unique. Note that a
complete component has a non-null name.Constructor and Description |
---|
SchemaComponents(Collection<T> components)
Construct a managed collection of schema components.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addComponent(T component)
Add a new component.
|
void |
consolidate()
Leave edit mode.
|
boolean |
deleteComponent(int number)
If a component with the given number exists remove it and return true.
|
protected void |
edit()
Enter edit mode.
|
T |
editComponent(int number)
Enter edit mode and edit the component specified.
|
T |
getComponent(int number)
Return the component with the given number.
|
T |
getComponent(String name)
Return the component with the given name.
|
Collection<T> |
getComponents()
Return all components.
|
protected Map<Integer,T> |
getMap() |
boolean |
isComplete()
Return true if all components are complete.
|
void |
nameChanged(boolean attribute,
String oldName,
String newName)
Tell the container that the name of a component was changed.
|
void |
setContainer(SchemaComponentContainer container)
Set a container.
|
String |
toString() |
public SchemaComponents(Collection<T> components) throws T2DBException
components
- a collection of initial components to addT2DBException
- if components contain a duplicate name or numberpublic void setContainer(SchemaComponentContainer container)
Containable
setContainer
in interface Containable
container
- a container or nullpublic void nameChanged(boolean attribute, String oldName, String newName) throws T2DBException
SchemaComponentContainer
nameChanged
in interface SchemaComponentContainer
attribute
- if true the changes concerns an attribute, else a seriesoldName
- old namenewName
- new nameT2DBException
- if a duplicate is foundpublic boolean isComplete()
public Collection<T> getComponents()
public T getComponent(int number)
number
- a positive numberpublic T getComponent(String name)
name
- a stringpublic T editComponent(int number)
number
- a positive numberT2DBException
public boolean addComponent(T component) throws T2DBException
component
- a componentT2DBException
public boolean deleteComponent(int number)
number
- a positive numberprotected void edit()
public void consolidate()
Copyright © 2017. All rights reserved.