Package xal.smf

Class AcceleratorSeqCombo

All Implemented Interfaces:
Comparable, ElementType, DataListener
Direct Known Subclasses:
Ring

public class AcceleratorSeqCombo extends AcceleratorSeq
The implementation of the accelerator combo sequence, This class is meant to deal with pasting together existing sequences into new sequences.
Author:
J. Galambos
  • Field Details

  • Constructor Details

  • Method Details

    • getInstance

      public static AcceleratorSeqCombo getInstance(String strID, List<AcceleratorSeq> sequences)
      Instantiate a an AcceleratorSeqCombo or a subclass depending on whether the sequences form a ring.
      Parameters:
      strID - The identifier of the new combo sequence
      sequences - The sequences to flatten into a combo sequence
      Returns:
      a new AcceleratorSeqCombo instance if the sequences do not form a ring and a Ring if they do
    • getInstance

      public static AcceleratorSeqCombo getInstance(String strID, Accelerator accelerator, DataAdaptor adaptor)
      Instantiate a an AcceleratorSeqCombo or a subclass depending on whether the sequences form a ring.
      Parameters:
      strID - The identifier of the new combo sequence
      accelerator - The accelerator that holds to the sequences
      adaptor - the data adaptor for specifying the sequences to combine
      Returns:
      a new AcceleratorSeqCombo instance if the sequences do not form a ring and a Ring if they do
    • getInstance

      public static AcceleratorSeqCombo getInstance(Accelerator accelerator, DataAdaptor adaptor)
      Instantiate a an AcceleratorSeqCombo or a subclass depending on whether the sequences form a ring.
      Parameters:
      accelerator - The accelerator that holds to the sequences
      adaptor - the data adaptor for specifying the sequences to combine
      Returns:
      a new AcceleratorSeqCombo instance if the sequences do not form a ring and a Ring if they do
    • getInstanceForRange

      public static AcceleratorSeqCombo getInstanceForRange(String comboID, AcceleratorSeq startSequence, AcceleratorSeq endSequence)
      Get an instance of a non-cycling combo sequence which starts and ends between the specified sequences inclusively.
      Parameters:
      comboID - unique ID to assign to the new combo sequence
      startSequence - first sequence in combo
      endSequence - last sequence in combo
      Returns:
      a combo sequence ranging from the first sequence to the last sequence or null if none can be found
    • getInstancesForRange

      public static List<AcceleratorSeqCombo> getInstancesForRange(String comboID, AcceleratorSeq startSequence, AcceleratorSeq endSequence)
      Get the list of all non-cycling combo sequences which start and end between the specified sequences inclusively.
      Parameters:
      comboID - unique ID to assign to the new combo sequence
      startSequence - first sequence in combo
      endSequence - last sequence in combo
      Returns:
      list of combo sequences ranging from the first sequence to the last sequence
    • getSequences

      protected static List<AcceleratorSeq> getSequences(Accelerator accelerator, DataAdaptor adaptor)
      Get the sequences in the accelerator which are referenced in the adaptor.
      Parameters:
      accelerator - the accelerator from which to get the sequences
      adaptor - the combo sequence adaptor
    • write

      public void write(DataAdaptor adaptor)
      Write this sequence's definition to a data adaptor.
      Specified by:
      write in interface DataListener
      Overrides:
      write in class AcceleratorSeq
      Parameters:
      adaptor - the adaptor to which to write out this combo sequence's definition.
    • getType

      public String getType()
      Override to identify this sequence as a combo sequence
      Overrides:
      getType in class AcceleratorSeq
      Returns:
      the combo sequence type identifier
    • getLength

      public double getLength()
      override the total length for this combo sequence
      Overrides:
      getLength in class AcceleratorSeq
      Returns:
      the length of this sequence along the closed orbit
    • getConstituentNames

      public List<String> getConstituentNames()
      gets the list of the names of the constituent sequences
    • getPosition

      public double getPosition(AcceleratorNode node)
      get the position of a node in the sequence, including the extra length of the sequence starting position itself Note: this way could also be done in the parent AcceleratorSeq class, be we choose to use a more efficient scheme there, specific to primary sequences.
      Overrides:
      getPosition in class AcceleratorSeq
      Parameters:
      node - - the node for which the position is wanted
    • getEntranceID

      public String getEntranceID()
      Get the ID of the first base constituent sequence of this combo sequence.
      Overrides:
      getEntranceID in class AcceleratorSeq
      Returns:
      the ID of first base constituent sequence
    • getNodeWithId

      public AcceleratorNode getNodeWithId(String label)
      Search deeply for and get the node with the specified id. Overrides the inherited method to search down the path of the constituent sequences.
      Overrides:
      getNodeWithId in class AcceleratorSeq
      Parameters:
      label - The id of the node we are seeking.
      Returns:
      the node corresponding to the requested id or null if no such node is found.
    • getNodes

      public List<AcceleratorNode> getNodes()
      Shallow fetch of nodes. Override the AcceleratorSeq version to only return the list of nodes which are a union of those nodes which belong to the base constituent sub-sequences.
      Overrides:
      getNodes in class AcceleratorSeq
      Returns:
      a list of this sequence's immediate child nodes
    • getSequences

      public List<AcceleratorSeq> getSequences()
      Shallow fetch of sequences. Override the AcceleratorSeq version to only return the list of sequences which are a union of those nodes which belong to the base constituent sub-sequences.
      Overrides:
      getSequences in class AcceleratorSeq
    • getConstituents

      public List<AcceleratorSeq> getConstituents()
      Get the constituent sequences.
      Returns:
      the list of constituent sequences that make the primary sequence
    • getConstituentsWithQualifier

      public List<AcceleratorSeq> getConstituentsWithQualifier(TypeQualifier qualifier)
      Get the constituent sequences that are matched by the qualifier.
      Parameters:
      qualifier - The qualifier to restrict which constituents are returned
      Returns:
      the list of constituent sequences that make the combo sequence
    • getBaseConstituents

      public List<AcceleratorSeq> getBaseConstituents()
      Get the constituent sequences looking deeply even if the combo sequences are nested in many layers.
      Returns:
      the list of constituent sequences that make the combo sequence
    • getBaseConstituentsWithQualifier

      public List<AcceleratorSeq> getBaseConstituentsWithQualifier(TypeQualifier qualifier)
      Get the constituent sequences looking deeply even if the combo sequences are nested in many layers. Use the qualifier to limit the constituent sequences to only those which match the qualifier.
      Parameters:
      qualifier - The qualifier for matching which constituents get returned
      Returns:
      the list of qualified constituent sequences that make the combo sequence
    • getAllInclusiveNodes

      public List<AcceleratorNode> getAllInclusiveNodes()
      Get all nodes including this sequence and constituent sequences and all of their children.
      Overrides:
      getAllInclusiveNodes in class AcceleratorSeq
      Returns:
      the list of all inclusive nodes
    • getAllNodes

      public List<AcceleratorNode> getAllNodes()
      Fetch all nodes looking deeply through nested child sequences. Filter out constituent sequences.
      Overrides:
      getAllNodes in class AcceleratorSeq
      Returns:
      all child nodes looking deeply through nested child sequences
    • equals

      public boolean equals(Object sequence)
      Override the equals method to return true if and only if the two combo sequences have equal IDs, are both combo sequences and have equal constituents.
      Overrides:
      equals in class Object
      Parameters:
      sequence - the sequence against which to compare
      Returns:
      true if and only if the two sequences are equal
    • hashCode

      public int hashCode()
      Override hashCode() as required when overriding equals()
      Overrides:
      hashCode in class Object
    • getAperProfile

      public ApertureProfile getAperProfile()
      Description copied from class: AcceleratorSeq
      Get all nodes in the specified sequence and gets the aperture bucket values.
      Overrides:
      getAperProfile in class AcceleratorSeq
      Returns:
      an ApertureProfile object containing the X and Y aperture profiles