Update command parser 2.0
This commit is contained in:
parent
edff961ad3
commit
491f5c7753
@ -1,4 +1,10 @@
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import commands.Analyse;
|
||||||
|
import commands.Build;
|
||||||
|
import commands.Evaluate;
|
||||||
|
import commands.Generate;
|
||||||
|
import commands.Produce;
|
||||||
import commands.Read;
|
import commands.Read;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
@ -17,17 +23,32 @@ import picocli.CommandLine.*;
|
|||||||
" \\/ \\/ \\/ \\/ \n" +
|
" \\/ \\/ \\/ \\/ \n" +
|
||||||
" \n" ,
|
" \n" ,
|
||||||
footer = "\n\n ---- Provided by IUT Info Nice S3T-G4 ---- \n",
|
footer = "\n\n ---- Provided by IUT Info Nice S3T-G4 ---- \n",
|
||||||
description = "description"
|
description = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Exec implements Callable <Void> {
|
public class Exec implements Callable <Void> {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
Model.CommandSpec spec; // Permet de tager la commande pour l'appeler dans la surcharge de call()
|
||||||
|
|
||||||
|
// Système d'options et paramètres de commande de l'API
|
||||||
|
|
||||||
|
@Option(names= {"-v","--version"}, versionHelp = true, arity = "0", order = 1, description = "Displays version info")
|
||||||
|
boolean version; // Paramètre associé (versionHelp génere l'aide de version automatiquement)
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
||||||
|
// Système de subcommand semblable à celui de git permettant d'appeler les classes relatives
|
||||||
|
|
||||||
CommandLine cmd = new CommandLine (new Exec())
|
CommandLine cmd = new CommandLine (new Exec())
|
||||||
.addSubcommand("-r", new Read(System.out))
|
.addSubcommand("-r", new Read(System.out)) // nom commande, objet commande
|
||||||
.addSubcommand("help", new HelpCommand());
|
.addSubcommand("-b", new Build(System.out))
|
||||||
|
.addSubcommand("-g", new Generate(System.out))
|
||||||
|
.addSubcommand("-p", new Produce(System.out))
|
||||||
|
.addSubcommand("-a", new Analyse(System.out))
|
||||||
|
.addSubcommand("-e", new Evaluate(System.out))
|
||||||
|
.addSubcommand("help", new HelpCommand()); // Aide générée automatiquement par l'API
|
||||||
|
|
||||||
cmd.execute(args);
|
cmd.execute(args);
|
||||||
|
|
||||||
@ -36,6 +57,8 @@ public class Exec implements Callable <Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
|
||||||
|
CommandLine.usage(this.spec, System.out); // Retourne l'aide générée par l'API s'il n'y a pas d'arguments
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
//import picocli.CommandLine;
|
//import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "analyse",
|
name = "-a",
|
||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = " -- Nicely Generated and Corrected Copies -- \n",
|
header = "Analyse command - Questions' answers identification",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "",
|
||||||
description = "description"
|
description = "\nAnalyzes scanned copies (pdf files) provided to identify student and questions' answers\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Analyse implements Callable <Void> {
|
public class Analyse implements Callable <Void> {
|
||||||
|
|
||||||
@Option(names= {"-a","--analyse"}, arity = "0", order = 1, description = "analyse mode")
|
@Spec
|
||||||
boolean analyse;
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
@ -28,24 +33,33 @@ public class Analyse implements Callable <Void> {
|
|||||||
int vb_level;
|
int vb_level;
|
||||||
|
|
||||||
@Option(names= {"-d"}, arity = "1", order = 4, defaultValue = "copies", description ="directory")
|
@Option(names= {"-d"}, arity = "1", order = 4, defaultValue = "copies", description ="directory")
|
||||||
String directory;
|
String directory_name;
|
||||||
|
|
||||||
@Parameters(arity = "0..1", defaultValue = "./source.txt", description ="source path")
|
@Parameters(arity = "0..1", defaultValue = "./source.txt", description ="source path")
|
||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Analyse(PrintStream out) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
if(analyse) {
|
|
||||||
System.out.println("Analyse mode activated ...");
|
|
||||||
System.out.println("Update : "+step);
|
|
||||||
System.out.println("Verbose : "+vb_level);
|
|
||||||
System.out.println("Directory : "+directory);
|
|
||||||
System.out.println("Source : "+source_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(help){
|
||||||
|
CommandLine.usage(this.spec, System.out);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("\nAnalyse mode activated ...\n");
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
|
"Verbose : "+vb_level +"\n"+
|
||||||
|
"Directory : "+directory_name +"\n"+
|
||||||
|
"Source : "+source_path +"\n");
|
||||||
|
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
//import picocli.CommandLine;
|
//import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "ngcc",
|
name = "-b",
|
||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = " -- Nicely Generated and Corrected Copies -- \n",
|
header = "Build command - Create standard test copy",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "",
|
||||||
description = "description"
|
description = "\nCreate a standard test copy accepted by the application.\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Build implements Callable <Void> {
|
public class Build implements Callable <Void> {
|
||||||
|
|
||||||
@Option(names= {"-b","--build"}, arity = "0", order = 1, description = "build mode")
|
@Spec
|
||||||
boolean build;
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
@ -34,17 +39,25 @@ public class Build implements Callable <Void> {
|
|||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
|
public Build(PrintStream out) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
if(build) {
|
|
||||||
System.out.println("Build mode activated ...");
|
|
||||||
System.out.println("Update : "+step);
|
|
||||||
System.out.println("Verbose : "+vb_level);
|
|
||||||
System.out.println("Answer : "+answer_name);
|
|
||||||
System.out.println("Source : "+source_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(help){
|
||||||
|
CommandLine.usage(this.spec, System.out);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
System.out.println("\nBuild mode activated ...\n");
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
|
"Verbose : "+vb_level +"\n"+
|
||||||
|
"Directory : "+answer_name +"\n"+
|
||||||
|
"Source : "+source_path +"\n");
|
||||||
|
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
//import picocli.CommandLine;
|
//import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "evaluate",
|
name = "-e",
|
||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = " -- Nicely Generated and Corrected Copies -- \n",
|
header = "Evaluate command - Mark evaluation ",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "",
|
||||||
description = "description"
|
description = "\nEvaluate each copies' mark based on the analysis performed previously."
|
||||||
|
+ " Can be executed several times to take changes into account.\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Evaluate implements Callable <Void> {
|
public class Evaluate implements Callable <Void> {
|
||||||
|
|
||||||
@Option(names= {"-e","--evaluate"}, arity = "0", order = 1, description = "evaluate mode")
|
@Spec
|
||||||
boolean evaluate;
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
@ -34,27 +40,29 @@ public class Evaluate implements Callable <Void> {
|
|||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
public boolean isCsv(String file) {
|
// public boolean isCsv(String file) {
|
||||||
return file.endsWith(".csv");
|
// return file.endsWith(".csv");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public Evaluate(PrintStream out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
if(evaluate) {
|
|
||||||
System.out.println("Generate mode activated ...");
|
|
||||||
System.out.println("Update : "+step);
|
|
||||||
System.out.println("Verbose : "+vb_level);
|
|
||||||
|
|
||||||
if (isCsv(result_name)) {
|
if(help){
|
||||||
System.out.println("Result : "+result_name);
|
CommandLine.usage(this.spec, System.out);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("The specified name for the result file is invalid");
|
|
||||||
//System.out.println("Result : "+result_name+".csv");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Source : "+source_path);
|
System.out.println("\nEvaluate mode activated ...\n");
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
|
"Verbose : "+vb_level +"\n"+
|
||||||
|
"Result : "+result_name +"\n"+
|
||||||
|
"Source : "+source_path +"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
//import picocli.CommandLine;
|
//import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "generate",
|
name = "-g",
|
||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = " -- Nicely Generated and Corrected Copies -- \n",
|
header = "Generate command - Subject and answer generation",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "",
|
||||||
description = "description"
|
description = "\nSubject generation and associated answer with the source document.\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Generate implements Callable <Void> {
|
public class Generate implements Callable <Void> {
|
||||||
|
|
||||||
@Option(names= {"-g","--generate"}, arity = "0", order = 1, description = "generate mode")
|
@Spec
|
||||||
boolean generate;
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
@ -37,28 +42,29 @@ public class Generate implements Callable <Void> {
|
|||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
public boolean isPdf(String file) {
|
// public boolean isPdf(String file) {
|
||||||
return file.endsWith(".pdf");
|
// return file.endsWith(".pdf");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Generate(PrintStream out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
if(generate) {
|
|
||||||
System.out.println("Generate mode activated ...");
|
|
||||||
System.out.println("Update : "+step);
|
|
||||||
System.out.println("Verbose : "+vb_level);
|
|
||||||
System.out.println("Topic : "+topic_name); //isPdf ...
|
|
||||||
|
|
||||||
if (isPdf(answer_name)) {
|
if(help){
|
||||||
System.out.println("Answer : "+answer_name);
|
CommandLine.usage(this.spec, System.out);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("The specified name for the result file is invalid");
|
|
||||||
//System.out.println("Answer : "+answer_name+".pdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Source : "+source_path);
|
System.out.println("\nGenerate mode activated ...\n");
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
|
"Verbose : "+vb_level +"\n"+
|
||||||
|
"Topic : "+topic_name +"\n"+
|
||||||
|
"Answer : "+answer_name +"\n"+
|
||||||
|
"Source : "+source_path +"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
package commands;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
//import picocli.CommandLine;
|
|
||||||
import picocli.CommandLine.*;
|
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
|
||||||
name = "Help command",
|
|
||||||
version = "Version 1.0",
|
|
||||||
sortOptions = false,
|
|
||||||
usageHelpWidth = 60,
|
|
||||||
header = " ---- Nicely Generated and Corrected Copies ---- \n" +
|
|
||||||
" _______ _________________ ________ \n" +
|
|
||||||
" \\ \\ / _____/\\_ ___ \\\\_ ___ \\ \n" +
|
|
||||||
" / | \\/ \\ ___/ \\ \\// \\ \\/ \n" +
|
|
||||||
" / | \\ \\_ \\ \\ \\___\\ \\___ \n" +
|
|
||||||
" \\____|__ /\\______ /\\______ /\\______ / \n" +
|
|
||||||
" \\/ \\/ \\/ \\/ \n" +
|
|
||||||
" \n" ,
|
|
||||||
footer = "\n ---- Provided by IUT Info Nice S3T-G4 ---- ",
|
|
||||||
description = "description"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
public class Help implements Callable <Void> {
|
|
||||||
|
|
||||||
@Option(names= {"help", "--help"}, required = true, arity = "0", order = 1, description = "help")
|
|
||||||
boolean help;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void call() throws Exception {
|
|
||||||
if(help) {
|
|
||||||
System.out.println(
|
|
||||||
"\nCommands List : \n\n" +
|
|
||||||
"-b, --build build mode \n" +
|
|
||||||
"-r, --read read mode \n" +
|
|
||||||
"-g, --generate generate mode \n" +
|
|
||||||
"-p, --produce produce mode \n" +
|
|
||||||
"-a, --analyse analyse mode \n" +
|
|
||||||
"-e, --evaluate evaluate mode \n" );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +1,30 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
import picocli.CommandLine;
|
||||||
//import picocli.CommandLine;
|
//import picocli.CommandLine;
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "produce",
|
name = "-p",
|
||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = " -- Nicely Generated and Corrected Copies -- \n",
|
header = "Produce command - Correction subject generation",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "\nProduce correction subject associated to the source file.\n",
|
||||||
description = "description"
|
description = "description"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
public class Produce implements Callable <Void> {
|
public class Produce implements Callable <Void> {
|
||||||
|
|
||||||
@Option(names= {"-p","--produce"}, arity = "0", order = 1, description = "produce mode")
|
@Spec
|
||||||
boolean produce;
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
@ -34,27 +39,29 @@ public class Produce implements Callable <Void> {
|
|||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
public boolean isPdf(String file) {
|
// public boolean isPdf(String file) {
|
||||||
return file.endsWith(".pdf");
|
// return file.endsWith(".pdf");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public Produce(PrintStream out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
if(produce) {
|
|
||||||
System.out.println("Produce mode activated ...");
|
|
||||||
System.out.println("Update : "+step);
|
|
||||||
System.out.println("Verbose : "+vb_level);
|
|
||||||
|
|
||||||
if (isPdf(sheet_name)) {
|
if(help){
|
||||||
System.out.println("Sheet : "+sheet_name);
|
CommandLine.usage(this.spec, System.out);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("The specified name for the result file is invalid");
|
|
||||||
//System.out.println("Sheet : "+sheet_name+".pdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Source : "+source_path);
|
System.out.println("\nProduce mode activated ...\n");
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
|
"Verbose : "+vb_level +"\n"+
|
||||||
|
"Sheet : "+sheet_name +"\n"+
|
||||||
|
"Source : "+source_path +"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -16,14 +16,22 @@ import java.util.concurrent.Callable;
|
|||||||
version = "Version 1.0",
|
version = "Version 1.0",
|
||||||
sortOptions = false,
|
sortOptions = false,
|
||||||
usageHelpWidth = 60,
|
usageHelpWidth = 60,
|
||||||
header = "Read command",
|
header = "Read command - Automatic entry",
|
||||||
footer = "\n Provided by IUT Info Nice S3T-G4",
|
footer = "",
|
||||||
description = "description"
|
description = "\nAnalyzes all scanned copies (pdf files) provided to recognize student's name and mark.\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Read implements Callable <Void> {
|
public class Read implements Callable <Void> {
|
||||||
|
|
||||||
|
@Spec
|
||||||
|
Model.CommandSpec spec;
|
||||||
|
|
||||||
|
@Option(names= {"-help"}, arity = "0", order = 1, description = "command help")
|
||||||
|
boolean help;
|
||||||
|
|
||||||
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
@Option(names= {"-u"}, arity = "1", order = 2, description = "update mode")
|
||||||
int step;
|
int step;
|
||||||
|
|
||||||
@ -40,42 +48,66 @@ public class Read implements Callable <Void> {
|
|||||||
String source_path;
|
String source_path;
|
||||||
|
|
||||||
|
|
||||||
|
// Flux de sortie si nécéssaire
|
||||||
public Read(PrintStream out) {
|
public Read(PrintStream out) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCsv(String file) {
|
|
||||||
return file.endsWith(".csv");
|
|
||||||
|
|
||||||
}
|
// public boolean isCsv(String file) {
|
||||||
|
// return file.endsWith(".csv");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
|
||||||
|
if(help) {
|
||||||
ProgressBar bar = new ProgressBar();
|
CommandLine.usage(this.spec, System.out);
|
||||||
|
|
||||||
System.out.println("\nReading pdf ...\n");
|
|
||||||
|
|
||||||
bar.update(0, 1000);
|
|
||||||
for(int i=0;i<1000;i++) {
|
|
||||||
// do something!
|
|
||||||
for(int j=0;j<10000000;j++)
|
|
||||||
for(int p=0;p<10000000;p++);
|
|
||||||
// update the progress bar
|
|
||||||
bar.update(i, 1000);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
System.out.println("\nCopies correction succeed !\n");
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("\nUpdate : "+step +"\n"+
|
//************* Progress Bar Prototype **************
|
||||||
|
|
||||||
|
// ProgressBar bar = new ProgressBar();
|
||||||
|
//
|
||||||
|
// System.out.println("\nReading pdf ...\n");
|
||||||
|
//
|
||||||
|
// bar.update(0, 1000);
|
||||||
|
// for(int i=0;i<1000;i++) {
|
||||||
|
// // do something!
|
||||||
|
// for(int j=0;j<10000000;j++)
|
||||||
|
// for(int p=0;p<10000000;p++);
|
||||||
|
// // update the progress bar
|
||||||
|
// bar.update(i, 1000);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("\nCopies correction succeed !\n");
|
||||||
|
|
||||||
|
//***************************************************
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("\nRead mode activated ...\n"); // Debug des paramètres à exploiter plus tard
|
||||||
|
System.out.println("Update : "+step +"\n"+
|
||||||
"Verbose : "+vb_level +"\n"+
|
"Verbose : "+vb_level +"\n"+
|
||||||
"Directory : "+directory_name +"\n"+
|
"Directory : "+directory_name +"\n"+
|
||||||
"Result : "+result_name +"\n"+
|
"Result : "+result_name +"\n"+
|
||||||
"Source : "+source_path +"\n");
|
"Source : "+source_path +"\n");
|
||||||
|
|
||||||
|
|
||||||
|
// ********VOIR EQUIPE********
|
||||||
|
|
||||||
|
// List imgList = PdfConvertor.toImage(directory_name); //retourne liste d'images
|
||||||
|
//
|
||||||
|
// CSV.setConfig(source_path);
|
||||||
|
// Map resultMap = OCR.read(imgList); // retourne HMap nom - note par ex
|
||||||
|
//
|
||||||
|
// ExportCSV.createCSV(resultMap,result_name); // crée fichier csv selon HMAp avec le nom donné
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user