18/11/19: maintenance de la plate-forme - Interruptions du service gricad-gitlab et perturbations possibles tout au long de la journée.

Commit 7981fdbe authored by Cyril Labbe's avatar Cyril Labbe

modified: src/fr/imag/forge/Scidetect/scigenchecker_local/ScigenChecker_Local.java

parent 08b8a945
......@@ -50,6 +50,13 @@ public class ScigenChecker_Local {
private HashMap<String, HashMap<String, Double>> distant = new HashMap<String, HashMap<String, Double>>();
private Boolean savedetaillog = false;
/**
* Read in the config file:
*- places where to find samples of each class
*- default places where to write results.
* @throws FileNotFoundException
* @throws IOException
*/
private void readconfig() throws FileNotFoundException, IOException {
File conf = new File("config.txt");
BufferedReader br = new BufferedReader(new FileReader(conf));
......@@ -74,7 +81,9 @@ public class ScigenChecker_Local {
}
}
/**
* @throws IOException
*/
private void compute() throws IOException {
if (testpath != null) {
DateFormat dateFormat = new SimpleDateFormat("HH:mm dd.MM.yyyy");
......@@ -88,8 +97,12 @@ public class ScigenChecker_Local {
tests = reader.readtests(testpath);
} catch (Exception e) {
e.printStackTrace();
System.out.println("* Something went wrong during:");
System.out.println(" - reading the config file");
System.out.println(" - or reading the samples (dir data)");
System.out.println(" - or txt extraction from pdf");
System.out.println("* Continuing anyway...");
//e.printStackTrace();
}
DistantCalculator dc = new DistantCalculator();
......@@ -103,27 +116,56 @@ public class ScigenChecker_Local {
log.savedetaillog(distant);
}
} else {
System.out.println("can not read path to test folder");
System.out.println("***** Can not read path to the folder:"+testpath);
System.out.println("***** The folder should contains file to check");
}
}
/**
* Parsing of the command line arguments:
* where to find pdf files, where results should be written
* @param args
*/
public void readargs(String[] args) {
for (int i = 0; i < args.length; i += 1) {
// System.out.println(args[i]);
if (args[i].equals("-l")) {
Log.loglocation = args[i + 1];
}
if (args[i].equals("-c")) {
testpath = args[i + 1];
}
if (args[i].equals("-d")) {
savedetaillog = true;
if (args.length > 0) {
for (int i = 0; i < args.length; i += 1) {
// System.out.println(args[i]);
if (args[i].equals("-l")) {
Log.loglocation = args[i + 1];
}
if (args[i].equals("-c")) {
testpath = args[i + 1];
}
if (args[i].equals("-d")) {
savedetaillog = true;
}
if (args[i].equals("-h")) {
printUsage();
}
}
}
} else
{printUsage();}
}
/**
* To print usage (-h)
*/
private static void printUsage() {
System.out.println("***** Scigen & Co Checker \n");
System.out.println("To test all files in a directory <pathToFilesDirToTest>:");
System.out.println("java -jar ScigenChecker_local.jar -l <pathToLogFile> -c <pathToFilesDirToTest> \n");
System.out.println("To print usage:");
System.out.println("java -jar ScigenChecker_local.jar -h \n");
System.out.println("***** \n");
}
/**
* This is the standalone checker. All pdf files in the dir specified after -c are
* checked against classes found in the dir "data". Results are written in the log
* file specified by the -l option. If -d is given a detailled log is produced.
* Example: testing all pdf files in a directory MyConf/PDF/ and having results
* in the MyConf/checklog.txt:
* java -jar ScigenChecker_local.jar -l MyConf/checklog.txt -c MyConf/PDF/
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment