Esempio n. 1
0
  /** Return a list of BPM nodes associated with the list of bpmAgents */
  public static List<BPM> getNodes(final List<BpmAgent> bpmAgents) {
    final int count = bpmAgents.size();
    final List<BPM> bpmNodes = new ArrayList<>(count);

    for (int index = 0; index < count; index++) {
      final BpmAgent bpmAgent = bpmAgents.get(index);
      bpmNodes.add(bpmAgent.getNode());
    }
    return bpmNodes;
  }
Esempio n. 2
0
 /**
  * Get the value associated with the specified key.
  *
  * @param key The key for which to get the associated value.
  * @return The value as an Object.
  */
 public Object valueForKey(final String key) {
   if (key.equals(CORRECTOR_KEY)) {
     return isCorrectorSupply();
   }
   if (key.equals(SINGLE_MAGNET_KEY)) {
     return _correctors.size() == 1;
   }
   if (key.equals(PLANE_KEY)) {
     return isHorizontal() ? "X" : "Y";
   } else {
     return null;
   }
 }
Esempio n. 3
0
 /**
  * Get the position of the first corrector relative to the start of the specified sequence.
  *
  * @param sequence The sequence relative to which the corrector's position is measured
  * @return the position of this supply's first corrector relative to the sequence in meters
  */
 public double getFirstCorrectorPositionIn(AcceleratorSeq sequence) {
   return sequence.getPosition(_correctors.get(0).getCorrector());
 }
Esempio n. 4
0
 /**
  * Determine whether the corrector supply is horizontal or vertical.
  *
  * @return MagnetType.HORIZONTAL for a horizontal corrector and MagnetType.VERTICAL for a vertical
  *     one
  */
 public int getOrientation() {
   return _correctors.get(0).getCorrector().getOrientation();
 }
Esempio n. 5
0
 /** Determine if the supply powers vertical correctors */
 public boolean isVertical() {
   return _correctors.get(0).isVertical();
 }
Esempio n. 6
0
 /** Determine if the supply powers horizontal correctors */
 public boolean isHorizontal() {
   return _correctors.get(0).isHorizontal();
 }
Esempio n. 7
0
 /** Determine if the supply powers a corrector dipole rather than a bend */
 public boolean isCorrectorSupply() {
   return _correctors.get(0).isCorrector();
 }
Esempio n. 8
0
 /**
  * Associate a corrector with this supply.
  *
  * @param corrector the corrector agent to associate with this supply
  */
 public void addCorrector(final CorrectorAgent corrector) {
   _correctors.add(corrector);
   _isEnabled = corrector.isCorrector(); // by default enable only corrector supplies
 }