Exemple #1
0
  public static void main(String[] args) {

    if (args.length != 1) {
      System.out.println("Usage: java Msp <filename>");
      System.exit(2);
    }
    Graph g = new Graph();
    loadFile(g, args[0]);

    // Calculate locations of nodes
    g.prepareNodes();
    // Perform kruskal algorithm
    g.kruskal();

    // Show results in JFrame
    MainWindow f = new MainWindow(g);
    f.setSize(800, 600);
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Exemple #2
0
  public static void main(String[] argv) {
    MainWindow win;

    DbgOutput.toStdout();
    win = new MainWindow();
    // process cmd line arguments
    int i;
    for (i = 0; i < argv.length; i++) {
      if (argv[i].equals("-D")) {
        i++;
        // try to interpret the next argument as the debug level
        int dbgLvl = 1; // basic debug level
        if (i >= argv.length) {
          // no more arguments, we stick with debug level 1
          break;
        }
        try {
          dbgLvl = Integer.parseInt(argv[i]);
        } catch (NumberFormatException e) {
          dbgLvl = 1; // didn't work, this is probably a filename
          win.open(argv[i]);
        }
        DbgOutput.setDbgLevel(dbgLvl);
        Libgist.setDbgLevel(dbgLvl);

      } else if (argv[i].equals("-h")) {
        // print help message and exit
        System.out.println("Usage: amdb [-D <dbglevel> | -h] [index]");
        System.exit(0);

      } else {
        // this is a name of an index, open it
        // System.out.println("open " + argv[i]);
        win.open(argv[i]);
      }
    }
    win.setTitle("amdb");
    win.setSize(800, 600);
    win.setLocation(50, 50);
    win.setVisible(true);
  }