// 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.xml.*;
import hep.graphics.heprep.util.*;

/**
 *
 * @author M.Donszelmann
 *
 * @version $Id: CompareTest.java,v 1.1 2003/12/09 21:07:40 duns Exp $
 */

public class CompareTest {
    public static final String cvsId = "$Id: CompareTest.java,v 1.1 2003/12/09 21:07:40 duns Exp $";

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

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

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

        if (heprep1.equals(heprep2)) {
            System.out.println("HepReps are equal");
        } else {
            System.out.println("HepReps are different");
        }
        t3 = System.currentTimeMillis();
        System.out.println("Comparing files used "+(t3-t2)+" ms.");
    }

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

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