Main.java

40 lines | 1.217 kB Blame History Raw Download
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.inf.prosoft.approachescomparison.adapter;

import br.ufrgs.inf.prosoft.memoizeit.MemoizeIt;
import br.ufrgs.inf.prosoft.memoizeit.Method;
import br.ufrgs.inf.prosoft.memoizeit.graph.Graph;
import br.ufrgs.inf.prosoft.trace.Trace;
import java.util.List;

/**
 *
 * @author romulo
 */
public class Main {

    public static void main(String[] args) {
        String tracePath = null;
        String callGraphPath = null;
        if (args.length < 2) {
            System.err.println("<TracePath> <CallGraphPath>");
            System.exit(1);
        } else {
            tracePath = args[0];
            callGraphPath = args[1];
        }
        Graph<String> graph = CallGraphReader.parseFile(callGraphPath);
        List<Trace> traces = TraceReader.parseFile(tracePath);
        List<Method> methods = TraceReader.groupByMethods(traces);
        MemoizeIt memoizeIt = new MemoizeIt();
        memoizeIt.setCallGraph(graph);
        memoizeIt.setMethods(methods);
        memoizeIt.run();
        methods.forEach(System.out::println);
    }
}