Subversion Repositories display

Rev

Rev 179 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2007 Steve Ratcliffe
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *
 * Author: Steve Ratcliffe
 * Create date: Dec 16, 2007
 */

package test.display;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 * Standalone program to print both the NET and NOD files.  As these files
 * have pointers to each other it will be advantageous to run both at
 * once so that the links can be displayed.
 *
 * Can produce a massive file, so may take some time to write.
 *
 * @author Steve Ratcliffe
 */

public class NNDisplay {

        public static void main(String[] args) throws FileNotFoundException {
                if (args.length < 1) {
                        System.err.println("Usage: netdisplay <filename>");
                        System.exit(1);
                }

                String name = args[0];

                NetDisplay net = new NetDisplay();
                NodDisplay nod = new NodDisplay();

                long start = System.currentTimeMillis();
                System.err.print("Starting net... ");
                PrintStream outps = new PrintStream(new BufferedOutputStream(new FileOutputStream("net.out")));
                net.setOutStream(outps);
                net.display(name, "NET");

                long end = System.currentTimeMillis();
                System.err.printf("took %.1fs\n", (end - start)/1000.0);

                System.err.print("Starting nod... ");
                start = System.currentTimeMillis();
                outps = new PrintStream(new BufferedOutputStream(new FileOutputStream("nod.out")));

                nod.setOutStream(outps);
                nod.setNet(net);
                nod.display(name, "NOD");
               
                end = System.currentTimeMillis();
                System.err.printf("took %.1fs\n", (end - start)/1000.0);
        }
}