PtcCreateLayoutCommand.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. /**
  23.  *
  24.  */
  25. package cern.accsoft.steering.jmad.kernel.cmd.ptc;

  26. import java.util.ArrayList;
  27. import java.util.List;

  28. import cern.accsoft.steering.jmad.kernel.cmd.AbstractCommand;
  29. import cern.accsoft.steering.jmad.kernel.cmd.param.GenericParameter;
  30. import cern.accsoft.steering.jmad.kernel.cmd.param.Parameter;

  31. /**
  32.  * This class represents the madx-command to transfer the madx data to ptc: <a
  33.  * href="http://mad.web.cern.ch/mad/ptc_general/ptc_general.html">PTC_CREATE_LAYOUT</a>
  34.  *
  35.  * @author Kajetan Fuchsberger (kajetan.fuchsberger at cern.ch)
  36.  */
  37. public class PtcCreateLayoutCommand extends AbstractCommand {

  38.     /** the name of the command */
  39.     private static final String CMD_NAME = "ptc_create_layout";

  40.     /*
  41.      * the possible parameters
  42.      */
  43.     private Boolean time = null;
  44.     private Integer model = null;
  45.     private Integer method = null;
  46.     private Integer nst = null;
  47.     private Boolean exact = null;
  48.     private Double offsetDeltaP = null;
  49.     private Boolean errorsOut = null;
  50.     private Boolean errorsIn = null;
  51.     private String magnetName = null;
  52.     private Boolean resplit = null;
  53.     private Double thin = null;
  54.     private Double xbend = null;
  55.     private Boolean even = null;

  56.     /**
  57.      * the default constructor, which sets no values
  58.      */
  59.     public PtcCreateLayoutCommand() {
  60.         super();
  61.     }

  62.     /**
  63.      * the constructor, which just sets the time-option
  64.      *
  65.      * @param time determines how the time coordinate is treated by ptc. (see <a
  66.      *            href="http://mad.web.cern.ch/mad/ptc_general/ptc_general.html">PTC_CREATE_LAYOUT</a>)
  67.      */
  68.     public PtcCreateLayoutCommand(Boolean time) {
  69.         super();
  70.         this.time = time;
  71.     }

  72.     @Override
  73.     public String getName() {
  74.         return CMD_NAME;
  75.     }

  76.     @Override
  77.     public List<Parameter> getParameters() {
  78.         List<Parameter> parameters = new ArrayList<>();

  79.         /*
  80.          * this is kind of special boolean parameter: it does not follow the convention, that it is omitted, when it is
  81.          * meant to be false! It has to be set explicitly to false. We therefore use a string-parameter.
  82.          */
  83.         if (time != null) {
  84.             parameters.add(new GenericParameter<>("time", time.toString()));
  85.         }

  86.         parameters.add(new GenericParameter<>("model", model));
  87.         parameters.add(new GenericParameter<>("method", method));
  88.         parameters.add(new GenericParameter<>("nst", nst));
  89.         parameters.add(new GenericParameter<>("exact", exact));
  90.         parameters.add(new GenericParameter<>("offset_deltap", offsetDeltaP));
  91.         parameters.add(new GenericParameter<>("errors_in", errorsIn));
  92.         parameters.add(new GenericParameter<>("errors_out", errorsOut));
  93.         parameters.add(new GenericParameter<>("magnet_name", magnetName));
  94.         parameters.add(new GenericParameter<>("resplit", resplit));
  95.         parameters.add(new GenericParameter<>("thin", thin));
  96.         parameters.add(new GenericParameter<>("xbend", xbend));
  97.         /* same as for "time": default is true! */
  98.         if (even != null) {
  99.             parameters.add(new GenericParameter<>("even", even.toString()));
  100.         }
  101.         return parameters;
  102.     }

  103.     public Boolean getTime() {
  104.         return time;
  105.     }

  106.     public void setTime(Boolean time) {
  107.         this.time = time;
  108.     }

  109.     public Integer getModel() {
  110.         return model;
  111.     }

  112.     public void setModel(Integer model) {
  113.         this.model = model;
  114.     }

  115.     public Integer getMethod() {
  116.         return method;
  117.     }

  118.     public void setMethod(Integer method) {
  119.         this.method = method;
  120.     }

  121.     public Integer getNst() {
  122.         return nst;
  123.     }

  124.     public void setNst(Integer nst) {
  125.         this.nst = nst;
  126.     }

  127.     public Boolean getExact() {
  128.         return exact;
  129.     }

  130.     public void setExact(Boolean exact) {
  131.         this.exact = exact;
  132.     }

  133.     public Double getOffsetDeltaP() {
  134.         return offsetDeltaP;
  135.     }

  136.     public void setOffsetDeltaP(Double offsetDeltaP) {
  137.         this.offsetDeltaP = offsetDeltaP;
  138.     }

  139.     public Boolean getErrorsOut() {
  140.         return errorsOut;
  141.     }

  142.     public void setErrorsOut(Boolean errorsOut) {
  143.         this.errorsOut = errorsOut;
  144.     }

  145.     public Boolean getErrorsIn() {
  146.         return errorsIn;
  147.     }

  148.     public void setErrorsIn(Boolean errorsIn) {
  149.         this.errorsIn = errorsIn;
  150.     }

  151.     public String getMagnetName() {
  152.         return magnetName;
  153.     }

  154.     public void setMagnetName(String magnetName) {
  155.         this.magnetName = magnetName;
  156.     }

  157.     public Boolean getResplit() {
  158.         return resplit;
  159.     }

  160.     public void setResplit(Boolean resplit) {
  161.         this.resplit = resplit;
  162.     }

  163.     public Double getThin() {
  164.         return thin;
  165.     }

  166.     public void setThin(Double thin) {
  167.         this.thin = thin;
  168.     }

  169.     public Double getXbend() {
  170.         return xbend;
  171.     }

  172.     public void setXbend(Double xbend) {
  173.         this.xbend = xbend;
  174.     }

  175.     public Boolean getEven() {
  176.         return even;
  177.     }

  178.     public void setEven(Boolean even) {
  179.         this.even = even;
  180.     }
  181. }