if(args.length >= 2) {
if(args[0].equals("-g")) {
readFile(args[1],new FileAction() {
public void act(String str) {
try {
TokenState st = new TokenState(str);
NonGroundProgram ngProg = new ProgramParser().parse(st);
GroundProgram groundProg = ngProg.ground();
System.out.println(groundProg);
//System.out.println(groundProg.filterGrounding());
} catch (ParseException e) {
System.out.println(e.getParseError());
}
}
});
} else if(args[0].equals("-c") && args.length == 3) {
Double lowerBound;
try {
lowerBound = Double.parseDouble(args[1]);
if(lowerBound >= 0 && lowerBound <= 1)
readFile(args[2],new CompletionAction(lowerBound));
else
System.out.println("The y-argument should be in [0,1]");
} catch (NumberFormatException e) {
System.out.println("ERROR: the second argument of -c was not a Double.");
printUsage();
}
} else if(args[0].equals("-s")) {
System.out.println("Not implemented yet!");
} else if(args[0].equals("-im")) {
readFile(args[1],new FileAction() {
// TODO: remove duplication of code in this action and the
// grounding action (i.e. have a separate groundingaction that
// can be called that returns a GroundProgram).
public void act(String str) {
try {
TokenState st = new TokenState(str);
NonGroundProgram ngProg = new ProgramParser().parse(st);
GroundProgram groundProg = ngProg.ground();
ConsequenceOp imcons = new ConsequenceOp(groundProg);
FaspInterpretation model = imcons.computeLFP();
System.out.println("LFP Model:");