AbstractJMadExecutable.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.kernel;

  23. import java.io.File;

  24. import cern.accsoft.steering.jmad.domain.result.ResultType;

  25. /**
  26.  * Contains common functions of commands/tasks that can be executed in MadX.
  27.  *
  28.  * @author Kajetan Fuchsberger (kajetan.fuchsberger at cern.ch)
  29.  */
  30. public abstract class AbstractJMadExecutable implements JMadExecutable {

  31.     /** The output-file, which can be used in the compose method. */
  32.     private File outputFile = null;

  33.     /**
  34.      * The {@link ResultType} which is produced by this command. This value is then used by the kernel, in order to
  35.      * determine which parser to use to determine the type of parser to use for parsing the madx-output.
  36.      * <p>
  37.      * Shall be overridden by subclass, if it provides a result.
  38.      *
  39.      * @return the result type for this executable
  40.      */
  41.     @Override
  42.     public ResultType getResultType() {
  43.         return ResultType.NO_RESULT;
  44.     }

  45.     /**
  46.      * set the output-file. This should be only done by the {@link JMadKernel} since the kernel is the only one who
  47.      * knows where the output is needed to parse it afterwards.
  48.      *
  49.      * @param outputFile the new output file to set
  50.      */
  51.     public final void setOutputFile(File outputFile) {
  52.         this.outputFile = outputFile;
  53.     }

  54.     /**
  55.      * the actual output-file.
  56.      *
  57.      * @return the file to which the output shall be written
  58.      */
  59.     public final File getOutputFile() {
  60.         return outputFile;
  61.     }

  62. }