Skip to content

Commit f4515eb

Browse files
committed
- added stopwatch
- fixed SABINE installation validator
1 parent d4b8606 commit f4515eb

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

lib/commons-lang3-3.1.jar

308 KB
Binary file not shown.

src/main/SABINE_Main.java

+23-8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import java.util.Calendar;
2929
import java.util.StringTokenizer;
3030

31+
import org.apache.commons.lang3.time.StopWatch;
32+
3133
import extension.PredictionEvaluator;
3234

3335
import model.ModelGenerator;
@@ -44,6 +46,9 @@ public class SABINE_Main {
4446

4547
boolean silent = false;
4648

49+
boolean stopTime = false;
50+
StopWatch stopwatch = new StopWatch();
51+
4752
boolean dynamic_threshold = true;
4853

4954
public final static String version = "1.2";
@@ -257,18 +262,18 @@ public static void main(String[] args) {
257262
newArgs[i-1] = args[i];
258263
}
259264
PredictionEvaluator.main(newArgs);
265+
266+
// run Installation Validation Mode
267+
} else if (args.length == 1 && (args[0].equals("-check-install") || args[0].equals("--check-install"))) {
268+
SABINE_Main.printCopyright();
269+
SABINE_Validator validator = new SABINE_Validator();
270+
validator.verifyInstallation();
260271

261272
// run Stand-Alone Mode
262273
} else {
263274

264275
SABINE_Main.printCopyright();
265276

266-
if (args.length == 1 && (args[0].equals("-check-install") || args[0].equals("--check-install"))) {
267-
SABINE_Validator validator = new SABINE_Validator();
268-
validator.verifyInstallation();
269-
return;
270-
}
271-
272277
if (args.length == 0 || args.length == 1 && (args[0].equals("-help") || args[0].equals("--help"))) {
273278
usage();
274279
}
@@ -280,6 +285,7 @@ public static void main(String[] args) {
280285
String infile = args[0];
281286
String outfile = infile + ".out";
282287
String verbose_option = "y";
288+
String stopwatch_option = "n";
283289
String base_dir = null;
284290
String train_dir = FBPPredictor.public_trainingset;
285291
String model_dir = FBPPredictor.defaultModelDir;
@@ -296,12 +302,13 @@ public static void main(String[] args) {
296302
if(args[i].equals("-f")) { outfile = args[i+1]; continue; }
297303
if(args[i].equals("-b")) { base_dir = args[i+1]; continue; }
298304
if(args[i].equals("-t")) { train_dir = args[i+1]; continue; }
299-
if(args[i].equals("-v")) { verbose_option = args[i+1]; continue; }
300305
if(args[i].equals("-c")) { model_dir = args[i+1]; continue; }
306+
if(args[i].equals("-v")) { verbose_option = args[i+1]; continue; }
307+
if(args[i].equals("-w")) { stopwatch_option = args[i+1]; continue; }
301308

302309

303310
if( !args[i].equals("-s") && !args[i].equals("-m") && !args[i].equals("-t") && !args[i].equals("-b") &&
304-
!args[i].equals("-o") && !args[i].equals("-f") && !args[i].equals("-c") && !args[i].equals("-v")) {
311+
!args[i].equals("-o") && !args[i].equals("-f") && !args[i].equals("-c") && !args[i].equals("-v") && !args[i].equals("-w")) {
305312

306313
System.out.println("\n Invalid argument: " + args[i]);
307314
usage();
@@ -311,6 +318,10 @@ public static void main(String[] args) {
311318
if (verbose_option.equals("n") || verbose_option.equals("no") || verbose_option.equals("h")) {
312319
caller.silent = true;
313320
}
321+
if (stopwatch_option.equals("y") || stopwatch_option.equals("yes")) {
322+
caller.stopTime = true;
323+
caller.stopwatch.start();
324+
}
314325

315326
if (! train_dir.endsWith("/")) {
316327
train_dir += "/";
@@ -330,6 +341,10 @@ public static void main(String[] args) {
330341

331342
if (! caller.silent) System.out.println("\nOutput file: " + outfile + "\n");
332343
}
344+
345+
if (caller.stopTime) {
346+
System.out.println("Time elapsed: " + caller.stopwatch.toString());
347+
}
333348
}
334349

335350

src/main/SABINE_Validator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void verifyInstallation() {
3737
// run SABINE on generated input file
3838
System.out.print("Checking installation of SABINE...");
3939
predictor.silent = true;
40-
predictor.predictFBP(validatorInputFile, validatorBaseDir, FBPPredictor.public_trainingset, null);
40+
predictor.predictFBP(validatorInputFile, validatorBaseDir, FBPPredictor.public_trainingset, FBPPredictor.defaultModelDir);
4141
System.out.println("done.\n");
4242
// read output
4343
boolean valid = compareOutfiles(validatorOutputFile, validatorBaseDir + "prediction.out");

0 commit comments

Comments
 (0)