Exemplo n.º 1
0
 /**
  * Export optics changes using the exporter.
  *
  * @param exporter the optics exporter to use for exporting this node's optics changes
  */
 public void exportOpticsChanges(final OpticsExporter exporter) {
   final LiveParameter parameter = getLiveParameter(FIELD_INDEX);
   if (parameter.getDesignValue() != parameter.getInitialValue()) {
     final DataAdaptor adaptor =
         exporter.getChildAdaptor(getNode().getParent(), getNode().dataLabel());
     adaptor.setValue("id", getNode().getId());
     final DataAdaptor attributesAdaptor = adaptor.createChild("attributes");
     final DataAdaptor magnetAdaptor = attributesAdaptor.createChild("magnet");
     magnetAdaptor.setValue("dfltMagFld", parameter.getInitialValue());
   }
 }
Exemplo n.º 2
0
  /**
   * Write data to the data adaptor for storage.
   *
   * @param adaptor The adaptor to which the receiver's data is written
   */
  public void write(final DataAdaptor adaptor) {
    if (_correctorSupplyMap != null) {
      for (final CorrectorSupply supply : _correctorSupplyMap.values()) {
        final DataAdaptor supplyAdaptor = adaptor.createChild("supply");
        supplyAdaptor.setValue("id", supply.getID());
        supplyAdaptor.setValue("enable", supply.isEnabled());

        if (supply.isLowerFieldLimitCustom()) {
          supplyAdaptor.setValue("lowerFieldLimit", supply.getLowerFieldLimit());
        }

        if (supply.isUpperFieldLimitCustom()) {
          supplyAdaptor.setValue("upperFieldLimit", supply.getUpperFieldLimit());
        }
      }
    }

    if (_bpmAgents != null) {
      for (final BpmAgent bpmAgent : _bpmAgents) {
        final boolean flattenEnable = bpmAgent.getFlattenEnabled();
        if (!flattenEnable) { // only need to store the exceptions
          final DataAdaptor bpmAdaptor = adaptor.createChild("bpm");
          bpmAdaptor.setValue("id", bpmAgent.getID());
          bpmAdaptor.setValue("flattenEnable", flattenEnable);
        }
      }
    }

    if (_flattener != null) {
      adaptor.writeNode(_flattener);
    }

    for (OrbitSource orbitSource : _orbitSources) {
      if (orbitSource instanceof SnapshotOrbitSource || orbitSource instanceof LiveOrbitSource) {
        adaptor.writeNode(orbitSource);
      }
    }
  }