Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cyril Labbe
scidetect
Commits
7981fdbe
Commit
7981fdbe
authored
Mar 03, 2015
by
Cyril Labbe
Browse files
modified: src/fr/imag/forge/Scidetect/scigenchecker_local/ScigenChecker_Local.java
parent
08b8a945
Changes
1
Show whitespace changes
Inline
Side-by-side
src/fr/imag/forge/Scidetect/scigenchecker_local/ScigenChecker_Local.java
View file @
7981fdbe
...
...
@@ -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,12 +116,18 @@ 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
)
{
if
(
args
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
args
.
length
;
i
+=
1
)
{
// System.out.println(args[i]);
if
(
args
[
i
].
equals
(
"-l"
))
{
...
...
@@ -120,10 +139,33 @@ public class ScigenChecker_Local {
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment