Skip to content

Commit

Permalink
release 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriele-costa committed Dec 29, 2017
1 parent ed2c25c commit 3297487
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/it/unige/parteval/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
public class Main {

private final static String help = ""
+ "Partial Evaluator of Simple Transition Systems (PESTS)\n"
+ "Usage: java -jar pests.jar INPUT [OPTIONS]\n"
+ "\n"
+ "INPUT must be an existing file containing a textual description of a finite state agent\n"
+ "\n"
+ "OPTIONS are a subset of the following:\n"
+ "-o=FILE\t\t\t write output on FILE. Writes on standard output if not specified and option -f is set to txt.\n"
+ "-s=FILE\t\t\t read specification from FILE. Uses FALSE if not specified.\n"
+ "-a={v1,...,vN}\t\t use v1,...,vN as synchronous actions. Uses {} if not specified.\n"
+ "-b={v1,...,vN}\t\t use v1,...,vN as asynchronous actions. Uses {} if not specified.\n"
+ "-a=v1,...,vN\t\t use v1,...,vN as synchronous actions. Uses the empty set if not specified.\n"
+ "-b=v1,...,vN\t\t use v1,...,vN as asynchronous actions. Uses the empty set if not specified.\n"
+ "-f=txt|svg|png|pdf\t use the specified output format. Omitting this option is equivalent to -f=txt.\n"
+ "-v\t\t\t activate verbose output.\n"
+ "-h\t\t\t print this message and exit.\n";
Expand Down Expand Up @@ -58,7 +59,7 @@ else if(val == ArgsType.INVALID) {
try {
buffer = readFile(opt.input);
} catch(IOException e) {
System.out.println(e);
System.out.println("Could not open " + opt.input);
System.exit(1);
}
DFAutomatonImpl A = AutomataTextualInterface.read(buffer);
Expand All @@ -70,9 +71,9 @@ else if(val == ArgsType.INVALID) {
P = new DFAutomatonImpl(i);
} else {
try {
buffer = readFile(opt.input);
buffer = readFile(opt.specification);
} catch(IOException e) {
System.out.println(e);
System.out.println("Could not open " + opt.specification);
System.exit(1);
}
P = AutomataTextualInterface.read(buffer);
Expand All @@ -94,13 +95,13 @@ else if(val == ArgsType.INVALID) {

NFAutomatonImpl Pp = Projection.partialA(P, A, S, G);

long t1 = System.currentTimeMillis() - t0;
log("Partial evaluation: Time=" + t1 +" ms, States="+P.getStates().size()+", Transitions=" + P.getTransitions().size());
long t1 = System.currentTimeMillis();
log("Partial evaluation: Time=" + (t1-t0) +" ms, States="+P.getStates().size()+", Transitions=" + P.getTransitions().size());

DFAutomatonImpl P2 = Projection.unify(Pp, G);

long t2 = System.currentTimeMillis() - t1;
log("Unification: Time=" + t2 +" ms, States="+P2.getStates().size()+", Transitions=" + P2.getTransitions().size());
long t2 = System.currentTimeMillis();
log("Unification: Time=" + (t2-t1) +" ms, States="+P2.getStates().size()+", Transitions=" + P2.getTransitions().size());

if(opt.output_format == null)
opt.output_format = "txt";
Expand All @@ -113,6 +114,7 @@ else if(val == ArgsType.INVALID) {
output = AutomataTextualInterface.write(P2);
} else {
Printer.type = opt.output_format;
Printer.outdir = new File(opt.output).getParent();
output = Printer.printDotAutomaton(P2, "PartEval");
}

Expand Down Expand Up @@ -144,6 +146,7 @@ private enum ArgsType {VALID, INVALID, HELP};
private final static int FIRSTARG = 0;

private static ArgsType validate(String[] args, Options opt) {

if(args.length < FIRSTARG + 1) {
return ArgsType.INVALID;
}
Expand Down Expand Up @@ -179,13 +182,13 @@ else if(args[i].startsWith("-a")) {
if(opt.sync_actions != null)
return ArgsType.INVALID;

opt.sync_actions = args[i].substring(4, args[i].length()-1).split(",");
opt.sync_actions = args[i].substring(3).split(",");
}
else if(args[i].startsWith("-b")) {
if(opt.async_actions != null)
return ArgsType.INVALID;

opt.async_actions = args[i].substring(4, args[i].length()-1).split(",");
opt.async_actions = args[i].substring(3).split(",");
}
else if(args[i].startsWith("-f")) {
if(opt.output_format != null)
Expand Down

0 comments on commit 3297487

Please sign in to comment.