fully working adapter and time logging for the learner
[tt2015.git] / a4 / tcp / tester / learner / Main.java
index fa9c649..a3b167a 100644 (file)
@@ -91,8 +91,11 @@ public class Main {
        private static String stateCountStr;
        private static String methodStr;
        private static String testStr;
+       private static long startTime;
        
        public static void main(String [] args) throws IOException {
+               startTime = System.currentTimeMillis();
+               
                if (args.length != 3) {
                        System.out.println("error: missing commandline arguments!");
                        return;
@@ -326,9 +329,10 @@ public class Main {
         * @throws IOException
         */
        public static void produceOutput(String fileName, MealyMachine<?,String,?,String> model, Alphabet<String> alphabet, boolean verboseError) throws FileNotFoundException, IOException {
-               GraphDOT.write(model, alphabet, new PrintWriter(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + ".dot"));
+               long time = (System.currentTimeMillis()-startTime)/1000L;
+               GraphDOT.write(model, alphabet, new PrintWriter(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + "." + time + "sec" + ".dot"));
                try {
-                       DOT.runDOT(new File(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + ".dot"), "pdf", new File(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + ".pdf"));
+                       DOT.runDOT(new File(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + "." + time + "sec" + ".dot"), "pdf", new File(fileName + "." + stateCountStr + "." + methodStr + "." + testStr + "." + time + "sec" + ".pdf"));
                } catch (Exception e) {
                        if (verboseError) {
                                System.err.println("Warning: Install graphviz to convert dot-files to PDF");