Ejemplo n.º 1
0
 /*.................................................................................................................*/
 public Object doCommand(String commandName, String arguments, CommandChecker checker) {
   if (checker.compare(
       this.getClass(),
       "Sets the running file path",
       "[file path]",
       commandName,
       "setRunningFilePath")) {
     runningFilePath = parser.getFirstToken(arguments);
   } else if (checker.compare(
       this.getClass(),
       "Sets the output file paths",
       "[file paths]",
       commandName,
       "setOutputFilePaths")) {
     int num = parser.getNumberOfTokens(arguments);
     outputFilePaths = new String[num];
     if (num > 0) outputFilePaths[0] = parser.getFirstToken();
     for (int i = 1; i < num; i++) outputFilePaths[i] = parser.getNextToken();
   }
   return null;
 }
  public void readTabbedTranslationFile(String translationList) {
    Parser parser = new Parser();
    parser.setString(translationList);
    Parser subParser = new Parser();
    String line = parser.getRawNextDarkLine();

    numCodes = 0;
    while (!StringUtil.blank(line)) {
      numCodes++;
      line = parser.getRawNextDarkLine();
    }
    if (numCodes == 0) {
      MesquiteMessage.discreetNotifyUser("File is empty.");
      return;
    }

    initializeArrays(numCodes);

    int count = -1;
    parser.setPosition(0);
    subParser.setPunctuationString("\t");
    line = parser.getRawNextDarkLine();
    String token = "";

    while (!StringUtil.blank(line)) {
      count++;
      subParser.setString(line);
      token = subParser.getFirstToken();
      if (StringUtil.notEmpty(token)) {
        originalSampleCodes[count] = token;
        token = subParser.getNextToken();
        if (StringUtil.notEmpty(token)) {
          translatedSampleCodes[count] = token;
        }
      }
      line = parser.getRawNextDarkLine();
    }
  }