public abstract class ElementSeq extends java.lang.Object implements IComposite
Convenience abstract base class for a composite modeling element. The composite is represented as a sequence of modeling elements, perhaps other composites. Specifically we have an ordered list of child modeling elements.
Propagation of probes (objects exposing the IProbe interface)
is done by passing it sequentially to each child. Of course if a child is
also a composite the same is done there.
| Modifier and Type | Field and Description |
|---|---|
static int |
s_szDefReserve
default number of element positions to reserve in list array
|
| Constructor and Description |
|---|
ElementSeq(java.lang.String strType)
Creates a new instance of
ElementSeq without of the
given soft type but without a sequence identifier. |
ElementSeq(java.lang.String strType,
java.lang.String strId)
Creates a new instance of
ElementSeq with the
given soft type and sequence identifier. |
ElementSeq(java.lang.String strType,
java.lang.String strId,
int szReserve)
Creates a new instance of
ElementSeq with the
given soft type and sequence identifier. |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(IComponent iComp)
Add a component object at the tail of the sequence.
|
void |
backPropagate(IProbe probe)
Backward propagation of probe through sequence.
|
void |
backPropagate(IProbe probe,
double pos)
Override of
IComponent.propagate(xal.model.IProbe, double) |
java.util.Iterator<IComponent> |
childIterator()
Return an
Iterator object that cycles through
all the direct children of the sequence. |
void |
concatenateEquals(ElementSeq seq)
Concatenate the indicated
ElementSeq object
to the tail of this sequence. |
java.util.List<IComponent> |
getAllElements()
Returns a list of all elements contained in this
sequence, more specifically, all leaf elements.
|
IComponent |
getChild(int indChild)
Get the child IComponent interface at location
specified by index.
|
int |
getChildCount()
Get the number of direct children in this sequence.
|
java.lang.String |
getComments()
Get any user comments regarding this sequence.
|
protected java.util.List<IComponent> |
getCompList()
Return the internal list of components
|
java.util.List<IComponent> |
getElementList()
Return the list of
IElement objects contained
in this sequence. |
java.lang.String |
getHardwareNodeId()
Returns the string identifier of the hardware node which this
element models.
|
java.lang.String |
getId()
Get the sequence identifier
|
int |
getLeafCount()
Get the number of
IElement derived objects contained
in this sequence. |
double |
getLength()
Return the length of the sequence.
|
protected java.util.List<IComponent> |
getReverseCompList()
Return the reverse component list (downstream to upstream)
|
java.lang.String |
getType()
Get the type identifier for the composite element.
|
java.util.Iterator<IComponent> |
globalBackIterator()
Return an
Iterator object that iterates over every
IComponent object in this composite. |
java.util.Iterator<IComponent> |
globalIterator()
Return an
Iterator object that iterates over every
IComponent object in this composite. |
void |
initializeFrom(LatticeElement latticeElement)
Conversion method to be provided by the user
|
java.util.Iterator<IComponent> |
localBackIterator()
Return an
Iterator object that iterates over the direct
descendants only of this composite element, in reverse order. |
java.util.Iterator<IComponent> |
localIterator()
Return an
Iterator object that iterates over the direct
descendants only of this composite element, in order. |
void |
print(java.io.PrintWriter os)
Dump contents to a text stream.
|
void |
propagate(IProbe probe)
Propagate probe through sequence
|
void |
propagate(IProbe probe,
double pos)
Override of
IComponent.propagate(xal.model.IProbe, double) |
boolean |
remove(IComponent iComp)
Remove an element from the entire tree.
|
void |
setComments(java.lang.String strComment)
Sets any user comment associated with this sequence.
|
protected void |
setCompList(java.util.List<? extends IComponent> elements)
Set the comp list to the new list of elements.
|
void |
setHardwareNodeId(java.lang.String strSmfId)
Sets the string identifier of the hardware node which this
element models.
|
void |
setId(java.lang.String strId)
Set the string identifier for the element.
|
java.lang.String |
toString()
Writes out the modeling elements in this element sequence
structure.
|
public static final int s_szDefReserve
public ElementSeq(java.lang.String strType)
ElementSeq without of the
given soft type but without a sequence identifier.strType - soft type of the sequence (defined by the child class)public ElementSeq(java.lang.String strType,
java.lang.String strId)
ElementSeq with the
given soft type and sequence identifier.strType - soft type of the sequence (defined by the child class)strId - identifier of the sequencepublic ElementSeq(java.lang.String strType,
java.lang.String strId,
int szReserve)
ElementSeq with the
given soft type and sequence identifier.
Also reserves space for a the sequence elements.
This saves a little CPU time if the relative size of the
sequence is known a priori.strType - soft type of the sequence (defined by the child class)strId - identifier of the sequenceszReserve - number of Element spaces to reservepublic void initializeFrom(LatticeElement latticeElement)
initializeFrom in interface IComponentlatticeElement - the SMF node to convertpublic void setId(java.lang.String strId)
strId - new string identifier for elementpublic void setHardwareNodeId(java.lang.String strSmfId)
strSmfId - identifier for the modeled hardware node (SMF object)public void setComments(java.lang.String strComment)
strComment - string containing user commentspublic java.lang.String getType()
getType in interface IComponentpublic java.lang.String getId()
getId in interface IComponentpublic java.lang.String getHardwareNodeId()
getHardwareNodeId in interface IComponentpublic double getLength()
getLength in interface IComponentpublic void propagate(IProbe probe, double pos) throws ModelException
Override of IComponent.propagate(xal.model.IProbe, double)
propagate in interface IComponentModelExceptionIComponent.propagate(xal.model.IProbe, double)public void propagate(IProbe probe) throws ModelException
propagate in interface IComponentpropagate in interface ICompositeprobe - the state of the probe will be advance using the elements dynamicsModelException - an error occurred while advancing the probe stateIComponent.propagate(IProbe)public void backPropagate(IProbe probe, double pos) throws ModelException
Override of IComponent.propagate(xal.model.IProbe, double)
NOTES: CKA
· Support for backward propagation
February, 2009.
· You must use the proper algorithm object
for this method to work correctly!
backPropagate in interface IComponentprobe - probe to be propagate - its state is advancedpos - position within elementModelException - error advancing the probe stateIComponent.propagate(xal.model.IProbe, double)public void backPropagate(IProbe probe) throws ModelException
Backward propagation of probe through sequence.
NOTES: CKA
· Support for backward propagation
February, 2009.
· You must use the proper algorithm object
for this method to work correctly!
backPropagate in interface IComponentprobe - the state of the probe will be advance using the elements dynamicsModelException - an error occurred while advancing the probe statepublic java.util.Iterator<IComponent> localIterator()
Iterator object that iterates over the direct
descendants only of this composite element, in order.localIterator in interface ICompositeIteratorpublic java.util.Iterator<IComponent> globalIterator()
Iterator object that iterates over every
IComponent object in this composite. For
IComponent which are also composite the parent is
returned first, then all its children. This would be in reverse
order.globalIterator in interface ICompositeIterator interface to iterator objectIteratorpublic java.util.Iterator<IComponent> localBackIterator()
Iterator object that iterates over the direct
descendants only of this composite element, in reverse order.Iteratorpublic java.util.Iterator<IComponent> globalBackIterator()
Iterator object that iterates over every
IComponent object in this composite. For
IComponent which are also composite the parent is
returned first, then all its children. This would be in reverse
order.Iterator interface to iterator objectIteratorpublic int getChildCount()
getChildCount in interface ICompositepublic IComponent getChild(int indChild)
getChild in interface ICompositeindChild - position index within the sequence listpublic void addChild(IComponent iComp)
Add a component object at the tail of the sequence.
NOTES: CKA
· Added support for backward propagation
February, 2009
addChild in interface ICompositeiComp - new component objectpublic boolean remove(IComponent iComp)
remove in interface ICompositeiComp - IComponent object to be removedpublic java.lang.String getComments()
public int getLeafCount()
IElement derived objects contained
in this sequence.Element object w/in sequencepublic java.util.Iterator<IComponent> childIterator()
Iterator object that cycles through
all the direct children of the sequence. Note that any child
may have children itself.IElement interfacespublic java.util.List<IComponent> getElementList()
IElement objects contained
in this sequence.public java.util.List<IComponent> getAllElements()
IComponent class
elements in this sequencepublic void concatenateEquals(ElementSeq seq)
ElementSeq object
to the tail of this sequence.seq - object to conjoin to this onepublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public void print(java.io.PrintWriter os)
os - output streamprotected java.util.List<IComponent> getCompList()
protected java.util.List<IComponent> getReverseCompList()
Return the reverse component list (downstream to upstream)
NOTES: CKA
· Added support for backward propagation
February, 2009
List of sequence components in reverse orderprotected void setCompList(java.util.List<? extends IComponent> elements)
Set the comp list to the new list of elements.
NOTES: CKA
· Added support for backward propagation
February, 2009
elements - the new list of elements