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

public interface IComposite extends IComponent, Iterable<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.
Author:
Christopher K. Allen
  • 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

      IComponent getChild(int index) throws IndexOutOfBoundsException
      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

      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

      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

      void propagate(IProbe probe) throws ModelException
      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 interface IComponent.

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

      void setDirty(IComponent cmpCaller)

      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 addChild(IComponent) and remove(IComponent) are called.
      • 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 - the IComponent object calling this method, or null if the object is not a component
      Since:
      Dec 3, 2015, Christopher K. Allen