Class LatticeSequence
- All Implemented Interfaces:
Comparable<LatticeElement>
,Iterable<LatticeElement>
- Direct Known Subclasses:
LatticeSequenceCombo
The Open XAL online model lattice generator is primarily contained here.
Given a valid ElementMapping
object, AcceleratorSeq
object, and SynchronizationManager
for the online model, the
LatticeSequence
will create an online model Lattice
object. This object is used by a ScenarioGenerator
to create a
new Scenario
object.
Thus, the actual "lattice generation" is done here. The peripheral resources such as hardware node to model element mappings and synchronization managers are created outside this class.
- Since:
- Dec 8, 2014
- Author:
- Christopher K. Allen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Small number - usually the minimum drift lengthFields inherited from class xal.sim.scenario.LatticeElement
dblElemCntrPos, dblElemEntrPos, dblElemExitPos, dblElemLen
-
Constructor Summary
ConstructorsConstructorDescriptionLatticeSequence
(AcceleratorSeq smfSeqRoot, ElementMapping mapNodeToElem) Constructor for lattice sequences. -
Method Summary
Modifier and TypeMethodDescriptionCreates and initializes a new modeling composite sequence represented by this object.createModelLattice
(SynchronizationManager mgrSync) Creates a new model lattice object according to the configuration of this lattice sequence.protected IComposite
Builds an online model element sequence for the accelerator sequence provided to the public constructor of this class.protected Lattice
Creates the actual model lattice object from the given element sequence.Some of the cursory fields of the lattice are populated.Overrides the base class
method so that it down casts the result to the tighter type ofLatticeElement.getHardwareNode()
AcceleratorSeq
rather thanAcceleratorNode
.Class<? extends IComposite>
Returns the class type of the modeling element used to represent the associated hardware node.Returns the map of SMF hardware nodes to online modeling elements, or more specifically, modeling element class types.Class<? extends IComposite>
getSequenceModelType
(AcceleratorSeq smfSeq) Convenience method for getting the modeling element type for the given accelerator sequence according to the current node to element mapping.final List<LatticeSequence>
Returns an iterator that will visit all the direct subsequences of this sequence.boolean
Returns whether or the origin of the axis is at the center of the sequence, normally it is located at the entrance of the sequence.boolean
Indicates whether or not the associated hardware accelerator sequence is an RF cavity structure.boolean
isThin()
Always returnsfalse
iterator()
Iterates element by element through the element lattice from head to tail.toString()
Lists all the internal lattice elements line by line.Methods inherited from class xal.sim.scenario.LatticeElement
axialTranslation, compareTo, getCenterPosition, getEndPosition, getFirstSlice, getLength, getModelingElementId, getNextSlice, getStartPosition, isArtificial, isContainedIn, isFirstSlice, isLastSlice, setModelingElementId, splitElementAt, splitElementAt
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EPS
public static final double EPSSmall number - usually the minimum drift length- See Also:
-
-
Constructor Details
-
LatticeSequence
Constructor for lattice sequences. Instantiates a new
LatticeSequence
object for the given accelerator sequence under the assumption that that sequence is the top level (i.e., not a sub-sequence).NOTES
· The lattice element position and index parameters for the base class are both set to zero since this is the root of the lattice structure.- Parameters:
smfSeqRoot
- top level associated hardware accelerator sequencemapNodeToElem
- the mapping of SMF hardware nodes to modeling element class types- Since:
- Dec 8, 2014 @author Christopher K. Allen
-
-
Method Details
-
isRfCavity
public boolean isRfCavity()Indicates whether or not the associated hardware accelerator sequence is an RF cavity structure. Such structures are derived from the base class
.RfCavity
- Returns:
true
if the accelerator sequence is and RF cavity,false
otherwise- Since:
- Dec 9, 2014
-
isAxisOriginCentered
public boolean isAxisOriginCentered()Returns whether or the origin of the axis is at the center of the sequence, normally it is located at the entrance of the sequence.- Returns:
true
if the axis origin is at the center of the sequence,false
otherwise (likely at the sequence entrance)- Since:
- Jan 29, 2015 by Christopher K. Allen
-
getSequenceModelType
Convenience method for getting the modeling element type for the given accelerator sequence according to the current node to element mapping.- Parameters:
smfSeq
- accelerator sequence hardware object to be looked up in the map- Returns:
- modeling class for the given accelerator sequence
- Since:
- Dec 12, 2014 @author Christopher K. Allen
-
getNodeToElementMap
Returns the map of SMF hardware nodes to online modeling elements, or more specifically, modeling element class types. This map is used when creating a modeling element for any given hardware node.- Returns:
- mapping between hardware nodes and modeling elements used to generate the model lattice
- Since:
- Jan 21, 2015 by Christopher K. Allen
-
createModelLattice
Creates a new model lattice object according to the configuration of this lattice sequence. The given synchronization manager is populated with synchronization associations for the returned model lattice. However, the synchronization manager is still unbound to any scenario.- Parameters:
mgrSync
- synchronization manager to receive synchronization associations for the model elements in the returned model lattice- Returns:
- new model lattice with the configuration provided by the accelerator sequence given to the public constructor
- Throws:
ModelException
- problem instantiating modeling elements- Since:
- Dec 11, 2014
-
getSubSequences
Returns an iterator that will visit all the direct subsequences of this sequence.- Returns:
- iterator for all the direct subsequences of this sequence
- Since:
- Jan 29, 2015 by Christopher K. Allen
-
iterator
Iterates element by element through the element lattice from head to tail.- Specified by:
iterator
in interfaceIterable<LatticeElement>
- Since:
- Dec 9, 2014
- See Also:
-
isThin
public boolean isThin()Always returnsfalse
- Overrides:
isThin
in classLatticeElement
- Returns:
true
if a modeling element derived fromThinElement
will be returned,false
otherwise- Since:
- Dec 9, 2014
- See Also:
-
getModelingClass
Description copied from class:LatticeElement
Returns the class type of the modeling element used to represent the associated hardware node.- Overrides:
getModelingClass
in classLatticeElement
- Returns:
- class type of the modeling element to be created
- Since:
- Dec 9, 2014
- See Also:
-
getHardwareNode
Overrides the base class
method so that it down casts the result to the tighter type ofLatticeElement.getHardwareNode()
AcceleratorSeq
rather thanAcceleratorNode
. This class can be instantiated only with aAcceleratorSeq
derived hardware node, we are just enforcing it here.- Overrides:
getHardwareNode
in classLatticeElement
- Returns:
- the accelerator sequence hardware associated with this lattice sequence object
- Since:
- Dec 11, 2014
- See Also:
-
createModelingElement
Creates and initializes a new modeling composite sequence represented by this object. Java reflection is used to create a new instance from the sequence's class type. There must be a zero constructor for the element.
CKA Notes
· The parameter initialization is done by calling the
. This design effectively couples theIComponent.initializeFrom(LatticeElement)
xal.model
online model subsystem to thexal.smf
hardware representation subsystem. These systems should be independent, able to function without each other.- Overrides:
createModelingElement
in classLatticeElement
- Returns:
- a new modeling sequence for the hardware proxied by this object
- Throws:
ModelException
- Java reflection threw anInstantiationException
- Since:
- Jan 16, 2015
-
toString
Lists all the internal lattice elements line by line.- Overrides:
toString
in classLatticeElement
- Since:
- Dec 9, 2014
- See Also:
-
createModelSequence
Builds an online model element sequence for the accelerator sequence provided to the public constructor of this class. This is done by calling the private methodspopulateLatticeSeq()
,splitSequenceElements()
, andcreateModelElements(SynchronizationManager)
in that order. When the actual modeling elements are instantiated (viacreateModelElements(SynchronizationManager)
) they are connected to the given synchronization manager.- Parameters:
mgrSync
- synchronization manager to receive synchronization associations for the new created model elements- Returns:
- new online model sequence with the configuration provided by the accelerator sequence given to the public constructor
- Throws:
ModelException
- problem instantiating modeling elements- Since:
- Jan 21, 2015 by Christopher K. Allen
-
createParentLattice
Creates the actual model lattice object from the given element sequence.Some of the cursory fields of the lattice are populated.- Returns:
- model lattice object containing the given root sequence
- Since:
- Jan 20, 2015 by Christopher K. Allen
-