Пример #1
0
  public static void main(String[] args) {

    Main m = new Main();

    if (args.length > 0) {
      if (args[0].toLowerCase().contains("v")) {
        m.showVersion();
        System.exit(0);
      }

      m.showUsage();

      System.exit(0);
    }

    File curDir = new File(".");
    File[] vectors = curDir.listFiles(m);

    if (vectors.length != 3) {
      m.showUsage();
      System.exit(1);
    }

    for (File file : vectors) {
      VectorParser parser = new VectorParser();
      String fileName = file.getName().toLowerCase();
      if (fileName.endsWith("x.txt")) {
        parser.setVectorType(VectorParser.VectorType.X);
      } else if (fileName.endsWith("y.txt")) {
        parser.setVectorType(VectorParser.VectorType.Y);
      } else if (fileName.endsWith("z.txt")) {
        parser.setVectorType(VectorParser.VectorType.Z);
      }
      try {
        parser.parse(file);
      } catch (IOException ex) {
        m.showError(ex);
        System.exit(1);
      }
    }

    try {
      W.getInstace().write();
    } catch (IOException ex) {
      m.showError(ex);
      System.exit(1);
    }
  }