// Copyright 2000-2003, FreeHEP.
package hep.graphics.heprep.test;

import java.awt.Color;
import java.io.IOException;
import java.io.FileWriter;
import java.util.Stack;

import hep.graphics.heprep.*;
import hep.graphics.heprep.ref.*;
import hep.graphics.heprep.xml.*;
import hep.graphics.heprep.util.*;

/**
 *
 * @author M.Donszelmann
 *
 * @version $Id: Count.java,v 1.4 2003/12/02 23:46:44 duns Exp $
 */

public class Count {
    public static final String cvsId = "$Id: Count.java,v 1.4 2003/12/02 23:46:44 duns Exp $";

    public void run(String iname) throws Exception {
        long t0, t1, t2;
        t0 = System.currentTimeMillis();

        HepRep heprep = HepRepIO.readHepRep(iname);
        t1 = System.currentTimeMillis();
        System.out.println("Read file in "+(t1-t0)+" ms.");

        ((DefaultHepRep)heprep).display();
        t2 = System.currentTimeMillis();
        System.out.println("Counted heprep in "+(t2-t1)+" ms.");
    }

    public static void main(String[] args) {
        if (args.length != 1) {
            System.out.println("Usage: Count filename");
            System.exit(1);
        }

        try {
            new Count().run(args[0]);
        } catch (Exception e) {
	        System.out.println(e);
	        e.printStackTrace();
        }
    }


}
