public class ReactorComposite extends ICEObject implements IReactorComponent, Composite
IReactorComponent
s by implementing
the Composite
interface. However, it associates child components by
associating them with an ID, which is not necessarily the same as the
component IDs.iComponentVisitor
iComponentListener
Constructor and Description |
---|
ReactorComposite()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(IComponentVisitor visitor)
Fires the default visit operation on the visitor.
|
void |
addComponent(Component child)
If the child is an IReactorComponent, this method adds the child to this
Composite.
|
java.lang.Object |
clone()
Deep copies and returns a newly instantiated object.
|
void |
copy(ReactorComposite otherObject)
Copies the contents of the object from another object.
|
boolean |
equals(java.lang.Object otherObject)
Compares the contents of objects and returns true if they are identical,
otherwise returns false.
|
Component |
getComponent(int childId)
Gets the IReactorComponent in this Composite that is associated with the
specified ID.
|
java.util.ArrayList<Component> |
getComponents()
Gets the list of Components stored in this Composite.
|
int |
getNumberOfComponents()
Gets the number of IReactorComponents stored in this Composite.
|
IReactorComponent |
getReactorComponent(int childId)
Convenience method that returns the same component as
getComponent(int) but already cast as an IReactorComponent. |
java.util.ArrayList<IReactorComponent> |
getReactorComponents()
Convenience method that returns the same list as
getComponents()
but already cast as IReactorComponents. |
int |
hashCode()
Returns the hashCode of the object.
|
void |
removeComponent(int childId)
Removes the IReactorComponent in this Composite that is associated with
the specified ID.
|
IReactorComponent |
setComponent(int id,
IReactorComponent child)
Adds an IReactorComponent to this Composite.
|
void |
update(java.lang.String updatedKey,
java.lang.String newValue)
Overrides
ICEObject 's behavior to pass the update to all child
components. |
copy, getDescription, getId, getName, register, setDescription, setId, setName, unregister
getClass, notify, notifyAll, toString, wait, wait, wait
toString
register, unregister
getDescription, getId, getName, setDescription, setId, setName
public ReactorComposite()
public void accept(IComponentVisitor visitor)
IComponentVisitor.visit(IReactorComponent)
.public void update(java.lang.String updatedKey, java.lang.String newValue)
ICEObject
's behavior to pass the update to all child
components.update
in interface IUpdateable
update
in class ICEObject
updatedKey
- A unique key that describes the value that to be updated.
newValue
- The updated value of the key.
IUpdateable.update(String updatedKey, String newValue)
public void addComponent(Component child)
addComponent
in interface Composite
child
- The Component to add.public IReactorComponent setComponent(int id, IReactorComponent child)
id
- The ID associated with the new IReactorComponent.child
- The IReactorComponent to add.public void removeComponent(int childId)
removeComponent
in interface Composite
childId
- The id of the child Component that should be removed from the Composite.
public Component getComponent(int childId)
getComponent
in interface Composite
childId
- The id of the child Component that should be retrieved from the Composite.
The child with id childId that was retrieved from the Composite. NULL if the childId was not found in the Composite.
public IReactorComponent getReactorComponent(int childId)
getComponent(int)
but already cast as an IReactorComponent.childId
- The ID associated with the desired IReactorComponent.public int getNumberOfComponents()
getNumberOfComponents
in interface Composite
public java.util.ArrayList<Component> getComponents()
getComponents
in interface Composite
public java.util.ArrayList<IReactorComponent> getReactorComponents()
getComponents()
but already cast as IReactorComponents.public boolean equals(java.lang.Object otherObject)
Compares the contents of objects and returns true if they are identical, otherwise returns false.
equals
in interface Identifiable
equals
in class ICEObject
otherObject
- The other object to compare against.Identifiable.equals(Object otherObject)
public int hashCode()
Returns the hashCode of the object.
hashCode
in interface Identifiable
hashCode
in class ICEObject
Identifiable.hashCode()
public void copy(ReactorComposite otherObject)
Copies the contents of the object from another object. Components from the other Composite are not deep copied.
otherObject
- The object to be copied from.public java.lang.Object clone()
Deep copies and returns a newly instantiated object.
clone
in interface Identifiable
clone
in class ICEObject