public class AcceleratorSeq extends AcceleratorNode implements DataListener
Modifier and Type | Field and Description |
---|---|
protected java.util.List<AcceleratorSeq> |
_sequences
Container of immediate subsequences
|
protected java.util.List<AcceleratorNode> |
m_arrNodes
Container of immediate nodes in this sequence
|
protected SequenceBucket |
m_bucSequence
bucket for sequence parameters
|
protected java.util.Map<java.lang.String,AcceleratorNode> |
nodeTable
table of nodes keyed by ID
|
static java.lang.String |
s_strType
indicates the node type as being a sequence
|
channelSuite, m_bolIsSoft, m_bolStatus, m_bolValid, m_bucAlign, m_bucAper, m_bucTwiss, m_dblLen, m_dblPos, m_dblS, m_mapAttrs, m_objAccel, m_seqParent, m_strEId, m_strId, m_strPId
Constructor and Description |
---|
AcceleratorSeq(java.lang.String strId)
base constructor
|
AcceleratorSeq(java.lang.String strId,
int intReserve)
constructor that sets aside some space for nodes to come
|
Modifier and Type | Method and Description |
---|---|
void |
addBucket(AttributeBucket buc)
General attribute buckets support
|
boolean |
addNode(AcceleratorNode newNode)
Method to move a node from one sequence to this sequence
warning be careful - need to check node position when moving it about!!
|
void |
addNodeAt(int iIndex,
AcceleratorNode node)
Add a node at a prescribed index
|
protected java.util.List<AcceleratorSeq> |
addSequenceChain(java.util.LinkedList<AcceleratorSeq> orderedSequences,
java.util.Map<java.lang.String,AcceleratorSeq> sequenceMap)
Internal support for the orderSequences() method.
|
protected boolean |
addSoft(AcceleratorSeq node)
Method to add a node from to this sequence
the node is also kept in its original sequence.
|
static <SourceType extends AcceleratorNode,NodeType extends SourceType> |
appendNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass,
java.util.List<NodeType> matchedNodes,
java.util.List<SourceType> sourceNodes,
TypeQualifier qualifier)
Filter nodes from the source list using the specified qualifier.
|
static <SourceType extends AcceleratorNode,NodeType extends SourceType> |
appendNodesWithQualifier(java.util.List<NodeType> matchedNodes,
java.util.List<SourceType> sourceNodes,
TypeQualifier qualifier)
Filter nodes from the source list using the specified qualifier.
|
boolean |
canPrecede(AcceleratorSeq sequence)
Determine if this sequence can precede the one specified.
|
boolean |
contains(AcceleratorNode node)
Check to see if the node is a shallow child of this sequence.
|
java.lang.String |
dataLabel()
data adaptor label
|
static <SourceType extends AcceleratorNode,NodeType extends SourceType> |
filterNodesByClass(java.lang.Class<NodeType> resultClass,
java.util.List<SourceType> sourceNodes)
Filter nodes from the source list which can be cast to the specified result class.
|
static <NodeType extends AcceleratorNode> |
filterNodesByStatus(java.util.List<NodeType> nodes,
boolean statusFilter)
Filter nodes from the source list using the specified status filter.
|
static boolean |
formsRing(java.util.List<AcceleratorSeq> sequences)
Determing if the ordered list of sequences forms a closed loop.
|
java.util.List<AcceleratorNode> |
getAllInclusiveNodes()
Fetch all nodes which are contained in this sequence looking deeply through its nested child sequences.
|
java.util.List<AcceleratorNode> |
getAllInclusiveNodes(boolean statusFilter)
Fetch all nodes which are contained in this sequence looking deeply through its nested child sequences.
|
<NodeType extends AcceleratorNode> |
getAllInclusiveNodesWithQualifier(TypeQualifier qualifier)
Fetch all nodes whose type is matched through the qualifier and are also contained in this sequence looking deeply through its nested child sequences.
|
java.util.List<AcceleratorNode> |
getAllNodes()
Fetch all nodes contained in this sequence looking deeply through its nested child sequences.
|
java.util.List<AcceleratorNode> |
getAllNodes(boolean statusFilter)
Get all nodes filtered for the specified status.
|
<NodeType extends AcceleratorNode> |
getAllNodesOfType(java.lang.String strTypeId)
Fetch all nodes whose type is matched through the qualifier and are also contained in this sequence looking deeply through its
nested child sequences.
|
<NodeType extends AcceleratorNode> |
getAllNodesWithQualifier(TypeQualifier qualifier)
Fetch all nodes whose type is matched through the qualifier and are also contained in this sequence or one of its nested child sequences.
|
java.util.List<AcceleratorSeq> |
getAllSeqs()
Get a list of all of this sequence's subsequences including those deeply nested.
|
double |
getDistanceBetween(AcceleratorNode reference,
AcceleratorNode node)
Get the distance of the second node from the first node.
|
java.lang.String |
getEntranceID()
Get the ID of this sequence.
|
int |
getIndexOfNode(AcceleratorNode child)
returns the index of a node
|
java.util.Iterator<AcceleratorNode> |
getLeaves()
Get an iterator of this sequence's immediate child nodes.
|
double |
getLength()
Return the total length (m) of this sequence
|
AcceleratorNode |
getNodeAt(int iIndex)
returns the accelerator node at a prescribed index within this sequence
|
int |
getNodeCount()
returns the number of nodes in this sequence
|
java.util.List<AcceleratorNode> |
getNodes()
Get a list of this sequence's immediate child nodes.
|
java.util.List<AcceleratorNode> |
getNodes(boolean statusFilter)
Get the this sequence's immediate child nodes with the specified status.
|
static <SourceType extends AcceleratorNode,NodeType extends SourceType> |
getNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass,
java.util.List<SourceType> sourceNodes,
TypeQualifier qualifier)
Filter nodes from the source list using the specified qualifier.
|
<SourceType extends AcceleratorNode,NodeType extends SourceType> |
getNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass,
TypeQualifier qualifier)
Get nodes using the specified qualifier.
|
<SourceType extends AcceleratorNode,NodeType extends SourceType> |
getNodesOfClassWithStatus(java.lang.Class<NodeType> resultClass,
boolean statusFilter)
Get nodes of the specified class with the specified status.
|
<NodeType extends AcceleratorNode> |
getNodesOfType(java.lang.String strTypeId)
Shallow fetch of nodes whose type is given by the string.
|
<NodeType extends AcceleratorNode> |
getNodesOfType(java.lang.String strTypeId,
boolean statusFilter)
Shallow fetch of nodes whose type is given by the string.
|
static <SourceType extends AcceleratorNode,NodeType extends SourceType> |
getNodesWithQualifier(java.util.List<SourceType> sourceNodes,
TypeQualifier qualifier)
Filter nodes from the source list using the specified qualifier.
|
<NodeType extends AcceleratorNode> |
getNodesWithQualifier(TypeQualifier qualifier)
Shallow fetch of nodes that are matched by the qualifier.
|
AcceleratorNode |
getNodeWithId(java.lang.String label)
Search deeply for and get the node with the specified id.
|
double |
getPosition(AcceleratorNode node)
Get the position of a node in the sequence, including the possible offset of a local sequence containing the node.
|
java.lang.String[] |
getPredecessors()
Return the allowed predecessor sequences of a sequence
At most there can be 2 predecessors.
|
AcceleratorSeq |
getPrimaryAncestor()
get the primary ancestor sequence that is a direct child of the accelerator
|
double |
getRelativePosition(double position,
AcceleratorNode referenceNode)
Convert the sequence position to a position relative to the specified reference node.
|
double |
getRelativePosition(double position,
java.lang.String referenceNodeID)
Convert the sequence position to a position relative to the specified reference node.
|
AcceleratorSeq |
getSequence(java.lang.String strId)
Return a sequence whose id matches the argument and which is an
immediate child of this sequence.
|
SequenceBucket |
getSequenceBuc()
returns the bucket containing the sequence parameters
- see attr.
|
java.util.List<AcceleratorSeq> |
getSequences()
Get the sequences that are immediate children of this sequence
|
java.util.List<AcceleratorSeq> |
getSequences(boolean statusFilter)
Get the sequences that are immediate children of this sequence
|
double |
getShortestRelativePosition(AcceleratorNode node,
AcceleratorNode referenceNode)
Get the shortest relative postion of one node with respect to a reference node.
|
java.lang.String |
getType()
Support the node type
|
protected int |
indexToAddNode(AcceleratorNode newNode)
Find the index to insert the node in increasing order of position.
|
boolean |
isLinear()
Identify whether the sequence is within a linear section.
|
static java.util.List<AcceleratorSeq> |
orderSequences(java.util.Collection<AcceleratorSeq> sequences)
Given a collection of sequences, order the sequences according to their predecessor attribute.
|
protected static java.util.LinkedList<AcceleratorNode> |
recurNodeSearch(java.util.LinkedList<AcceleratorNode> nodes,
AcceleratorSeq sequence)
Get all nodes in the specified sequence searching deeply through this sequence's child sequences.
|
protected static java.util.LinkedList<AcceleratorSeq> |
recurSeqSearch(java.util.LinkedList<AcceleratorSeq> sequences,
AcceleratorSeq branch)
Get all sequences in the specified sequence branch, searching down all of its branches
|
void |
removeAllNodes()
Remove all nodes from the this sequence.
|
boolean |
removeNode(AcceleratorNode node)
remove a node from this sequence
|
void |
setSequence(SequenceBucket buc) |
void |
sortNodes(java.util.List<? extends AcceleratorNode> nodes)
Sort nodes in place by position where the position used is relative to the this sequence.
|
void |
sortNodesByProximity(java.util.List<? extends AcceleratorNode> nodes,
AcceleratorNode referenceNode)
Sort nodes in place by proximity to a reference node.
|
void |
sortNodesByRelativePosition(java.util.List<? extends AcceleratorNode> nodes,
AcceleratorNode referenceNode)
Sort nodes in place by position relative to the reference node (ranked negative to positive).
|
void |
update(DataAdaptor adaptor)
Update this sequence from the specified data adaptor
|
void |
write(DataAdaptor adaptor)
write the acceleratorSeq to the data adaptor
|
void |
writeDeeply(DataAdaptor adaptor)
write this sequence's child accelerator nodes deeply traversing each branch.
|
channelSuite, clear, findChannel, getAccelerator, getAlign, getAndConnectChannel, getAper, getBucket, getBuckets, getChannel, getDesignPropertyValue, getEId, getHandles, getId, getLivePropertyChannels, getLivePropertyValue, getParent, getPId, getPitchAngle, getPosition, getRollAngle, getSDisplay, getSoftType, getStatus, getTwiss, getValid, getXOffset, getYawAngle, getYOffset, getZOffset, hasBucket, hasParent, isKindOf, isMagnet, lazilyGetAndConnect, removeFromParent, setAccelerator, setAlign, setAper, setLength, setParent, setPitchAngle, setPosition, setRollAngle, setSDisplay, setStatus, setTwiss, setValid, setXOffset, setYawAngle, setYOffset, setZOffset, toString
public static final java.lang.String s_strType
protected SequenceBucket m_bucSequence
protected java.util.List<AcceleratorNode> m_arrNodes
protected java.util.Map<java.lang.String,AcceleratorNode> nodeTable
protected java.util.List<AcceleratorSeq> _sequences
public AcceleratorSeq(java.lang.String strId)
public AcceleratorSeq(java.lang.String strId, int intReserve)
public void addBucket(AttributeBucket buc)
AcceleratorNode
addBucket
in class AcceleratorNode
public SequenceBucket getSequenceBuc()
public void setSequence(SequenceBucket buc)
buc
- public java.lang.String dataLabel()
dataLabel
in interface DataListener
dataLabel
in class AcceleratorNode
public void update(DataAdaptor adaptor) throws java.lang.NumberFormatException
update
in interface DataListener
update
in class AcceleratorNode
adaptor
- The adaptor from which to update the datajava.lang.NumberFormatException
public void writeDeeply(DataAdaptor adaptor)
public void write(DataAdaptor adaptor)
write
in interface DataListener
write
in class AcceleratorNode
adaptor
- The adaptor to which the receiver's data is writtenpublic java.lang.String getType()
getType
in class AcceleratorNode
public java.lang.String getEntranceID()
public AcceleratorSeq getPrimaryAncestor()
getPrimaryAncestor
in class AcceleratorNode
public int getNodeCount()
public int getIndexOfNode(AcceleratorNode child)
child
- the node for which to get the indexpublic AcceleratorNode getNodeAt(int iIndex)
iIndex
- the index for the node of interest (indexing starts with 0)protected int indexToAddNode(AcceleratorNode newNode)
public boolean addNode(AcceleratorNode newNode)
protected boolean addSoft(AcceleratorSeq node)
public boolean contains(AcceleratorNode node)
node
- - the node to checkpublic void addNodeAt(int iIndex, AcceleratorNode node) throws java.lang.IndexOutOfBoundsException
iIndex
- = the index to insert this nodenode
- - the node to insertjava.lang.IndexOutOfBoundsException
public boolean removeNode(AcceleratorNode node)
node
- the node to removepublic void removeAllNodes()
public AcceleratorNode getNodeWithId(java.lang.String label)
label
- The id of the node we are seeking.public static <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> filterNodesByClass(java.lang.Class<NodeType> resultClass, java.util.List<SourceType> sourceNodes)
resultClass
- filters the returned nodes to those which can be cast to this classsourceNodes
- the list of nodes to filterpublic static <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> getNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass, java.util.List<SourceType> sourceNodes, TypeQualifier qualifier)
resultClass
- filters the returned nodes to those which can be cast to this class (assumes AcceleratorNode if null)sourceNodes
- the list of nodes to filterqualifier
- the qualifier used to filter the nodespublic static <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> appendNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass, java.util.List<NodeType> matchedNodes, java.util.List<SourceType> sourceNodes, TypeQualifier qualifier)
resultClass
- filters the returned nodes to those which can be cast to this class (assumes AcceleratorNode if null)matchedNodes
- container to append the list of matching nodessourceNodes
- the list of nodes to filterqualifier
- the qualifier used to filter the nodespublic static <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> appendNodesWithQualifier(java.util.List<NodeType> matchedNodes, java.util.List<SourceType> sourceNodes, TypeQualifier qualifier)
matchedNodes
- container to append the list of matching nodessourceNodes
- the list of nodes to filterqualifier
- the qualifier used to filter the nodespublic <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> getNodesOfClassWithQualifier(java.lang.Class<NodeType> resultClass, TypeQualifier qualifier)
resultClass
- filters the returned nodes to those which can be cast to this classqualifier
- the qualifier used to filter the nodespublic <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> getNodesOfClassWithStatus(java.lang.Class<NodeType> resultClass, boolean statusFilter)
resultClass
- filters the returned nodes to those which can be cast to this classstatusFilter
- the status for which to filter nodespublic static <SourceType extends AcceleratorNode,NodeType extends SourceType> java.util.List<NodeType> getNodesWithQualifier(java.util.List<SourceType> sourceNodes, TypeQualifier qualifier)
sourceNodes
- the list of nodes to filterqualifier
- the qualifier used to filter the nodespublic static <NodeType extends AcceleratorNode> java.util.List<NodeType> filterNodesByStatus(java.util.List<NodeType> nodes, boolean statusFilter)
nodes
- the list of nodes to filterstatusFilter
- the status for which to filter nodespublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getNodesOfType(java.lang.String strTypeId)
strTypeId
- type identifier of the nodes to fetchpublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getNodesOfType(java.lang.String strTypeId, boolean statusFilter)
strTypeId
- type identifier of the nodes to fetchstatusFilter
- the status for which to filter the nodespublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getNodesWithQualifier(TypeQualifier qualifier)
qualifier
- the qualifier used to filter nodespublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getAllNodesOfType(java.lang.String strTypeId)
strTypeId
- the type of node for which we are fetchingpublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getAllNodesWithQualifier(TypeQualifier qualifier)
qualifier
- the qualifier for filtering the nodespublic java.util.List<AcceleratorNode> getAllInclusiveNodes()
public java.util.List<AcceleratorNode> getAllInclusiveNodes(boolean statusFilter)
statusFilter
- the status for which to filter nodespublic <NodeType extends AcceleratorNode> java.util.List<NodeType> getAllInclusiveNodesWithQualifier(TypeQualifier qualifier)
qualifier
- the qualifier for filtering the nodespublic java.util.Iterator<AcceleratorNode> getLeaves()
public java.util.List<AcceleratorNode> getNodes()
public java.util.List<AcceleratorNode> getNodes(boolean statusFilter)
statusFilter
- the status for which to qualify nodespublic java.util.List<AcceleratorNode> getAllNodes()
public java.util.List<AcceleratorNode> getAllNodes(boolean statusFilter)
statusFilter
- the status for which to filter the nodespublic double getLength()
getLength
in class AcceleratorNode
public java.lang.String[] getPredecessors()
public boolean canPrecede(AcceleratorSeq sequence)
sequence
- the sequence which we are testing if this sequence can precedepublic static boolean formsRing(java.util.List<AcceleratorSeq> sequences)
sequences
- an ordered list of sequences to test for forming a ringpublic static java.util.List<AcceleratorSeq> orderSequences(java.util.Collection<AcceleratorSeq> sequences) throws SequenceOrderingException
sequences
- a collection of contiguous sequences to order from start to finishSequenceOrderingException
protected java.util.List<AcceleratorSeq> addSequenceChain(java.util.LinkedList<AcceleratorSeq> orderedSequences, java.util.Map<java.lang.String,AcceleratorSeq> sequenceMap)
orderedSequences
- the list of ordered sequences to append the next sequencesequenceMap
- the table of sequences from which to fetch the next sequencepublic java.util.List<AcceleratorSeq> getAllSeqs()
public AcceleratorSeq getSequence(java.lang.String strId)
public java.util.List<AcceleratorSeq> getSequences()
public java.util.List<AcceleratorSeq> getSequences(boolean statusFilter)
public double getPosition(AcceleratorNode node)
node
- - the node for which the position is wantedpublic double getDistanceBetween(AcceleratorNode reference, AcceleratorNode node)
reference
- the node from which to measure the distancenode
- the node to which to measure the distancepublic double getRelativePosition(double position, java.lang.String referenceNodeID)
public double getRelativePosition(double position, AcceleratorNode referenceNode)
position
- the position of a location relative to the sequence's startreferenceNode
- the node relative to which we wish to get the positionpublic double getShortestRelativePosition(AcceleratorNode node, AcceleratorNode referenceNode)
node
- the node whose relative position is soughtreferenceNode
- the reference node relative to which the node's position is calculatedpublic boolean isLinear()
public void sortNodes(java.util.List<? extends AcceleratorNode> nodes)
nodes
- the list of nodes to sortpublic void sortNodesByProximity(java.util.List<? extends AcceleratorNode> nodes, AcceleratorNode referenceNode)
nodes
- the list of nodes to sortreferenceNode
- the reference node for the proximity testpublic void sortNodesByRelativePosition(java.util.List<? extends AcceleratorNode> nodes, AcceleratorNode referenceNode)
nodes
- the list of nodes to sortreferenceNode
- the reference node for the proximity testprotected static java.util.LinkedList<AcceleratorSeq> recurSeqSearch(java.util.LinkedList<AcceleratorSeq> sequences, AcceleratorSeq branch)
sequences
- the collection of all sequences foundbranch
- the sequence branch down which to search for more sequencesprotected static java.util.LinkedList<AcceleratorNode> recurNodeSearch(java.util.LinkedList<AcceleratorNode> nodes, AcceleratorSeq sequence)
nodes
- the collection of all nodes foundsequence
- the branch down which to search for nodes