Package net.sourceforge.align.ui.console.command.exception

Examples of net.sourceforge.align.ui.console.command.exception.WrongArgumentCountException


        throw new MissingParameterException("class");
      }
      List<Alignment> alignmentList = new ArrayList<Alignment>();
      if (cls.equals("al")) {
        if (commandLine.getArgs().length < 1) {
          throw new WrongArgumentCountException("1, 2, 3, ...", commandLine.getArgs().length);
        }
        for (String fileName : commandLine.getArgs()) {
          Reader reader = getReader(getFileInputStream(fileName));
          Parser parser = new AlParser(reader);
          List<Alignment> currentAlignmentList = parser.parse();
          alignmentList.addAll(currentAlignmentList);
          reader.close();
        }
      } else if (cls.equals("txt")) {
        if ((commandLine.getArgs().length % 2) != 0) {
          throw new WrongArgumentCountException("2, 4, 6, ...", commandLine.getArgs().length);
        }
        for (int i = 0; i < commandLine.getArgs().length; i += 2) {
          String sourceFileName = commandLine.getArgs()[i];
          String targetFileName = commandLine.getArgs()[i + 1];
          Reader sourceReader = getReader(getFileInputStream(sourceFileName));
          Reader targetReader = getReader(getFileInputStream(targetFileName));
          Parser parser = new PlaintextParser(sourceReader, targetReader);
          List<Alignment> currentAlignmentList = parser.parse();
          alignmentList.addAll(currentAlignmentList);
          sourceReader.close();
          targetReader.close();
        }
      } else if (cls.equals("tmx")) {
        if (commandLine.getArgs().length < 1) {
          throw new WrongArgumentCountException("1, 2, 3, ...", commandLine.getArgs().length);
        }
        String languages = commandLine.getOptionValue('l');
        String[] languageArray;
        if (languages == null) {
          languageArray = new String[0];
View Full Code Here


    if (cls.equals("al")) {
      Writer writer = getSingleWriter(commandLine);
      formatter = new AlFormatter(writer);
    } else if (cls.equals("txt")) {
      if (commandLine.getArgs().length != 2) {
        throw new WrongArgumentCountException("2", commandLine.getArgs().length);
      }
      String sourceFileName = commandLine.getArgs()[0];
      String targetFileName = commandLine.getArgs()[1];
      Writer sourceWriter = getWriter(getFileOutputStream(sourceFileName));
      Writer targetWriter = getWriter(getFileOutputStream(targetFileName));
View Full Code Here

      writer = getOut();
    } else if (commandLine.getArgs().length == 1) {
      String fileName = commandLine.getArgs()[0];
      writer = getWriter(getFileOutputStream(fileName));
    } else {
      throw new WrongArgumentCountException("0, 1", commandLine.getArgs().length);
    }
    return writer;
  }
View Full Code Here

    options.addOption("w", "width", true, "Differences output width (optional, default " + PresentationFormatter.DEFAULT_WIDTH + ").");
  }
 
  public void run(CommandLine commandLine) {
    if (commandLine.getArgs().length != 2) {
      throw new WrongArgumentCountException("2", commandLine.getArgs().length);
    }
   
    String leftFileName = commandLine.getArgs()[0];
    String rightFileName = commandLine.getArgs()[1];
    Reader leftReader = getReader(getFileInputStream(leftFileName));
View Full Code Here

TOP

Related Classes of net.sourceforge.align.ui.console.command.exception.WrongArgumentCountException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.