package jcircus.benchmarking; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.StringTokenizer; import java.util.Vector; public class BenchCollector { private Vector specpathsin = new Vector (); private Vector specpathsout = new Vector (); private Vector specnames = new Vector (); private HashMap main2spec = new HashMap (); private int numOfSpecs = 0; public int getNumberOfSpecs () { return numOfSpecs; } public HashMap getCreateMain () { return main2spec; } public Vector getSpecNames () { return specnames; } public Vector getPathsIn () { return this.specpathsin; } public Vector getPathsOut () { return this.specpathsout; } public BenchCollector () { storeInfoFromBenchsFile (); } private String [] tokenize (String str) { StringTokenizer st = new StringTokenizer (str); int ntokens = st.countTokens(); if (ntokens != 2) { try { throw new Exception ("Wrong number of words. Should try "); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit (0); } } String [] tokens = new String [ntokens]; int counter = 0; while (st.hasMoreTokens()) { tokens [counter] = st.nextToken(); counter++; } return tokens; } public void storeInfoFromBenchsFile () { //String benchspath = "C:\\Users\\sam\\Softwares\\workspaceGalileo\\circus\\src\\jcircus\\benchmarking\\benchs.txt"; String benchspath = "/home/samuel/Softwares/CRefineProject/circus/src/jcircus/benchmarking/benchs.txt"; System.out.println (benchspath); try { BufferedReader br = new BufferedReader (new FileReader (benchspath)); int numberOfSpecs = Integer.parseInt(br.readLine()); this.numOfSpecs = numberOfSpecs; int counter = 0; while (counter < numberOfSpecs) { String [] tokens = tokenize (br.readLine()); assert (tokens.length == 2); specnames.addElement(tokens [0]); main2spec.put(tokens [0], tokens [1]); counter++; } for (int i = 0; i < specnames.size(); i++) { //specpathsin.addElement ("C:\\Users\\sam\\Softwares\\workspaceGalileo\\circus\\src\\jcircus\\benchmarking\\benchinputs\\" + specnames.elementAt(i)); //specpathsout.addElement ("C:\\Users\\sam\\Softwares\\workspaceGalileo\\BenchOutputs\\" + specnames.elementAt(i)); specpathsin.addElement ("/home/samuel/Softwares/CRefineProject/circus/src/jcircus/benchmarking/benchinputs/" + specnames.elementAt(i)); specpathsout.addElement ("/home/samuel/Softwares/workspaceJuno/BenchOutputs/" + specnames.elementAt(i)); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException io) { io.printStackTrace(); } } public void printPaths () { for (int i = 0; i < this.specnames.size(); i++) { System.out.println (this.specpathsin.elementAt(i)); } } public static void main (String args []) { BenchCollector b = new BenchCollector (); b.printPaths(); } }