gov.sns.xal.model
Interface IComposite

All Superinterfaces:
IComponent
All Known Implementing Classes:
ElementSeq

public interface IComposite
extends IComponent

Represents a composite modeling structure. Such a structure is typically build from IElement objects and other composites exposing the IComposite interface. Both interfaces are derived from the base interface IComponent.


Method Summary
 void addChild(IComponent iComp)
          Add a direct child object to the current composite element.
 IComponent getChild(int index)
          Return the direct descendent given by the index.
 int getChildCount()
          Return the number of direct descendents in this composite.
 java.util.Iterator globalIterator()
          Returns iterater over all the components in this composite element in proper sequence.
 java.util.Iterator localIterator()
          Return iterator over direct descendants only of this composite element in sequence.
 void propagate(IProbe probe)
          Propagates the Probe object through this composite element sequentially element by element.
 boolean remove(IComponent iComp)
          Remove the specified child from the composite element
 
Methods inherited from interface gov.sns.xal.model.IComponent
getId, getLength, getType
 

Method Detail

localIterator

public java.util.Iterator localIterator()
Return iterator over direct descendants only of this composite element in sequence.

Returns:
interface to iterator object
See Also:
Iterator

globalIterator

public java.util.Iterator globalIterator()
Returns iterater over all the components in this composite element in proper sequence. Parent objects should be returned first than all the children. This would be the order in which the probe visits each component.

Returns:
interface to iterator object
See Also:
Iterator, CompositeGlobalIterator

getChildCount

public int getChildCount()
Return the number of direct descendents in this composite. That is, any child composite nodes only get a single count.

Returns:
number of direct child nodes

getChild

public IComponent getChild(int index)
                    throws java.lang.IndexOutOfBoundsException
Return the direct descendent given by the index.

Parameters:
index - index of child node (index origin 0)
Returns:
direct child node specified by index.
Throws:
java.lang.IndexOutOfBoundsException - index was greater than child count

addChild

public void addChild(IComponent iComp)
Add a direct child object to the current composite element. The child should be inserted at the tail.

Parameters:
iComp - interface to the new child element

remove

public boolean remove(IComponent iComp)
Remove the specified child from the composite element

Parameters:
iComp - interface to the child to be removed
Returns:
true if child was found and removed, false otherwise

propagate

public void propagate(IProbe probe)
               throws ModelException
Propagates the Probe object through this composite element sequentially element by element.

Specified by:
propagate in interface IComponent
Parameters:
probe - probe state will be advance using the elements dynamics
Throws:
ModelException - an error advancing probe state