ResponseRequestImpl.java

  1. // @formatter:off
  2.  /*******************************************************************************
  3.  *
  4.  * This file is part of JMad.
  5.  *
  6.  * Copyright (c) 2008-2011, CERN. All rights reserved.
  7.  *
  8.  * Licensed under the Apache License, Version 2.0 (the "License");
  9.  * you may not use this file except in compliance with the License.
  10.  * You may obtain a copy of the License at
  11.  *
  12.  *     http://www.apache.org/licenses/LICENSE-2.0
  13.  *
  14.  * Unless required by applicable law or agreed to in writing, software
  15.  * distributed under the License is distributed on an "AS IS" BASIS,
  16.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17.  * See the License for the specific language governing permissions and
  18.  * limitations under the License.
  19.  *
  20.  ******************************************************************************/
  21. // @formatter:on

  22. package cern.accsoft.steering.jmad.tools.response;

  23. import java.util.ArrayList;
  24. import java.util.List;

  25. import cern.accsoft.steering.jmad.domain.types.enums.JMadPlane;

  26. public class ResponseRequestImpl implements ResponseRequest {
  27.     /** the correctors which to vary */
  28.     private final List<String> correctorNames = new ArrayList<String>();

  29.     /**
  30.      * the values which to apply for the strengthes (+/-) (must be equal size than strengthNames)
  31.      */
  32.     private final List<Double> kickValues = new ArrayList<Double>();

  33.     /** the Monitors for which to get result */
  34.     private final List<String> monitorNames = new ArrayList<String>();

  35.     /** Regular expressions for monitors */
  36.     private final List<String> monitorRegexps = new ArrayList<String>();

  37.     /** the planes for the monitors (must be of equal size than monitorNames) */
  38.     private final List<JMadPlane> monitorPlanes = new ArrayList<JMadPlane>();

  39.     /** the planes for the correctors (must be of equal size than monitorNames) */
  40.     private final List<JMadPlane> correctorPlanes = new ArrayList<JMadPlane>();

  41.     public void addCorrector(String correctorName, Double strengthValue, JMadPlane plane) {
  42.         correctorNames.add(correctorName);
  43.         kickValues.add(strengthValue);
  44.         correctorPlanes.add(plane);
  45.     }

  46.     public void addMonitor(String monitorName, JMadPlane plane) {
  47.         monitorNames.add(monitorName);
  48.         monitorPlanes.add(plane);
  49.     }

  50.     public void clearCorrectors() {
  51.         correctorNames.clear();
  52.         kickValues.clear();
  53.         correctorPlanes.clear();
  54.     }

  55.     public void clearMonitors() {
  56.         monitorNames.clear();
  57.         monitorPlanes.clear();
  58.     }

  59.     public void addMonitorRegexp(String regex) {
  60.         monitorRegexps.add(regex);
  61.     }

  62.     /*
  63.      * (non-Javadoc)
  64.      *
  65.      * @see cern.accsoft.steering.jmad.tools.response.ResponseRequest#getCorrectorNames ()
  66.      */
  67.     public List<String> getCorrectorNames() {
  68.         return correctorNames;
  69.     }

  70.     /*
  71.      * (non-Javadoc)
  72.      *
  73.      * @see cern.accsoft.steering.jmad.tools.response.ResponseRequest#getStrengthValues ()
  74.      */
  75.     public List<Double> getStrengthValues() {
  76.         return kickValues;
  77.     }

  78.     /*
  79.      * (non-Javadoc)
  80.      *
  81.      * @see cern.accsoft.steering.jmad.tools.response.ResponseRequest#getMonitorNames ()
  82.      */
  83.     public List<String> getMonitorNames() {
  84.         return monitorNames;
  85.     }

  86.     /*
  87.      * (non-Javadoc)
  88.      *
  89.      * @see cern.accsoft.steering.jmad.tools.response.ResponseRequest#getMonitorPlanes ()
  90.      */
  91.     public List<JMadPlane> getMonitorPlanes() {
  92.         return monitorPlanes;
  93.     }

  94.     /*
  95.      * (non-Javadoc)
  96.      *
  97.      * @see cern.accsoft.steering.jmad.tools.response.ResponseRequest#getCorrectorPlanes ()
  98.      */
  99.     public List<JMadPlane> getCorrectorPlanes() {
  100.         return correctorPlanes;
  101.     }

  102.     @Override
  103.     public List<String> getMonitorRegexps() {
  104.         return this.monitorRegexps;
  105.     }
  106. }