Package xal.model
Interface IComposite
- All Superinterfaces:
IComponent
,Iterable<IComponent>
- All Known Implementing Classes:
ElectromagnetSeq
,ElementSeq
,IdealMagFringeQuad
,IdealMagWedgeDipole
,IdealMagWedgeDipole
,IdealMagWedgeDipole2
,IdealRfCavity
,Lattice
,LineModel
,RingModel
,Sector
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
.- Author:
- Christopher K. Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(IComponent iComp) Add a direct child object to the current composite element.getChild
(int index) Return the direct descendant given by the index.int
Return the number of direct descendants in this composite.Returns iterator over all the components in this composite element in proper sequence.Return iterator over direct descendants only of this composite element in sequence.void
Propagates the Probe object through this composite element sequentially element by element.boolean
remove
(IComponent iComp) Remove the specified child from the composite elementvoid
setDirty
(IComponent cmpCaller) Methods inherited from interface xal.model.IComponent
backPropagate, backPropagate, getHardwareNodeId, getId, getLatticePosition, getLength, getParent, getPosition, getType, initializeFrom, propagate, setParent
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
localIterator
Iterator<IComponent> localIterator()Return iterator over direct descendants only of this composite element in sequence.- Returns:
- interface to iterator object
- See Also:
-
globalIterator
Iterator<IComponent> globalIterator()Returns iterator 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:
-
getChildCount
int getChildCount()Return the number of direct descendants in this composite. That is, any child composite nodes only get a single count.- Returns:
- number of direct child nodes
-
getChild
Return the direct descendant given by the index.- Parameters:
index
- index of child node (index origin 0)- Returns:
- direct child node specified by index.
- Throws:
IndexOutOfBoundsException
- index was greater than child count
-
addChild
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
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
Propagates the Probe object through this composite element sequentially element by element.NOTES: CKA
· This looks to be redundant! It is overriding the same method in the super interfaceIComponent
.- Specified by:
propagate
in interfaceIComponent
- Parameters:
probe
- probe state will be advance using the elements dynamics- Throws:
ModelException
- an error advancing probe state- See Also:
-
setDirty
Need only be called by implementing classes
Indicates internally that the composite structure has been modified and any dependent parameters must be recomputed. This is needed if these parameters must be computed upon demand due to dynamic changes in the composite. In order to avoid expensive re-iteration through large composite structures, by employing this method a state condition can be set up so that the dependent parameters are only recomputed when the composite changes.- Implementing classes should call this method whenever the composite
changes, in particular whenever
andaddChild(IComponent)
are called.remove(IComponent)
- They respond to this call by setting a dirty flag and calls the same method on their parent object.
- If the dirty flag is set then all dependent parameters should be recomputed whenever one is requested (after which the flag can be cleared).
- Parameters:
cmpCaller
- theIComponent
object calling this method, ornull
if the object is not a component- Since:
- Dec 3, 2015, Christopher K. Allen
- Implementing classes should call this method whenever the composite
changes, in particular whenever
-