src/main/java/org/helm/notation2/parser/StartHELM2Parser.java
public static void main(String[] args) throws ParseException,
      ExceptionState, IOException {
    /* options for the program */
    Options options = new Options();
    /* add helm string */
    options.addOption("inputHELM", true, "HELM1 or HELM2 string in a file");

    /* add output option */
    options.addOption("output", true, "output can be in JSON- or HELM2-format");

    /* add translate option */
    options.addOption("translate", false, "translate HELM1 to HELM2");

    CommandLineParser parameter = new DefaultParser();
    try {

      CommandLine cmd = parameter.parse(options, args);

      String filename = cmd.getOptionValue("inputHELM");

      ParserHELM2 parser = new ParserHELM2();

      FileReader in = new FileReader(filename);

      BufferedReader br = new BufferedReader(in);

      String line;
      String helm;
      try {
        while ((line = br.readLine()) != null) {
          helm = line;
          /* HELM1 notation has to be translated into HELM2 */
          if (cmd.hasOption("translate")) {

            ConverterHELM1ToHELM2 converter = new ConverterHELM1ToHELM2();
            helm = converter.doConvert(helm);
            LOG.info("HELM1 is translated to HELM2");
          }

          parser.parse(helm);

          /* There are two different output options */
          String output = "";
          if (cmd.getOptionValue("output").equals("HELM2")) {
            output = parser.getHELM2Notation().toHELM2();
          } else if (cmd.getOptionValue("output").equals("JSON")) {

            output = parser.getJSON();
          }
          System.out.println(output);
        }
      } finally {
        br.close();
      }
    } catch (NullPointerException e) {
      System.out.println("Please call the program with the following arguments: "
          + "\n"
          + "-inputHELM  <"
          + options.getOption("inputHELM").getDescription()
          + ">\n"
          + "-output <"
          + options.getOption("output").getDescription()
          + ">\n-translate(optional) <"
          + options.getOption("translate").getDescription()
          + ">");
    } catch (ParseException exp) {
      System.out.println("Unexpected exception: " + exp.getMessage());
    }

  }
public static void main(String[] args) throws ParseException,
      ExceptionState, IOException {
    /* options for the program */
    Options options = new Options();
    /* add helm string */
    options.addOption("inputHELM", true, "HELM1 or HELM2 string in a file");

    /* add output option */
    options.addOption("output", true, "output can be in JSON- or HELM2-format");

    /* add translate option */
    options.addOption("translate", false, "translate HELM1 to HELM2");

    CommandLineParser parameter = new DefaultParser();
    try {

      CommandLine cmd = parameter.parse(options, args);

      String filename = cmd.getOptionValue("inputHELM");

      ParserHELM2 parser = new ParserHELM2();

      FileReader in = new FileReader(filename);

      BufferedReader br = new BufferedReader(in);

      String line;
      String helm;
      try {
        while ((line = br.readLine()) != null) {
          helm = line;
          /* HELM1 notation has to be translated into HELM2 */
          if (cmd.hasOption("translate")) {

            ConverterHELM1ToHELM2 converter = new ConverterHELM1ToHELM2();
            helm = converter.doConvert(helm);
            LOG.info("HELM1 is translated to HELM2");
          }

          parser.parse(helm);

          /* There are two different output options */
          String output = "";
          if (cmd.getOptionValue("output").equals("HELM2")) {
            output = parser.getHELM2Notation().toHELM2();
          } else if (cmd.getOptionValue("output").equals("JSON")) {

            output = parser.getJSON();
          }
          System.out.println(output);
        }
      } finally {
        br.close();
      }
    } catch (NullPointerException e) {
      System.out.println("Please call the program with the following arguments: "
          + "\n"
          + "-inputHELM  <"
          + options.getOption("inputHELM").getDescription()
          + ">\n"
          + "-output <"
          + options.getOption("output").getDescription()
          + ">\n-translate(optional) <"
          + options.getOption("translate").getDescription()
          + ">");
    } catch (ParseException exp) {
      System.out.println("Unexpected exception: " + exp.getMessage());
    }

  }
public static void main ( String [ ] args ) throws ParseException , ExceptionState , IOException { /* options for the program */ Options options = new Options ( ) ; /* add helm string */ options . addOption ( "inputHELM" , true , "HELM1 or HELM2 string in a file" ) ; /* add output option */ options . addOption ( "output" , true , "output can be in JSON- or HELM2-format" ) ; /* add translate option */ options . addOption ( "translate" , false , "translate HELM1 to HELM2" ) ; CommandLineParser parameter = new DefaultParser ( ) ; try { CommandLine cmd = parameter . parse ( options , args ) ; String filename = cmd . getOptionValue ( "inputHELM" ) ; ParserHELM2 parser = new ParserHELM2 ( ) ; FileReader in = new FileReader ( filename ) ; BufferedReader br = new BufferedReader ( in ) ; String line ; String helm ; try { while ( ( line = br . readLine ( ) ) != null ) { helm = line ; /* HELM1 notation has to be translated into HELM2 */ if ( cmd . hasOption ( "translate" ) ) { ConverterHELM1ToHELM2 converter = new ConverterHELM1ToHELM2 ( ) ; helm = converter . doConvert ( helm ) ; LOG . info ( "HELM1 is translated to HELM2" ) ; } parser . parse ( helm ) ; /* There are two different output options */ String output = "" ; if ( cmd . getOptionValue ( "output" ) . equals ( "HELM2" ) ) { output = parser . getHELM2Notation ( ) . toHELM2 ( ) ; } else if ( cmd . getOptionValue ( "output" ) . equals ( "JSON" ) ) { output = parser . getJSON ( ) ; } System . out . println ( output ) ; } } finally { br . close ( ) ; } } catch ( NullPointerException e ) { System . out . println ( "Please call the program with the following arguments: " + "\n" + "-inputHELM  <" + options . getOption ( "inputHELM" ) . getDescription ( ) + ">\n" + "-output <" + options . getOption ( "output" ) . getDescription ( ) + ">\n-translate(optional) <" + options . getOption ( "translate" ) . getDescription ( ) + ">" ) ; } catch ( ParseException exp ) { System . out . println ( "Unexpected exception: " + exp . getMessage ( ) ) ; } }
main method to run a single HELM2Parser from the command line

@param args console parameters
@throws ParseException if parsing the command lines produces an error
@throws ExceptionState an exception in a state during parsing occurs, helm notation is not valid
@throws IOException if file can not be read
main method to run a single HELM2Parser from the command line