summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkinnebrew <jkinnebrew@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-04 22:51:34 +0000
committerjkinnebrew <jkinnebrew@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-04 22:51:34 +0000
commitfd88be66e2ad7aa5f04006f8ef887031d9880aa2 (patch)
tree2961dd58c8362fe0d1564597af7d36d282b6e2dd
parent1210e8fa8c783a7e4ad6e8bcbe5b81003d07bc68 (diff)
downloadATCD-fd88be66e2ad7aa5f04006f8ef887031d9880aa2.tar.gz
Wed Nov 4 22:47:08 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
-rw-r--r--SA_POP/C2W/C2W_Demo.cpp98
-rw-r--r--SA_POP/ChangeLog836
-rw-r--r--SA_POP/LogGraphOut.cpp299
-rw-r--r--SA_POP/LogGraphOut.h18
-rw-r--r--SA_POP/PlanCommands.h25
-rw-r--r--SA_POP/PlanHeuristics.h12
-rw-r--r--SA_POP/Planner.cpp47
-rw-r--r--SA_POP/Planner.h15
-rw-r--r--SA_POP/SANet/SANet.cpp80
-rw-r--r--SA_POP/SANet/SANet.h34
-rw-r--r--SA_POP/SANet/SANetFileIn.cpp4
-rw-r--r--SA_POP/SANet/SANode.cpp22
-rw-r--r--SA_POP/SANet/SANode.h23
-rw-r--r--SA_POP/SAPOP_w_ACE.mpc4
-rw-r--r--SA_POP/SA_POP_Types.h337
-rw-r--r--SA_POP/SA_POP_Utils.cpp352
-rw-r--r--SA_POP/SA_POP_Utils.h177
-rw-r--r--SA_POP/SA_PlanCommands.cpp209
-rw-r--r--SA_POP/SA_PlanCommands.h102
-rw-r--r--SA_POP/SA_PlanHeuristics.cpp264
-rw-r--r--SA_POP/SA_PlanHeuristics.h17
-rw-r--r--SA_POP/SA_PlanStrategy.cpp858
-rw-r--r--SA_POP/SA_PlanStrategy.h26
-rw-r--r--SA_POP/SA_SchedStrategy.cpp342
-rw-r--r--SA_POP/SA_SchedStrategy.h2
-rw-r--r--SA_POP/SA_WorkingPlan.cpp2783
-rw-r--r--SA_POP/SA_WorkingPlan.h68
-rw-r--r--SA_POP/TaskMapFileIn.cpp14
-rw-r--r--SA_POP/WorkingPlan.h4
-rw-r--r--SA_POP/docs/schema/Task_Map.xsd2
-rw-r--r--SA_POP/examples/C2W/c2w.san.xml (renamed from SA_POP/C2W/c2w.san.xml)0
-rw-r--r--SA_POP/examples/C2W/c2w.tm.xml (renamed from SA_POP/C2W/c2w.tm.xml)0
-rw-r--r--SA_POP/examples/Simple/simple.tm.xml6
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/README123
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/build.xml63
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jarbin0 -> 575389 bytes
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl36
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl31
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb1travel.pddl34
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb2travel.pddl45
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java177
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java304
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java2741
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java106
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java63
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java62
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java161
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java31
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java31
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java44
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java30
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java119
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java467
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java100
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java114
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java697
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java5152
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java131
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java107
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java161
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java41
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java161
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java314
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java398
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java323
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java173
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java254
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java110
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java173
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java367
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java42
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java323
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java77
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java136
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java370
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java269
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java329
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java300
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java349
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java347
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java219
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java244
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java190
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java48
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java272
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java110
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java61
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java310
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java103
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java104
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java104
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java103
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java138
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java213
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java136
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java306
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java98
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java77
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java204
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java244
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java147
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java150
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java144
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java262
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java196
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java84
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java173
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java358
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java168
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java165
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java165
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java165
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java114
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java114
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java114
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java96
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java113
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java394
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java144
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java100
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java100
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java91
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java146
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java79
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java148
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java112
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java247
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java112
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java49
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java237
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java99
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java168
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java309
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java163
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java60
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java364
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java123
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java124
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java120
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java44
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java124
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java123
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java48
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java275
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java52
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java272
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java321
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java305
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java101
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java123
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java14859
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj8581
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt3466
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java320
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java2226
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java357
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java34
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java198
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java472
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java211
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java124
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java140
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html70
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html16
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java136
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java285
-rw-r--r--SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/travel.pddl51
-rwxr-xr-xSA_POP/utils/SANetGenerator/Net_Skeleton.py56
-rwxr-xr-xSA_POP/utils/SANetGenerator/Rand_Skeletons.py75
180 files changed, 64364 insertions, 1844 deletions
diff --git a/SA_POP/C2W/C2W_Demo.cpp b/SA_POP/C2W/C2W_Demo.cpp
index a49d4d55560..fb9bbb70abb 100644
--- a/SA_POP/C2W/C2W_Demo.cpp
+++ b/SA_POP/C2W/C2W_Demo.cpp
@@ -14,6 +14,10 @@
*/
//=============================================================================
+#define _CRTDBG_MAP_ALLOC
+#include <stdlib.h>
+#include <crtdbg.h>
+
#include <iostream>
#include <fstream>
#include "SA_POP_Types.h"
@@ -23,6 +27,7 @@
#include "SANet/SANetFileIn.h"
#include "LogScreenOut.h"
#include "LogGraphOut.h"
+//#include "SA_POP_Utils.h"
#include <vector>
#include <map>
@@ -44,7 +49,7 @@ void displayConds(SA_POP::Planner *plans, std::vector<SANet::CondID> checks, std
//Produce Graph
std::cout << "Create Digraph" << std::endl;
cfile << "strict digraph conds {\n";
- for(int node = 0; node< checks.size(); node++)
+ for(size_t node = 0; node< checks.size(); node++)
{
std::cout << "Next Cond" << std::endl;
@@ -93,6 +98,66 @@ int main (int argc, char* argv[])
std::vector<SANet::CondID> toCheck;
std::map<SANet::CondID, double> condMap;
+/*
+ SA_POP::ListMultiMap<int, int> intList;
+
+ intList.insert(std::make_pair(1,2));
+ intList.insert(std::make_pair(5,6));
+ intList.insert(std::make_pair(5,7));
+
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.lower_bound (5);list_iter != intList.upper_bound (5);list_iter++)
+ {
+ std::cout << list_iter->second << std::endl;
+ }
+
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.begin();list_iter != intList.end();list_iter++)
+ {
+ std::cout << list_iter->first << " FOR JOHN " <<list_iter->second << std::endl;
+ }
+
+ intList.erase(intList.lower_bound (5), intList.upper_bound (5));
+
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.begin();list_iter != intList.end();list_iter++)
+ {
+ std::cout << list_iter->first << " FOR JOHN " <<list_iter->second << std::endl;
+ }
+
+ intList.push_front(std::make_pair(9,9));
+ intList.push_front(std::make_pair(8,8));
+ intList.push_back(std::make_pair(7,7));
+
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ intList.pop_front();
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ intList.push_front(std::make_pair(12,12));
+ intList.push_front(std::make_pair(7,7));
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.begin();list_iter != intList.end();list_iter++)
+ {
+ std::cout << list_iter->first << " FOR JOHN " <<list_iter->second << std::endl;
+ }
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ intList.pop_back();
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.begin();list_iter != intList.end();list_iter++)
+ {
+ std::cout << list_iter->first << " FOR JOHN " <<list_iter->second << std::endl;
+ }
+ intList.push_back(std::make_pair(7,7));
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ intList.erase(intList.lower_bound (7));
+ std::cout << "Front: " <<intList.front().first << " and " << intList.front().second << std::endl;
+ std::cout << "Back: " <<intList.back().first << " and " << intList.back().second << std::endl;
+ for (SA_POP::ListMultiMap<int, int>::iterator list_iter = intList.begin();list_iter != intList.end();list_iter++)
+ {
+ std::cout << list_iter->first << " FOR JOHN " <<list_iter->second << std::endl;
+ }
+*/
+
// Get filenames from user.
std::cout << "Task Network file: ";
// sanet_filename = "../examples/output1.xml";
@@ -130,23 +195,29 @@ int main (int argc, char* argv[])
try {
+
+
sanet_in.build_net (sanet_filename, &builder);
tm_in.build_task_map (tm_filename, &builder);
- } catch (std::string e) {
+
+
+ }
+
+ catch (std::string e) {
std::cerr << "ERROR while building task network and task map from files:";
std::cerr << std::endl;
std::cerr << e;
} catch (...) {
- std::cerr << "UNKNOWN ERROR while planning." << std::endl;
+ std::cerr << "UNKNOWN ERROR while building task network and task map from files." << std::endl;
}
SA_POP::Planner *planner = 0;
- SA_POP::LogGraphOut graph_out (std::cout, 1);
+ SA_POP::LogGraphOut graph_out (std::cout, false);
- try {
+ // try {
planner = builder.get_planner ();
//Set any probabilities not listed in the XML
@@ -187,12 +258,15 @@ int main (int argc, char* argv[])
SA_POP::LogScreenOut screen_out (std::cout);
graph_out.addTracking(toCheck);
planner->add_out_adapter (&graph_out);
- //SA_POP::SchemaOut s_out (std::cout, *kconds);
+ //SA_POP::SchemaOut s_out (std::cout, *kconds);
//planner->add_out_adapter (&s_out);
- //planner->add_out_adapter (&screen_out);
+ //planner->add_out_adapter (&screen_out);
+
+ planner->plan (15, goal);
- planner->plan (100, goal);
- } catch (std::string e) {
+ //}
+ /*
+ catch (std::string e) {
std::cerr << "ERROR while planning:" << std::endl;
std::cerr << e;
delete planner;
@@ -200,6 +274,7 @@ int main (int argc, char* argv[])
std::cerr << "UNKNOWN ERROR while planning." << std::endl;
delete planner;
}
+ */
bool stop = false;
while(!stop)
@@ -262,7 +337,7 @@ int main (int argc, char* argv[])
tm_in.build_task_map (tm_filename, &rebuilder);
planner = rebuilder.get_planner ();
planner->add_out_adapter (&graph_out);
- */
+*/
for(std::map<SANet::CondID, double>::iterator cIter = condMap.begin(); cIter != condMap.end(); cIter++)
{
planner->update_cond_val((*cIter).first, (*cIter).second);
@@ -286,6 +361,9 @@ int main (int argc, char* argv[])
std::cin>>temp_;
//****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+ _CrtDumpMemoryLeaks();
+
return 0;
}
diff --git a/SA_POP/ChangeLog b/SA_POP/ChangeLog
index b6561326a5c..345f5020ffd 100644
--- a/SA_POP/ChangeLog
+++ b/SA_POP/ChangeLog
@@ -1,3 +1,638 @@
+Wed Nov 4 22:47:08 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
+
+
+ * ChangeLog:
+ * LogGraphOut.h:
+ * LogGraphOut.cpp:
+ * PlanCommands.h:
+ * PlanHeuristics.h:
+ * Planner.h:
+ * Planner.cpp:
+
+ * C2W/C2W_Demo.cpp:
+
+ * SANet/SANet.h:
+ * SANet/SANet.cpp:
+ * SANet/SANetFileIn.cpp:
+ * SANet/SANode.h:
+ * SANet/SANode.cpp:
+
+ * SAPOP_w_ACE.mpc:
+ * SA_POP_Types.h:
+ * SA_POP_Utils.h:
+ * SA_POP_Utils.cpp:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanHeuristics.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.h:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+ * TaskMapFileIn.cpp:
+ * WorkingPlan.h:
+
+ * docs/schema/Task_Map.xsd:
+
+ * examples/C2W:
+
+ * examples/C2W/c2w.san.xml:
+ * examples/C2W/c2w.tm.xml:
+
+ * examples/Simple/simple.tm.xml:
+
+ * utils:
+
+ * utils/PDDLtoSANetTranslator:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/README:
+ * utils/PDDLtoSANetTranslator/PDDLParser/build.xml:
+ * utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jar:
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/pb1travel.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/pb2travel.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/travel.pddl:
+
+ * utils/SANetGenerator:
+
+ * utils/SANetGenerator/Net_Skeleton.py:
+ * utils/SANetGenerator/Rand_Skeletons.py:
+
+ * C2W/c2w.san.xml:
+ * C2W/c2w.tm.xml:
+ Removed these files.
+
+
+ Merged SAPOP_Threat_dev branch back into main (RACE_devl) branch.
+ (Included ChangeLog comments from SAPOP_Threat_dev branch below.)
+
+
+
+Tue Oct 20 19:20:36 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * utils/SANetGenerator:
+
+ * utils/SANetGenerator/Net_Skeleton.py:
+ * utils/SANetGenerator/Rand_Skeletons.py:
+
+ Added the initial files for generating SANets. Rand Skeletons is for different
+ random graph algorithms. Net Skeleton is a sample program using Rand Skeletons.
+
+Thu Oct 15 00:40:20 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * C2W/C2W_Demo.cpp:
+
+ * Planner.h:
+ * Planner.cpp:
+
+ * SANet/SANet.cpp:
+ * SANet/SANetFileIn.cpp:
+
+ * SA_POP_Types.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+ * TaskMapFileIn.cpp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java:
+
+ Eliminated initial action
+
+Sun Oct 4 19:44:35 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_POP_Types.h:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Changed debug levels
+
+Fri Oct 2 23:31:27 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SANet/SANet.cpp:
+ * SANet/SANetFileIn.cpp:
+
+ * SA_POP_Types.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_WorkingPlan.cpp:
+ * TaskMapFileIn.cpp:
+
+ Init task renumbered
+
+Thu Oct 1 21:33:24 UTC 2009 unknown <unknown@vanderbilt.edu>
+
+ * SA_POP_Types.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+
+ Various cleanup
+
+Thu Oct 1 20:10:38 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * C2W/C2W_Demo.cpp:
+ Modified the graph_out adapter call to take advantage of the new function call.
+
+ * LogGraphOut.h:
+ * LogGraphOut.cpp:
+ Refactored some of the code that draws the graph, improved visualization of non-stepping graph
+
+ * SANet/SANet.h:
+ * SANet/SANet.cpp:
+ Simplified the print_graphviz function to remove outside logging code. Takes a default color.
+
+ * SA_PlanStrategy.cpp:
+ Resolved conflict about the task restrictor.
+
+Thu Oct 1 17:25:36 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * C2W/C2W_Demo.cpp:
+
+ * PlanHeuristics.h:
+ * Planner.cpp:
+
+ * SANet/SANetFileIn.cpp:
+
+ * SA_POP_Types.h:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java:
+
+ Various changes to the PDDL parser
+
+Wed Aug 12 19:15:30 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * utils/PDDLtoSANetTranslator:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser:
+
+ Cleanup
+
+Wed Aug 12 19:02:39 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt:
+
+ Lexer files
+
+Wed Aug 12 18:49:43 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl:
+ * utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java:
+
+ Domain files
+
+Wed Aug 12 17:49:43 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * utils:
+
+ * utils/PDDLtoSANetTranslator:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/README:
+ * utils/PDDLtoSANetTranslator/PDDLParser/build.xml:
+ * utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jar:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests:
+
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java:
+ * utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java:
+
+ The PDDL to SANet translator. Also includes the library PDDL4J which does the inital pddl parsing. I've made some
+ bug fixes to this library, so the source needs to be here.
+
+Tue Aug 4 22:14:56 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SANet/SANetFileIn.cpp:
+
+ * SA_POP_Types.h:
+ * SA_PlanHeuristics.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.cpp:
+
+ Various fixes that make SAPOP correctly handle situations with negative preconditions
+ /goals. Changed Condition equality to handle value, changed SANetFileIn to give conditions
+ correct initial values, and initial action effects all conditions now
+
+Wed Jul 29 20:06:21 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * C2W/C2W_Demo.cpp:
+
+ * PlanCommands.h:
+ * PlanHeuristics.h:
+ * Planner.h:
+ * Planner.cpp:
+
+ * SANet/SANet.cpp:
+ * SANet/SANetFileIn.cpp:
+ * SANet/SANode.h:
+ * SANet/SANode.cpp:
+
+ Now adds an initial action with an effect of setting all true conditions true.
+ So the loop in get unsat preconditions that eliminates preconditions true in the environment
+ is gone, since it could generate incorrect plans in environments with threats
+
+ SANet also sets the utility of this initial condition higher than all other actions, as it should
+ be the first try always
+
+ * SA_POP_Types.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanHeuristics.h:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+ * TaskMapFileIn.cpp:
+
+ Map from last commit has been fixed.
+
+ Implements a suspended condition map for fixing looping
+
+
Tue Jul 28 21:39:32 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
* C2W/C2W_Demo.mpc:
@@ -55,6 +690,207 @@ Mon Jul 27 23:53:25 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.ed
SANet Standalone updated for latest XML utilities.
+
+Thu Jul 16 06:13:54 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * PlanCommands.h:
+ * SA_POP_Types.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+ * WorkingPlan.h:
+
+ Added basic loop detection; has a map of open conditions at time of resolving open threat.
+
+Fri Jul 10 22:27:30 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_POP_Types.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Iterative deeping, fix on last_task_inst_ in planstrat, fixed precedence graph inconsistencies,
+ fixed unranked bug in init prec insert, different task choice strategy.
+
+Wed Jul 8 22:17:52 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_POP_Types.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+
+ Debugging output improved.
+
+Wed Jul 8 01:13:05 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * SA_POP_Types.h:
+ * SA_WorkingPlan.cpp:
+
+ Fixed the comparison operator of less than to work correctly.
+
+Tue Jul 7 23:10:22 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_PlanCommands.h:
+ * SA_PlanHeuristics.cpp:
+
+ Changed the order in which tasks are chosen to satisfy open conditions.
+ Working on getting it to choose the correct tasks.
+
+ * PlanCommands.h:
+ * PlanHeuristics.h:
+ * Planner.h:
+ * SA_POP_Types.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanHeuristics.h:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+
+
+
+Mon Jul 6 20:27:43 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * ChangeLog:
+ * SA_PlanCommands.cpp:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Cleaned up Changelog for consistency.
+
+ Commented out halt for task_inst
+
+ Erased fix for Initial Action in favor of throwing an exception.
+
+
+Mon Jul 6 18:42:01 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_WorkingPlan.cpp:
+
+ Started gettign rid of ordering links and using precedence graph.
+
+Thu Jul 2 16:36:11 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_WorkingPlan.cpp:
+
+ Resolve CL threat fails if it is asked to schedule something before 20.
+
+Thu Jul 2 05:38:02 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * PlanCommands.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Changed open condition resolution to resolve conditions for one task at a time.
+
+Wed Jul 1 22:13:25 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Updated to allow for goal_task_inst to be part of threats.
+ Small aesthetic changes
+
+Tue Jun 30 20:10:07 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+
+ Modified undo for removing open conds to match the breadth first search.
+ Indented some of ankits code for readability.
+
+Mon Jun 29 21:52:33 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_PlanCommands.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Added ability to use 20 again if it is undone once.
+
+Mon Jun 29 21:02:05 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * PlanCommands.h:
+ * Planner.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.h:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.cpp:
+
+ Decision points numbered wrong
+
+Mon Jun 29 16:59:21 UTC 2009 Ben Podgursky <bpodgursky@gmail.com>
+
+ * SA_PlanCommands.cpp:
+ In execute next of AddTaskCmd, was a bug in checking for tasks_.front()==20 if
+ tasks is null. Swapped with returning false if tasks is empty to return first.
+
+ * SA_PlanHeuristics.cpp:
+ Bug here where tasks were being stored in a map with the EU as the key. Tasks with the
+ same EU were erasing previous tasks. Changed to multimap.
+
+ * SA_PlanStrategy.cpp:
+
+ Undo the assoc_impl_cmd if it fails.
+
+ * SA_SchedStrategy.cpp:
+ Bug in satisfy sched. If energy prop or time balance prop failed, it called undo_through
+ the adjust min times cmds it created, but if recurse plan failed, it left those not undone
+ causing problems in the level down. Changed to if recurse_plan fails undoing all
+ commands created here.
+
+ * SA_WorkingPlan.cpp:
+
+ Bug in undo of AddTaskCmd regarding ordering links fixed.
+ Made sure that causal links don't have goal targets in generate threats.
+
+Fri Jun 26 21:53:02 UTC 2009 Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+
+
+ * C2W/C2W_Demo.cpp:
+ Cleaned up and contains code for testing MultiMapList
+
+ * LogGraphOut.cpp:
+ Changes to various display colors
+
+ * SANet/SANet.h:
+ * SANet/SANet.cpp:
+ * SANet/SANode.h:
+ * SANet/SANode.cpp:
+ Getters and Setters for accessing components of the SANets
+
+
+ * PlanCommands.h:
+ * Planner.h:
+ * Planner.cpp:
+ * SAPOP_w_ACE.mpc:
+ * SA_POP_Types.h:
+ * SA_PlanCommands.h:
+ * SA_PlanCommands.cpp:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.h:
+ * SA_PlanStrategy.cpp:
+ * SA_SchedStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+ * WorkingPlan.h:
+
+ This is in development changes for implementation of causal threat resolution.
+
+ * SA_POP_Utils.h:
+ * SA_POP_Utils.cpp:
+ An implementation of a MultiMap with List like capabilities(i.e. ordering purposes)
+
+
Mon Jun 15 17:51:23 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
* Component/SA_POP_Component.mpc:
diff --git a/SA_POP/LogGraphOut.cpp b/SA_POP/LogGraphOut.cpp
index 95ba262c90c..4fe2eb4980b 100644
--- a/SA_POP/LogGraphOut.cpp
+++ b/SA_POP/LogGraphOut.cpp
@@ -25,6 +25,7 @@
#include "Planner.h"
#include <fstream>
#include <vector>
+//#include "Thread.h"
//#include "gvc.h"
//#include "mfg_draw_graph.h"
//#include "mfg_graph_drawer.h"
@@ -32,12 +33,20 @@
using namespace SA_POP;
// Constructor.
-LogGraphOut::LogGraphOut (std::ostream &out, int startstep)
+LogGraphOut::LogGraphOut (std::ostream &out, bool startstep)
: out_ (out)
{
- graphn = startstep;
+ // Set up the current step
+ if(startstep)
+ {
+ curStep = 1;
+ }
+ else
+ {
+ curStep = 0;
+ }
+ byStep = startstep;
hasTracks = false;
- // Nothing to do.
}
// Destructor.
@@ -72,6 +81,7 @@ void LogGraphOut::notify_eu (SA_POP::Planner *planner)
}
}
+
unsigned long WINAPI SecondThread(PVOID pvParam)
{
system("dot -Tgif GViz.dot -o step.gif");
@@ -80,6 +90,7 @@ unsigned long WINAPI SecondThread(PVOID pvParam)
}
+
// Notify about plan changes.
void LogGraphOut::notify_plan (SA_POP::Planner *planner)
{
@@ -88,16 +99,8 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
time_t cur_time = time(0);
bool done = false;
- /*
- GVC_t *gvc;
- graph_t *g;
- FILE *fp;
- mfg::DrawGraph * graph;
- */
-
- //gvc = gvContext();
- //This
+ //This sends planning info not included in the graph to the console, about timing windows.
this->out_ << std::endl;
this->out_ << "Plan (" << plan.name << ") Changed at " << std::endl;
this->out_ << ctime (&cur_time) << std::endl;
@@ -115,7 +118,7 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
//Make sure we don't run out of bounds
int lastime = 0;
int plansize = 0;
- if(graphn > 0)
+ if(byStep)
{
for (PlanInstSet::iterator inst_iter = plan.task_insts.begin ();
inst_iter != plan.task_insts.end ();
@@ -124,11 +127,11 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
PlanTaskInst inst = *inst_iter;
startimes.push_back(inst.start_window.first);
}
-
+ //Sort the tasks and grab the current latest time
std::sort(startimes.begin(), startimes.end());
- if(graphn < startimes.size())
+ if(curStep < startimes.size())
{
- lastime = startimes[graphn];
+ lastime = startimes[curStep];
}
else
{
@@ -144,166 +147,104 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
gfile.open("GViz.dot");
- gfile << "strict digraph graph" << graphn << " {\n";
+ gfile << "strict digraph graph" << curStep << " {\n";
- if(graphn == 0)
+ //Just draw out the graph from the causal links from the plan.
+ if(!byStep)
{
+ //Print out the entire graph first.
planner->print_graph(gfile, graphmap);
+ //Now print out the graph of the causal links in the plan.
for (CLSet::iterator cl_iter = plan.causal_links.begin ();
cl_iter != plan.causal_links.end ();
cl_iter++)
{
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> ";
- gfile << planner->get_cond_name (clink.cond.id) << ";\n";
- gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n";
- gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> ";
- gfile << planner->get_task_name (
- planner->get_task_from_inst (clink.second)) << "\n";
+ CausalLink clink = *cl_iter;
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << "[shape=box];\n";
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " -> ";
+ gfile << planner->get_cond_name (clink.cond.id) << ";\n";
+ gfile << "\t" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "[shape=box];\n";
+ gfile << "\t" << planner->get_cond_name (clink.cond.id) << " -> ";
+ gfile << planner->get_task_name (planner->get_task_from_inst (clink.second)) << "\n";
}
}
- else if(graphn == 1)
+ // Draw out the graph as if taking the plan step by step
+ else if(byStep)
{
+ //Format a dot file with the entire graph to get the entire structure ready to print.
planner->print_graph(gfile, graphmap);
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
-
- if(planner->get_start_window (clink.first).first <= lastime)
- {
- if(planner->get_start_window (clink.first).first == lastime && !done)
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " [shape=box, style=filled ,color = orange];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- else
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled, color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
-
- if(planner->get_start_window (clink.second).first <= lastime)
- {
- if(planner->get_start_window (clink.second).first == lastime && !done)
+ //Propogate the image of taking a step in the plan by modifying the colors of the nodes.
+ color_step(planner);
+ //Use the timing to find the current step and color as necessary
+ for (CLSet::iterator cl_iter = plan.causal_links.begin ();cl_iter != plan.causal_links.end ();cl_iter++)
+ {
+ CausalLink clink = *cl_iter;
+ if(planner->get_start_window (clink.first).first <= lastime)
+ {
+ //Color the current step green
+ if(planner->get_start_window (clink.first).first == lastime && !done)
{
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n";
- //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "green";
+ }
+ citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "green";
+ }
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= green];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " [style=filled ,color = orange];\n";
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
+ gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
}
else
{
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
-
- }
- }
- }
- }
- }
- else
- {
- for (CLSet::iterator cl_iter = plan.causal_links.begin ();
- cl_iter != plan.causal_links.end ();
- cl_iter++)
- {
- CausalLink clink = *cl_iter;
- //this->out_ << "Build Graph from links.." << std::endl;
-
- if(planner->get_start_window (clink.first).first <= lastime)
- {
- if(planner->get_start_window (clink.first).first == lastime && !done)
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
+ //Go through and color the path to the current step blue.
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "blue";
+ }
+ citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ (*citer).second = "blue";
+ }
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, color= turquoise1];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled, color = turquoise1];\n";
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
+ gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
}
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "green";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= green];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled , color = orange];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- else
- {
- std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- citer = graphmap.find(planner->get_cond_name (clink.cond.id));
- if(citer != graphmap.end())
- {
- (*citer).second = "blue";
- }
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << "[shape=box, style=filled ,color= turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[ style=filled ,color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.first)) << " " << planner->get_task_from_inst (clink.first) << "\" " << " -> ";
- gfile << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << ";\n";
- }
- if(planner->get_start_window (clink.second).first <= lastime)
- {
- if(planner->get_start_window (clink.second).first == lastime && !done)
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = green];\n";
- //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ //Otherwise print the graph with colors that indicate that the graph has been traversed through all the steps in the plan.
+ if(planner->get_start_window (clink.second).first <= lastime)
+ {
+ if(planner->get_start_window (clink.second).first == lastime && !done)
+ {
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = green];\n";
+ //gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = green];\n";
+ gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
+ gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+ }
+ else
+ {
+ gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, color = turquoise1];\n";
+ gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[color = turquoise1];\n";
+ gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
+ gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
+
+ }
}
- else
- {
- gfile << "\t" << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << "[shape=box, style=filled , color = turquoise1];\n";
- gfile << "\t\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << "[style=filled , color = turquoise1];\n";
- gfile << "\t" << "\"" << planner->get_cond_name (clink.cond.id) << " " << clink.cond.id << "\" " << " -> ";
- gfile << "\"" << planner->get_task_name (planner->get_task_from_inst (clink.second)) << " " << planner->get_task_from_inst (clink.second) << "\" " << ";\n";
-
- }
- }
- }
- }
- }
-
+ }
+ }
+ }
+ //If we are tracking conditions not controlled by the plan, but that impact it(such as environmental conditions
if(hasTracks)
{
- for(int i = 0; i < tracks.size(); i++)
+ for(size_t i = 0; i < tracks.size(); i++)
{
SANet::CondID ccid = tracks[i];
double prob = planner->get_cond_val(ccid);
@@ -317,6 +258,8 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
}
}
}
+
+ // If we are actually done with the graph, color the goal as true, and done.
if(done)
{
SA_POP::GoalMap curgoals = planner->get_goals();
@@ -339,9 +282,12 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
HANDLE hThread = CreateThread(NULL, 0, SecondThread, (PVOID) imageName,
0, &dwThreadId);
CloseHandle(hThread);
+ //int spawn (ACE_THR_FUNC SecondThread);
+
//system("dot -Tgif GViz.dot -o step.gif");
//system("step.gif");
+ //This is debug output to the console about scheduling links
for (SchedLinkSet::iterator sched_iter = plan.sched_links.begin ();
sched_iter != plan.sched_links.end ();
sched_iter++)
@@ -361,13 +307,50 @@ void LogGraphOut::notify_plan (SA_POP::Planner *planner)
this->out_ << std::endl;
};
-
+//Advance a step
void LogGraphOut::moveStep()
{
- graphn++;
+ curStep++;
};
+//Reset current step
void LogGraphOut::resetStep()
{
- graphn = 1;
+ curStep = 1;
+};
+
+// Uses a color pattern to effect the nodes in the plan to give the impression that they are the pervious step
+void LogGraphOut::color_step(SA_POP::Planner *planner)
+{
+ Plan plan = planner->get_plan ();
+ for (CLSet::iterator cl_iter = plan.causal_links.begin (); cl_iter != plan.causal_links.end (); cl_iter++)
+ {
+ CausalLink clink = *cl_iter;
+ std::map<std::string, std::string>::iterator titer = graphmap.find(planner->get_task_name (planner->get_task_from_inst (clink.first)));
+ if(titer != graphmap.end())
+ {
+ if((*titer).second == "blue" )
+ {
+ (*titer).second = "cornflowerblue";
+
+ }
+ else if((*titer).second == "green")
+ {
+ (*titer).second = "red";
+ }
+ }
+ std::map<std::string, std::string>::iterator citer = graphmap.find(planner->get_cond_name (clink.cond.id));
+ if(citer != graphmap.end())
+ {
+ if((*citer).second == "blue" )
+ {
+ (*citer).second = "cornflowerblue";
+
+ }
+ else if((*citer).second == "green")
+ {
+ (*citer).second = "red";
+ }
+ }
+ }
}; \ No newline at end of file
diff --git a/SA_POP/LogGraphOut.h b/SA_POP/LogGraphOut.h
index 900c50c1be8..3ccd2cf40ee 100644
--- a/SA_POP/LogGraphOut.h
+++ b/SA_POP/LogGraphOut.h
@@ -37,7 +37,7 @@ namespace SA_POP {
/**
* @param strm Output stream to log to.
*/
- LogGraphOut (std::ostream &out, int startStep);
+ LogGraphOut (std::ostream &out, bool startStep);
/// Destructor.
virtual ~LogGraphOut (void);
@@ -72,10 +72,20 @@ namespace SA_POP {
*/
void addTracking(std::vector<SANet::CondID> checks);
+ /// Color the graph to immitate the nextstep
+ /**
+ *
+ */
+ void color_step(SA_POP::Planner *planner);
+
protected:
- /// Output stream to log to.
- std::ostream &out_;
- int graphn;
+ /// Output stream to log to.
+ std::ostream &out_;
+ // Utilize the graphviz layout to fake taking steps?
+ bool byStep;
+
+ // Utilized for the step needed to isolate
+ int curStep;
bool hasTracks;
std::map<std::string, std::string> graphmap;
std::vector<SANet::CondID> tracks;
diff --git a/SA_POP/PlanCommands.h b/SA_POP/PlanCommands.h
index fc1553b4c6c..57cab6458ba 100644
--- a/SA_POP/PlanCommands.h
+++ b/SA_POP/PlanCommands.h
@@ -58,7 +58,7 @@ namespace SA_POP {
/**
* @param prev Pointer to the previous command.
*/
- virtual void set_prev (PlanCommand *prev) { this->prev_ = prev; };
+ virtual void set_prev (PlanCommand *prev) { this->prev_ = prev;};
/// Get pointer to previous command.
/**
@@ -85,6 +85,11 @@ namespace SA_POP {
*/
virtual std::string get_log_text (void) = 0;
+
+
+ int choices;
+
+
protected:
/// ID of this command.
CommandID id_;
@@ -164,7 +169,7 @@ namespace SA_POP {
/**
* @param tasks Ordered list of tasks.
*/
- virtual void set_tasks (const TaskList &tasks) = 0;
+ virtual void set_tasks (const TaskChoiceList &tasks) = 0;
/// Set causal link info to add to the plan with task.
/**
@@ -192,6 +197,12 @@ namespace SA_POP {
* @return True if this command is using an already existing instance id.
*/
virtual bool inst_exists (void) = 0;
+
+ virtual TaskInstSet get_satisfied_tasks(void) = 0;
+
+ virtual Condition get_condition(void) = 0;
+
+ virtual CLSet get_causal_insertions(void) = 0;
};
/**
@@ -220,6 +231,10 @@ namespace SA_POP {
* @return ID of instance of this command.
*/
virtual TaskInstID get_task_inst (void) = 0;
+
+ virtual void set_satisfied_insts(TaskInstSet set)=0;
+
+ virtual void set_added_links(CLSet set) = 0;
};
/**
@@ -267,7 +282,7 @@ namespace SA_POP {
/**
* @param conds Set of open conditions to remove.
*/
- virtual void set_conds (const CondSet &conds) = 0;
+ virtual void set_conds (const CondSet &conds, const TaskInstSet &tasks) = 0;
};
/**
@@ -331,6 +346,10 @@ namespace SA_POP {
* @param threat The causal link threat to resolve.
*/
virtual void set_threat (CLThreat &threat) = 0;
+
+
+ virtual TaskInstID get_first_task(void) = 0;
+ virtual TaskInstID get_second_task(void)=0;
};
/**
diff --git a/SA_POP/PlanHeuristics.h b/SA_POP/PlanHeuristics.h
index 941e60089cf..7468e1458ee 100644
--- a/SA_POP/PlanHeuristics.h
+++ b/SA_POP/PlanHeuristics.h
@@ -48,6 +48,8 @@ namespace SA_POP {
* @return Next open condition to satisfy.
*/
virtual Condition choose_cond (const OpenCondMap &open_conds) = 0;
+ virtual Condition choose_cond_suspension (const OpenCondMap &open_conds) = 0;
+ virtual Condition choose_cond_suspension_most_constrained (const OpenCondMap &open_conds)=0;
protected:
/// Pointer to Planner object.
@@ -79,7 +81,15 @@ namespace SA_POP {
*
* @return Sorted list of tasks that satisfy given condition.
*/
- virtual TaskList choose_task (Condition open_cond) = 0;
+ virtual TaskChoiceList choose_task (Condition open_cond) = 0;
+
+ /// Choose the (ordering of) task(s) to satisfy an open condition. Better
+ /**
+ * @param open_cond Open condition to satisfy.
+ *
+ * @return Sorted list of tasks that satisfy given condition.
+ */
+ virtual TaskChoiceList choose_task_fair (Condition open_cond) = 0;
protected:
/// Pointer to Planner object.
diff --git a/SA_POP/Planner.cpp b/SA_POP/Planner.cpp
index d110a22ac9f..38b0e1f6337 100644
--- a/SA_POP/Planner.cpp
+++ b/SA_POP/Planner.cpp
@@ -49,6 +49,12 @@ cur_cmd_ (0)
this->plan_.sched_links.clear ();
this->plan_.task_insts.clear ();
this->plan_.threat_links.clear ();
+
+ this->not_backtracking.decision_pt = -1;
+ this->not_backtracking.seq_num = -1;
+ this->not_backtracking.step = -1;
+
+ this->backtrack_cmd = this->not_backtracking;
};
@@ -117,6 +123,7 @@ bool Planner::plan (size_t sa_max_steps, SA_POP::Goal goal)
// Set planning strategy goals and satisfy open conditions.
this->plan_strat_->set_goals (goal.goal_conds);
+
if (this->plan_strat_->satisfy_open_conds ()) {
this->plan_ = this->working_plan_->get_plan ();
this->notify_plan_changed ();
@@ -255,8 +262,11 @@ void Planner::undo_command (CommandID id)
throw msg;
}
+ PlanCommand* tmp = this->cur_cmd_;
this->cur_cmd_->undo ();
this->cur_cmd_ = this->cur_cmd_->get_prev ();
+
+ delete tmp;
};
// Add a command to be executed later with execute_next().
@@ -269,6 +279,14 @@ void Planner::add_command (PlanCommand *command)
// On current command, undo last execution (if any) & execute next option.
bool Planner::try_next (CommandID id)
{
+ if(this->backtrack_cmd != this->not_backtracking){
+ if(id != this->backtrack_cmd){
+ return false;
+ }else{
+ this->backtrack_cmd = this->not_backtracking;
+ }
+ }
+
if (this->cur_cmd_->get_id () != id) {
char char_buf[35];
sprintf(char_buf, "%d.%d.%d", id.step, id.decision_pt, id.seq_num);
@@ -299,6 +317,10 @@ void Planner::undo_through (CommandID id)
PlanCommand *temp = this->cur_cmd_;
temp->undo ();
this->cur_cmd_ = temp->get_prev ();
+
+ delete temp;
+
+
this->undo_through (id);
};
/// Get the current command id.
@@ -340,6 +362,10 @@ const GoalMap& Planner::get_goals (void)
// Get a task's name.
std::string Planner::get_task_name (TaskID task_id)
{
+ if(task_id == INIT_TASK_ID){
+ return "init task";
+ }
+
return this->sanet_->get_task_name (task_id);
};
@@ -378,6 +404,9 @@ CondSet Planner::get_unsat_preconds (TaskID task_id)
{
CondSet temp = this->get_preconds (task_id);
+ //Note: removed because when threats exist, it is wrong. Uses initial condition
+ ///instead
+ /*
// Remove satisfied preconditions.
for (CondSet::iterator iter = temp.begin ();
iter != temp.end (); )
@@ -394,6 +423,9 @@ CondSet Planner::get_unsat_preconds (TaskID task_id)
if (cur_prob > this->cond_prob_thresh_)
temp.erase (prev_iter);
}
+
+ */
+
return temp;
}
@@ -405,6 +437,11 @@ CondSet Planner::get_effects (TaskID task_id)
return this->sanet_->get_effects (task_id);
};
+SANet::LinkWeight Planner::get_link(SANet::TaskID id, SANet::CondID cond_ID)
+{
+ return this->sanet_->get_link(id, cond_ID);
+}
+
// Get all tasks that satisfy a condition.
TaskSet Planner::get_satisfying_tasks (Condition cond)
{
@@ -424,6 +461,11 @@ TaskID Planner::get_task_from_inst (TaskInstID inst_id)
return this->working_plan_->get_task_from_inst (inst_id);
};
+void Planner::generate_all_threats(void)
+{
+ this->working_plan_->generate_all_threats();
+}
+
// Get all current causal link threats.
CLThreatSet Planner::get_all_threats (void)
{
@@ -452,6 +494,11 @@ ResourceID resource_id)
// Get all resources used by a task implementation.
ResourceMap Planner::get_all_resources (TaskImplID impl_id)
{
+
+ if(impl_id == INIT_TASK_IMPL_ID){
+ return SA_POP::ResourceMap();
+ }
+
return this->task_map_->get_all_resources (impl_id);
};
diff --git a/SA_POP/Planner.h b/SA_POP/Planner.h
index 1c6cbc8ae3f..03efa10247a 100644
--- a/SA_POP/Planner.h
+++ b/SA_POP/Planner.h
@@ -39,6 +39,8 @@ namespace SA_POP {
*/
class Planner {
public:
+
+
/// Constructor.
Planner (void);
@@ -75,6 +77,8 @@ namespace SA_POP {
virtual void add_out_adapter (OutAdapter *out);
+ virtual void generate_all_threats(void);
+
// ************************************************************************
// Planning and changed planning info accessor methods.
@@ -153,7 +157,7 @@ namespace SA_POP {
/// Satisfy scheduling constraints in fully instantiated plan (no
/// recursive call backs).
/**
- * @param task_inst Current task instance being tried in the plan.
+ *
*
* @return True if fully satisfied plan found, false otherwise.
*/
@@ -320,6 +324,8 @@ namespace SA_POP {
*/
virtual CondSet get_effects (TaskID task_id);
+ SANet::LinkWeight get_link(SANet::TaskID id, SANet::CondID cond_ID);
+
/// Get all tasks that satisfy a condition.
/**
* @param cond_id The condition id.
@@ -509,6 +515,9 @@ namespace SA_POP {
*/
virtual void print_graph (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap);
+ virtual WorkingPlan* get_working_plan(void){return this->working_plan_;};
+
+ virtual void set_backtrack_cmd_id(CommandID cmd){backtrack_cmd = cmd;};
protected:
/// Threshold for current probability of a condition to be satisfied.
@@ -546,6 +555,10 @@ namespace SA_POP {
/// Notify all output adapters that plans have changed.
virtual void notify_plan_changed (void);
+
+ CommandID backtrack_cmd;
+
+ CommandID not_backtracking;
};
}; /* SA_POP namespace */
diff --git a/SA_POP/SANet/SANet.cpp b/SA_POP/SANet/SANet.cpp
index d87268acbc1..13b6275485c 100644
--- a/SA_POP/SANet/SANet.cpp
+++ b/SA_POP/SANet/SANet.cpp
@@ -71,6 +71,48 @@ void SANet::Network::add_task (TaskID ID, std::string name, MultFactor atten_fac
}
};
+Probability SANet::Network::get_prior(TaskID ID)
+{
+ TaskNodeMap::iterator task_iter = task_nodes_.find (ID);
+ if (task_iter == task_nodes_.end ()) {
+ throw UnknownNode ();
+ }
+ TaskNode *task_node = task_iter->second;
+
+ return task_node->get_prior();
+
+}
+
+LinkWeight SANet::Network::get_link(TaskID ID, CondID cond_ID)
+{
+ TaskNodeMap::iterator task_iter = task_nodes_.find (ID);
+ if (task_iter == task_nodes_.end ()) {
+ throw UnknownNode ();
+ }
+ TaskNode *task_node = task_iter->second;
+ SANet::LinkMap lmap = task_node->get_post();
+
+ LinkMap::iterator lIter =lmap.find(cond_ID);
+ if (task_iter == task_nodes_.end ()) {
+ throw UnknownNode ();
+ }
+ LinkWeight curWeight = lIter->second;
+
+ return curWeight;
+
+}
+
+void SANet::Network::update_prior(TaskID tID, Probability prior)
+{
+ TaskNodeMap::iterator task_iter = task_nodes_.find (tID);
+ if (task_iter == task_nodes_.end ()) {
+ throw UnknownNode ();
+ }
+ TaskNode *task_node = task_iter->second;
+
+ task_node->update_prior(prior);
+
+}
void SANet::Network::add_cond (CondID ID, std::string name, MultFactor atten_factor,
Probability true_prob, Probability false_prob,
@@ -181,54 +223,33 @@ void SANet::Network::update_effect_link(TaskID task_ID, CondID cond_ID,
};
-void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap)
+void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap, std::string defaultColor)
{
+ //Go through the task nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator titer = graphmap.find(node_iter->second->get_name());
- if(titer != graphmap.end())
- {
- if((*titer).second == "blue" )
- {
- (*titer).second = "cornflowerblue";
-
- }
- else if((*titer).second == "green")
- {
- (*titer).second = "red";
- }
- }
- else
+ if(titer == graphmap.end())
{
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[shape=box, style=filled, color = " << graphmap[node_iter->second->get_name()] <<"];\n";
}
+ //Go through the cond nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (CondNodeMap::iterator node_iter = cond_nodes_.begin ();
node_iter != cond_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator citer = graphmap.find(node_iter->second->get_name());
- if(citer != graphmap.end())
- {
- if((*citer).second == "blue" )
- {
- (*citer).second = "cornflowerblue";
-
- }
- else if((*citer).second == "green")
- {
- (*citer).second = "red";
- }
- }
- else
+ if(citer == graphmap.end())
{
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[style=filled, color = " << graphmap[node_iter->second->get_name()] << "];\n";
}
+ //Go through the effect and preconds for the task nodes and link them in the stream
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{
@@ -384,6 +405,7 @@ void SANet::Network::update (int max_steps)
}
}
}
+
};
// Update a condition's current value (probability of being true).
diff --git a/SA_POP/SANet/SANet.h b/SA_POP/SANet/SANet.h
index d4dc6baba88..7368037de24 100644
--- a/SA_POP/SANet/SANet.h
+++ b/SA_POP/SANet/SANet.h
@@ -67,6 +67,24 @@ namespace SANet {
virtual void add_task (TaskID ID, std::string name,
MultFactor atten_factor, TaskCost cost, Probability prior_prob);
+ /// Get a prior for the task node in the network.
+ /**
+ * @param ID Node ID.
+ *
+ *
+ * @returns Probability of the prior.
+ */
+ virtual Probability get_prior (TaskID ID);
+
+ /// Get a link weight for an effect in the network.
+ /**
+ * @param ID Task ID.
+ * @param ID Cond ID.
+ *
+ * @returns LinkWeight of the link.
+ */
+ virtual LinkWeight get_link(TaskID ID, CondID cond_ID);
+
/// Add a new condition node to the network.
/**
* @param ID Node ID.
@@ -132,9 +150,19 @@ namespace SANet {
* @param port_ID ID of port (on task) associated with this condition
* (used for data nodes).
*/
- void update_effect_link(TaskID task_ID, CondID cond_ID,
+ virtual void update_effect_link(TaskID task_ID, CondID cond_ID,
LinkWeight weight, PortID port_ID= "");
+ /// Update the task prior.
+ /**
+ *
+ * @param task_ID Task node ID.
+ *
+ *
+ * @param prior new prior to be used for the task;
+ */
+ virtual void update_prior(TaskID task_ID, Probability prior);
+
// ************************************************************************
// Print methods.
@@ -152,8 +180,10 @@ namespace SANet {
/// Print Graphviz network representation to stream.
/**
* @param strm Output stream on which to print network representation.
+ * @param graphmap The color mapping being used.
+ * @param defaultColor The default color if it's not in the mapping.
*/
- virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap);
+ virtual void print_graphviz (std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap, std::string defaultColor = "grey");
diff --git a/SA_POP/SANet/SANetFileIn.cpp b/SA_POP/SANet/SANetFileIn.cpp
index 6419004b6ea..3cb6b0f347a 100644
--- a/SA_POP/SANet/SANetFileIn.cpp
+++ b/SA_POP/SANet/SANetFileIn.cpp
@@ -192,6 +192,8 @@ void SANetFileIn::build_net (std::string filename, SA_POP::Builder *builder)
builder->add_task (nodeID, priorProb, name);
}
+
+ // builder->add_task(SA_POP::INIT_TASK_ID, .5, "initact");
// Get condition nodes.
for (SANet::XML::Network::condNode_iterator iter = xml_net.begin_condNode ();
@@ -212,6 +214,8 @@ void SANetFileIn::build_net (std::string filename, SA_POP::Builder *builder)
else if(cond_kind==cond_kind.SYSTEM) cond=::SA_POP::SYSTEM;
else cond=::SA_POP::DATA;
builder->add_cond (nodeID, utility, probTrue, name, cond);
+
+// builder->set_effect(SA_POP::INIT_TASK_ID, nodeID, "", (probTrue-.5)*2);
}
// Get precondition->task links.
diff --git a/SA_POP/SANet/SANode.cpp b/SA_POP/SANet/SANode.cpp
index 3333c029b91..3bc88337ad3 100644
--- a/SA_POP/SANet/SANode.cpp
+++ b/SA_POP/SANet/SANode.cpp
@@ -120,6 +120,14 @@ TaskNode::~TaskNode (void)
// Nothing to do.
};
+Utility_Info TaskNode::get_pos_util(void){
+ return this->pos_util_;
+}
+
+void TaskNode::set_pos_util(double util){
+ this->pos_util_.utility = util;
+}
+
bool TaskNode::update (void)
{
// Reset change flags.
@@ -409,6 +417,11 @@ bool TaskNode::update (void)
// Update step (at end of step for task node).
step_++;
+// if(this->ID_ == 20){
+// this->pos_util_.utility = 100;
+// }
+
+
// Return boolean changed value based on change flags.
return (prob_changed_ || util_changed_);
@@ -729,6 +742,15 @@ void TaskNode::update_effect (CondID ID, CondNode *node, LinkWeight weight)
node->update_pre_link (ID_, this, weight);
};
+Probability TaskNode::get_prior (void)
+{
+ return prior_prob_;
+}
+
+void TaskNode::update_prior (Probability prior)
+{
+ prior_prob_ = prior;
+}
CondNode::CondNode (CondID ID, std::string name, MultFactor atten_factor,
Probability true_prob, Probability false_prob, Utility goal_util, CondKind condkind)
diff --git a/SA_POP/SANet/SANode.h b/SA_POP/SANet/SANode.h
index 75e12221948..f478d6887b0 100644
--- a/SA_POP/SANet/SANode.h
+++ b/SA_POP/SANet/SANode.h
@@ -156,6 +156,7 @@ namespace SANet {
virtual void print_xml (std::basic_ostream<char, std::char_traits<char> >& strm) = 0;
+
protected:
/// Unique ID of node (for identification within network).
NodeID ID_;
@@ -281,6 +282,23 @@ namespace SANet {
*/
virtual Utility get_utility (int step);
+ /// Get Prior of the TaskNode.
+ /**
+ *
+ *
+ * @return Expected utility.
+ */
+ virtual Probability get_prior (void);
+
+ /// Update Prior of the TaskNode.
+ /**
+ *
+ * @param prior the new prior for the task
+ *
+ *
+ */
+ virtual void update_prior (Probability prior);
+
/// Add precondition link.
/**
* @param ID Node ID.
@@ -318,6 +336,11 @@ namespace SANet {
*/
virtual void update_effect (CondID ID, CondNode *node, LinkWeight weight);
+ void set_pos_util(double util);
+
+ Utility_Info get_pos_util();
+
+
protected:
/// Unconditional prior probability of success.
Probability prior_prob_;
diff --git a/SA_POP/SAPOP_w_ACE.mpc b/SA_POP/SAPOP_w_ACE.mpc
index 7b43ed85896..e53cc8164d6 100644
--- a/SA_POP/SAPOP_w_ACE.mpc
+++ b/SA_POP/SAPOP_w_ACE.mpc
@@ -21,6 +21,8 @@ project(SA_POP) : xerces, acelib, sapop_xml, sapop_out {
SA_POP_Types.h
SA_POP_Exceptions.h
+ SA_POP_Utils.h
+
Builder.h
SA_Builder.h
@@ -58,6 +60,8 @@ project(SA_POP) : xerces, acelib, sapop_xml, sapop_out {
Source_Files {
SA_POP_Exceptions.cpp
+ SA_POP_Utils.cpp
+
SA_Builder.cpp
Planner.cpp
diff --git a/SA_POP/SA_POP_Types.h b/SA_POP/SA_POP_Types.h
index 18bda7b3669..662bbb95192 100644
--- a/SA_POP/SA_POP_Types.h
+++ b/SA_POP/SA_POP_Types.h
@@ -3,51 +3,70 @@
//=============================================================================
/**
- * @file SA_POP_Types.h
- *
- * This file contains the definitions of types used throughout SA-POP.
- *
- * @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
- */
+* @file SA_POP_Types.h
+*
+* This file contains the definitions of types used throughout SA-POP.
+*
+* @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
+*/
//=============================================================================
#ifndef SA_POP_TYPES_H_
#define SA_POP_TYPES_H_
+
#include <string>
#include <set>
#include <list>
#include <map>
#include <sstream>
+#include <iostream>
+
+#include "SA_POP_Utils.h"
#if defined (SA_POP_HAS_ACE)
#include "ace/Log_Msg.h"
#include "ace/Log_Priority.h"
#endif /* SA_POP_HAS_ACE */
+
+#define SA_POP_DEBUG_MINIMAL 2
#define SA_POP_DEBUG_NORMAL 5
-#define SA_POP_DEBUG_HIGH 10
+#define SA_POP_DEBUG_VERBOSE 10
+#define SA_POP_DEBUG_HIGH 15
+// SET current SA-POP Debug output level.
+#define SA_POP_DEBUG_LEVEL SA_POP_DEBUG_MINIMAL
+
+#define _CRTDBG_MAP_ALLOC
#if defined (SA_POP_HAS_ACE)
#define SA_POP_DEBUG(x,y) \
-if (x > 0) \
-ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("SA-POP: %s\n"), y));
+if (x <= SA_POP_DEBUG_LEVEL) \
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("SA-POP: %s\n"), y));
#define SA_POP_DEBUG_STR(x,y) \
-if (x > 0) \
-ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("SA-POP: %s\n"), y.c_str ()));
+if (x <= SA_POP_DEBUG_LEVEL) \
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("SA-POP: %s\n"), y.c_str ()));
#else /* SA_POP_HAS_ACE not defined */
#include <iostream>
#define SA_POP_DEBUG(x,y) \
-if (x > 0) \
+if (x <= SA_POP_DEBUG_LEVEL) \
std::cout << "SA-POP: " << y << std::endl;
#define SA_POP_DEBUG_STR(x,y) \
-if (x > 0) \
+if (x <= SA_POP_DEBUG_LEVEL) \
std::cout << "SA-POP: " << y << std::endl;
#endif /* SA_POP_HAS_ACE */
namespace SA_POP {
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ /// MAXIMUM number of task instances to allow in plan before planning failure.
+ const int MAX_TASK_INSTS = 12;
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+
+
+
+
/// Environment variable for root path.
const std::string ROOT_PATH_STR = "SAPOP_ROOT";
@@ -73,7 +92,7 @@ namespace SA_POP {
CondID id;
CondValue value;
CondKind kind;
- bool operator== (const Condition &s) const { return this->id == s.id; };
+ bool operator== (const Condition &s) const { return this->id == s.id && this->value == s.value; };
bool operator!= (const Condition &s) const { return !(*this == s); };
bool operator< (const Condition &s) const { return this->id < s.id; };
};
@@ -98,7 +117,7 @@ namespace SA_POP {
/// (N.B. this must be a double or float to handle [0,1] range probabilities
/// and multiplication factors).
typedef double EUCalc;
-
+
/// Type of a condition utility.
typedef EUCalc Utility;
@@ -141,7 +160,7 @@ namespace SA_POP {
/// Type of a task instance id.
/// (must be unique across all task instances).
- typedef int TaskInstID;
+ typedef long TaskInstID;
/// Goal task instance ID (for task instance placeholders in open goals).
const TaskInstID GOAL_TASK_INST_ID = -1;
@@ -149,6 +168,12 @@ namespace SA_POP {
/// Null task instance ID (for unknown/uninitialized task instances).
const TaskInstID NULL_TASK_INST_ID = -2;
+ /// Initial state (as task) ID (for placeholder in planning).
+ const TaskID INIT_TASK_ID = -5;
+
+ /// Initial state (as task) instance ID (for placeholder in planning).
+ const TaskInstID INIT_TASK_INST_ID = -6;
+
/// Type of a task implementation id.
/// (must be unique across all task implementations).
typedef std::string TaskImplID;
@@ -164,6 +189,53 @@ namespace SA_POP {
/// Type of a task implementation parameter value.
typedef std::string ImplParamValue;
+ enum TaskChoiceType{REUSE_INST, NEW_INST};
+ struct TaskChoice {
+
+ TaskChoiceType choice;
+ TaskInstID task_inst_id;
+ TaskID task_id;
+ };
+
+
+ /// Initial state (as task) implementation ID (for placeholder in planning/scheduling).
+ const TaskImplID INIT_TASK_IMPL_ID = "init_impl";
+
+
+ /// List of TaskChoices
+ typedef std::list<TaskChoice> TaskChoiceList;
+
+ /// Map from Task Instance IDs to Task IDs.
+ typedef std::map <TaskInstID, TaskID> InstToTaskMap;
+
+
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ // WHAT DOES THIS STRUCT DO / HOW IS IT USED?
+ struct SortTaskByTime{
+
+ TaskID task_id;
+ TaskInstID last_instance;
+
+ void note_instance(TaskInstID instance){
+ if (last_instance < instance){
+ this->last_instance = instance;
+ }
+ }
+
+ // IS THE LESS THAN OPERATOR REALLY SUPPOSED TO COMPARE INSTANCES BY GREATER THAN?
+ bool operator<(const SortTaskByTime & s) {
+ return this->last_instance > s.last_instance;
+ }
+ bool operator!=(const SortTaskByTime & s) {
+ return this->last_instance != s.last_instance;
+ }
+ bool operator==(const SortTaskByTime & s) {
+ return this->last_instance == s.last_instance;
+ }
+ };
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+
+
/// Type of an implementation parameter.
struct ImplParam {
@@ -179,6 +251,7 @@ namespace SA_POP {
/// (must be unique across all resources).
typedef std::string ResourceID;
+ /// Null resource ID (for unknown resources).
const ResourceID NULL_RESOURCE_ID = "NULL_RESOURCE_ID";
/// Type of a resource capacity or utilization value.
@@ -203,7 +276,7 @@ namespace SA_POP {
typedef long TimeValue;
/// NULL time (for unknown or unconstrained times).
- #define NULL_TIME -1
+ const TimeValue NULL_TIME = -1;
/// Time Window (e.g. start or end window for a task instance or plan).
typedef std::pair<SA_POP::TimeValue, SA_POP::TimeValue> TimeWindow;
@@ -215,9 +288,9 @@ namespace SA_POP {
int step;
int decision_pt;
int seq_num;
- bool operator== (CommandID &s) const { return (this->step == s.step && this->decision_pt == s.decision_pt && this->seq_num == s.seq_num); };
- bool operator!= (CommandID &s) const { return !(*this == s); };
- bool operator< (CommandID &s) const
+ bool operator== (const CommandID &s) const { return (this->step == s.step && this->decision_pt == s.decision_pt && this->seq_num == s.seq_num); };
+ bool operator!= (const CommandID &s) const { return !(*this == s); };
+ bool operator< (const CommandID &s) const
{
if (this->step == s.step) {
if (this->decision_pt == s.decision_pt)
@@ -228,6 +301,7 @@ namespace SA_POP {
};
};
+
/// Type of a causal link.
/// ("first" task instance achieves "cond" for "second" task instance.)
struct CausalLink {
@@ -240,7 +314,7 @@ namespace SA_POP {
{
if (this->first == s.first) {
if (this->second == s.second)
- return this->cond < cond;
+ return this->cond < s.cond;
return this->second < s.second;
}
return this->first < s.first;
@@ -293,15 +367,13 @@ namespace SA_POP {
/// Type of a set of resources (map from id to resource).
typedef std::map<ResourceID, Resource> Resources;
- /// Type of Criticality as a pair of the Resource it is in and the value.
- typedef std::pair<ResourceID,double> Criticality;
+ /// Type of Criticality as a pair of the Resource it is in and the value.
+ typedef std::pair<ResourceID,double> Criticality;
- /// Type of a set of conditions (condition & value).
+ /// Type of a set of conditions (condition & value).
typedef std::set<Condition> CondSet;
- /// Type of a set of open conditions, each associated with task instances
- /// for which it is a precondition.
- typedef std::multimap<Condition, TaskInstID> OpenCondMap;
+
/// Type of a set of causal link threats.
typedef std::set<CLThreat> CLThreatSet;
@@ -460,6 +532,217 @@ namespace SA_POP {
bool operator< (const Goal &s) const { return this->goal_id < s.goal_id; };
};
+
+ struct TaskInstEndTimeSet{
+ TaskInstID inst;
+ double end_time;
+
+ bool operator< (const TaskInstEndTimeSet & compare) const{
+ return end_time < compare.end_time;
+ };
+ };
+
+
+ /// Type of particular Task Implementation mapped to a Task Implementation Set.
+ /// This is a particular Precedence set. Like Before, After etc.
+ typedef std::map <TaskInstID, TaskInstSet> PrecedenceSet;
+
+ /// Type of a Precedence Relation mapped to a Precedence Set.
+ /// This gives the whole Precedence Graph
+ typedef std::map <PrecedenceRelation, PrecedenceSet> PrecedenceGraph;
+
+
+ /// Type of a set of open conditions, each associated with task instances
+ /// for which it is a precondition. With new list functionality
+ typedef SA_POP::ListMultiMap<Condition, TaskInstID> OpenCondMap;
+
+
+ //Following structures form the condition-checking heuristic we use; if a task satisfies a condition for a
+ //instance task once, it cannot satisfy another instance of that task unless some of the open conditions open
+ //when it was first used
+
+ struct StoredCondition{
+
+ Condition satisfied_cond;
+ TaskID satisfying_task;
+ bool satisfied_to;
+
+ StoredCondition(){};
+
+ StoredCondition(Condition cond, TaskID task){
+ this->satisfied_cond = cond;
+ this->satisfied_to = cond.value;
+ this->satisfying_task = task;
+ }
+
+ bool operator==(const StoredCondition & s)const{
+ return (satisfied_cond == s.satisfied_cond &&
+ satisfying_task == s.satisfying_task &&
+ satisfied_to == s.satisfied_to);
+ };
+
+ bool operator<(const StoredCondition & s) const{
+ if(this->satisfied_cond == s.satisfied_cond)
+ return this->satisfying_task < s.satisfying_task;
+ return this->satisfied_cond < s.satisfied_cond;
+ };
+ };
+
+ struct StoredConditionKey{
+
+ CommandID satisfying_cmd;
+ CommandID free_pass_cmd;
+
+ StoredCondition satisfy_set;
+ bool free_pass_used;
+
+ StoredConditionKey(Condition cond, TaskID task, CommandID cmd){
+ satisfying_cmd = cmd;
+ satisfy_set.satisfied_cond = cond;
+ satisfy_set.satisfying_task = task;
+
+ free_pass_cmd.decision_pt = 0;
+ free_pass_cmd.step = 0;
+ free_pass_cmd.seq_num = 0;
+
+ free_pass_used = false;
+ }
+
+ bool operator==(const StoredConditionKey & s)const{
+ return (this->satisfy_set == s.satisfy_set);
+ };
+
+ bool operator<(const StoredConditionKey & s) const {
+ return this->satisfy_set < s.satisfy_set;
+ };
+
+ };
+
+
+
+ typedef std::set<StoredCondition> StoredConditionSet;
+ typedef std::multimap<StoredConditionKey, StoredConditionSet> StoredConditionMap;
+
+ struct StoredConditionEvaluator{
+ StoredConditionMap condition_map;
+
+ std::pair<bool, CommandID> should_continue(CommandID cur_cmd, Condition satisfied_cond,
+ TaskID satisfying_task, OpenCondMap & open_conds, InstToTaskMap & task_insts){
+
+ StoredConditionKey stored_cond (satisfied_cond, satisfying_task, cur_cmd);
+
+ std::pair<StoredConditionMap::iterator,
+ StoredConditionMap::iterator>
+ range
+ = condition_map.equal_range(stored_cond);
+
+ bool should_continue = true;
+ CommandID return_to;
+ return_to.decision_pt = 0;
+ return_to.seq_num = 0;
+ return_to.step = 0;
+
+
+ bool using_free_pass = false;
+
+ if(range.first != range.second)
+ {
+ for(StoredConditionMap::iterator it = range.first; it != range.second; it++)
+ {
+ bool all_pairs_in_open_conds = true;
+
+ StoredConditionSet old_open_conds = it->second;
+
+ for(StoredConditionSet::iterator it2 = old_open_conds.begin();
+ it2 != old_open_conds.end(); it2++)
+ {
+
+
+ std::pair<OpenCondMap::iterator, OpenCondMap::iterator>
+ cond_map_range = open_conds.equal_range((*it2).satisfied_cond);
+
+ bool found_no_equiv_in_open = true;
+
+ for(OpenCondMap::iterator it3 = cond_map_range.first; it3 != cond_map_range.second; it3++){
+ if((*it2).satisfying_task == -1){
+ if((*it3).second == -1){
+ found_no_equiv_in_open = false;
+ }
+ }
+ else{
+ if((*it3).second == -1)
+ {}
+ else if((*it2).satisfying_task == task_insts.find((*it3).second)->second &&
+ (*it2).satisfied_to == ((*it3).first).value){
+ found_no_equiv_in_open = false;
+ }
+ }
+ }
+
+ if(found_no_equiv_in_open){
+ all_pairs_in_open_conds = false;
+ break;
+ }
+ }
+
+ if(all_pairs_in_open_conds){
+
+ should_continue = false;
+ return_to = it->first.satisfying_cmd;
+ break;
+ }
+ }
+ }else{
+ should_continue = true;
+ }
+
+ if(should_continue && !using_free_pass)
+ {
+
+ StoredConditionSet current_open;
+ for(OpenCondMap::iterator it = open_conds.begin(); it != open_conds.end(); it++)
+ {
+ if(it->second == -1)
+ {
+ current_open.insert(StoredCondition(it->first, -1));
+ }else{
+ current_open.insert(StoredCondition(it->first, task_insts.find(it->second)->second));
+ }
+ }
+
+ StoredConditionKey this_choice(satisfied_cond, satisfying_task, cur_cmd);
+
+ this->condition_map.insert(
+ std::pair<StoredConditionKey, StoredConditionSet>(this_choice, current_open));
+ }
+
+ return std::pair<bool, CommandID>(should_continue, return_to);
+ }
+
+ void undo_binding(CommandID cur_cmd, Condition satisfied_cond, TaskID satisfying_task){
+ StoredConditionKey key(satisfied_cond, satisfying_task, cur_cmd);
+
+ std::pair<StoredConditionMap::iterator, StoredConditionMap::iterator> range
+ = condition_map.equal_range(key);
+
+ StoredConditionMap::iterator it;
+
+ for(it = range.first; it != range.second; it++){
+ if(it->first.satisfying_cmd == cur_cmd){
+ condition_map.erase(it);
+ break;
+ }
+ }
+ }
+ };
+
+ //Map from a causal link to the suspended conditions that are waiting for something to come
+ //between them and the orig. condition so they can be unsuspended
+ typedef std::multimap<CausalLink, std::pair<Condition, TaskInstID>> SuspendedConditionListenerMap;
+
+ //List of all condition/task insts that are suspended
+ typedef std::set<std::pair<Condition, TaskInstID>> SuspendedConditionSet;
+
inline std::string to_string(int x)
{
std::ostringstream o;
diff --git a/SA_POP/SA_POP_Utils.cpp b/SA_POP/SA_POP_Utils.cpp
new file mode 100644
index 00000000000..e018ccc3109
--- /dev/null
+++ b/SA_POP/SA_POP_Utils.cpp
@@ -0,0 +1,352 @@
+//
+// $Id$
+//
+
+//=============================================================================
+/**
+ * @file SA_POP_Types.cpp
+ *
+ * This file contains the implementation of class types used throughout SA-POP.
+ *
+ * @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef SA_POP_UTILS_CPP_
+#define SA_POP_UTILS_CPP_
+
+#include "SA_POP_Utils.h"
+
+//using namespace SA_POP;
+
+template<typename L, typename T>
+SA_POP::ListMultiMap<L,T>::ListMultiMap (SA_POP::FrontBack append_direction, SA_POP::FrontBack remove_direction)
+: append_dir_ (append_direction),
+remove_dir_(remove_direction)
+{
+ multimap_.clear();
+ list_.clear ();
+};
+
+
+// Map Insert
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::iterator SA_POP::ListMultiMap<L,T>::insert(const typename SA_POP::ListMultiMap<L,T>::value_type val)
+{
+
+ if(append_dir_ == SA_POP::BACK)
+ {
+ this->list_.push_back(val);
+ }
+ else if(append_dir_ == SA_POP::FRONT)
+ {
+ this->list_.push_front(val);
+ }
+ else
+ {
+ throw "ListMultiMap<L,T>::iterator ListMultiMap<L,T>::insert(const typename ListMultiMap<L,T>::value_type val): Unknown direction to append.";
+ }
+
+ return this->multimap_.insert (val);
+
+
+};
+
+
+// Map Erase
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::size_type SA_POP::ListMultiMap<L,T>::erase(const typename SA_POP::ListMultiMap<L,T>::key_type& key)
+{
+
+ //Removal all list items with matching key in the pair
+
+ for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
+ {
+ SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
+ l_iter++;
+ if((*prev_iter).first == key)
+ {
+ this->list_.erase(prev_iter);
+ }
+ }
+
+
+ return this->multimap_.erase (key);
+};
+
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::iterator _Where)
+{
+ if(_Where != this->end())
+ {
+ //Removal first or last list items with matching key in the pair
+ if(remove_dir_ == SA_POP::FRONT)
+ {
+ for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
+ {
+ SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
+ l_iter++;
+ if((*prev_iter).first == _Where->first && (*prev_iter).second == _Where->second )
+ {
+ this->list_.erase(prev_iter);
+ break;
+ }
+ }
+ }
+ else if(remove_dir_ == SA_POP::BACK)
+ {
+ SA_POP::ListMultiMap<L,T>::list_iterator last_iter = list_.end();
+ for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();l_iter++)
+ {
+ if((*l_iter).first == _Where->first && (*l_iter).second == _Where->second)
+ {
+ last_iter = l_iter;
+ }
+ }
+ if(last_iter != list_.end())
+ {
+ this->list_.erase(last_iter);
+ }
+ else
+ {
+ throw "ListMultiMap<L,T>::erase(typename ListMultiMap<L,T>::iterator _Where) : Could not find value in the list";
+ }
+ }
+ else
+ {
+ throw "ListMultiMap<L,T>::erase(typename ListMultiMap<L,T>::iterator _Where): Unknown direction to remove.";
+ }
+ }
+ this->multimap_.erase (_Where);
+};
+
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::iterator _First, typename SA_POP::ListMultiMap<L,T>::iterator _Last)
+{
+
+ //iterate through the range [_First, _Last) and erasing each iterator in turn
+ if(_First != this->end())
+ {
+ for(SA_POP::ListMultiMap<L,T>::iterator m_iter = _First; m_iter != _Last;)
+ {
+ SA_POP::ListMultiMap<L,T>::iterator prev_iter = m_iter;
+ m_iter++;
+ this->erase(prev_iter);
+ }
+ }
+
+};
+
+// Begin
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::iterator SA_POP::ListMultiMap<L,T>::begin()
+{
+ return this->multimap_.begin ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_iterator SA_POP::ListMultiMap<L,T>::begin() const
+{
+ return this->multimap_.begin ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::reverse_iterator SA_POP::ListMultiMap<L,T>::rbegin()
+{
+ return this->multimap_.rbegin ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_reverse_iterator SA_POP::ListMultiMap<L,T>::rbegin() const
+{
+ return this->multimap_.rbegin ();
+};
+
+// End
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::iterator SA_POP::ListMultiMap<L,T>::end()
+{
+ return this->multimap_.end ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_iterator SA_POP::ListMultiMap<L,T>::end() const
+{
+ return this->multimap_.end ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::reverse_iterator SA_POP::ListMultiMap<L,T>::rend()
+{
+ return this->multimap_.rend ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_reverse_iterator SA_POP::ListMultiMap<L,T>::rend() const
+{
+ return this->multimap_.rend ();
+};
+
+// Lower Bound
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::iterator SA_POP::ListMultiMap<L,T>::lower_bound(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval)
+{
+ return this->multimap_.lower_bound (_Keyval);
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_iterator SA_POP::ListMultiMap<L,T>::lower_bound(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval) const
+{
+ return this->multimap_.lower_bound (_Keyval);
+};
+
+// Upper Bound
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::iterator SA_POP::ListMultiMap<L,T>::upper_bound(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval)
+{
+ return this->multimap_.upper_bound (_Keyval);
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_iterator SA_POP::ListMultiMap<L,T>::upper_bound(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval) const
+{
+ return this->multimap_.upper_bound (_Keyval);
+
+};
+
+// Size
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::size_type SA_POP::ListMultiMap<L,T>::size() const
+{
+ return this->multimap_.size ();
+};
+
+// Empty?
+template<typename L, typename T>
+bool SA_POP::ListMultiMap<L,T>::empty() const
+{
+ return this->multimap_.empty ();
+};
+
+///Count
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::size_type SA_POP::ListMultiMap<L,T>::count(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval) const
+{
+ return this->multimap_.count (_Keyval);
+};
+
+///Clear
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::clear()
+{
+ this->multimap_.clear ();
+ this->list_.clear ();
+};
+
+///Equal Range
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::_Pairii SA_POP::ListMultiMap<L,T>::equal_range(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval)
+{
+ return this->multimap_.equal_range (_Keyval);
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::_Paircc SA_POP::ListMultiMap<L,T>::equal_range(const typename SA_POP::ListMultiMap<L,T>::key_type& _Keyval) const
+{
+ return this->multimap_.equal_range (_Keyval);
+};
+
+//List Functions
+
+///Erase
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::list_iterator SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::list_iterator _Where)
+{
+ // Erase from the multimap
+ if(_Where != list_.end())
+ {
+
+ for (std::multimap<L, T>::iterator m_iter = multimap_.lower_bound ((*_Where).first);m_iter != multimap_.upper_bound ((*_Where).first);)
+ {
+ std::multimap<L, T>::iterator prev_iter = m_iter;
+ m_iter++;
+
+ if(prev_iter->second == (*_Where).second)
+ {
+ this->multimap_.erase(prev_iter);
+ break;
+ }
+ }
+
+ }
+
+ return this->list_.erase(_Where);
+
+};
+
+///Front
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::list_reference SA_POP::ListMultiMap<L,T>::front()
+{
+ return this->list_.front ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_list_reference SA_POP::ListMultiMap<L,T>::front() const
+{
+ return this->list_.front ();
+};
+
+///Back
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::list_reference SA_POP::ListMultiMap<L,T>::back()
+{
+ return this->list_.back ();
+};
+
+template<typename L, typename T>
+typename SA_POP::ListMultiMap<L,T>::const_list_reference SA_POP::ListMultiMap<L,T>::back() const
+{
+ return this->list_.back ();
+};
+
+///Push Front
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::push_front(const typename SA_POP::ListMultiMap<L,T>::list_Ty& _Val)
+{
+
+ this->multimap_.insert(_Val);
+ this->list_.push_front (_Val);
+};
+
+///Pop Front
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::pop_front()
+{
+
+ //This will erase the front item in both list and multimap.
+ this->erase(this->list_.begin());
+
+};
+
+///Push Back
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::push_back(const typename SA_POP::ListMultiMap<L,T>::list_Ty& _Val)
+{
+
+ this->multimap_.insert(_Val);
+
+ this->list_.push_back (_Val);
+};
+
+///Pop Back
+template<typename L, typename T>
+void SA_POP::ListMultiMap<L,T>::pop_back()
+{
+ //This will erase the back item in both list and multimap.
+ SA_POP::ListMultiMap<L,T>::list_iterator l_iter= -- this->list_.end();
+ this->erase(l_iter);
+};
+
+
+#endif /* SA_POP_UTILS_CPP_ */
diff --git a/SA_POP/SA_POP_Utils.h b/SA_POP/SA_POP_Utils.h
new file mode 100644
index 00000000000..95476087956
--- /dev/null
+++ b/SA_POP/SA_POP_Utils.h
@@ -0,0 +1,177 @@
+
+#ifndef SA_POP_UTILS_H_
+#define SA_POP_UTILS_H_
+
+//=============================================================================
+/**
+ * @file SA_POP_Utils.h
+ *
+ * This file contains the definitions of classes that are utilized in SA_POP.
+ *
+ * @author Daniel L.C. Mack <daniel.l.mack@vanderbilt.edu>
+ */
+//=============================================================================
+
+#include <string>
+#include <set>
+#include <list>
+#include <map>
+#include <sstream>
+
+
+namespace SA_POP {
+
+ /// Enumerated type for front or back (appending to an ordered list).
+ enum FrontBack {FRONT, BACK};
+
+
+ /**
+ * @class ListMultiMap
+ *
+ * @brief A mulitmap that also contains a list for ordering operations
+ *
+ */
+ template<typename L, typename T> class ListMultiMap {
+ public:
+
+
+ typedef std::multimap<L, T> _multimap;
+ typedef std::list<std::pair<L, T> > _list;
+
+
+ typedef typename _multimap::key_type key_type;
+ typedef typename _multimap::mapped_type mapped_type;
+ typedef typename _multimap::referent_type referent_type; // retained
+ typedef typename _multimap::key_compare key_compare;
+
+ typedef typename _multimap::value_compare value_compare;
+ typedef typename _multimap::allocator_type allocator_type;
+ typedef typename _multimap::size_type size_type;
+ typedef typename _multimap::difference_type difference_type;
+ typedef typename _multimap::pointer pointer;
+ typedef typename _multimap::const_pointer const_pointer;
+ typedef typename _multimap::reference reference;
+ typedef typename _multimap::const_reference const_reference;
+ typedef typename _multimap::iterator iterator;
+ typedef typename _multimap::const_iterator const_iterator;
+ typedef typename _multimap::reverse_iterator reverse_iterator;
+ typedef typename _multimap::const_reverse_iterator
+ const_reverse_iterator;
+ typedef typename _multimap::value_type value_type;
+ typedef typename _multimap::_Pairib _Pairib;
+ typedef typename _multimap::_Pairii _Pairii;
+ typedef typename _multimap::_Paircc _Paircc;
+
+
+ ///TypeDefs for the List
+ typedef typename std::pair<L, T> list_Ty;
+ typedef typename _list::iterator list_iterator;
+ typedef typename _list::const_iterator const_list_iterator;
+ typedef typename _list::reverse_iterator reverse_list_iterator;
+ typedef typename _list::const_reverse_iterator
+ const_reverse_list_iterator;
+ typedef typename _list::reference list_reference;
+ typedef typename _list::const_reference const_list_reference;
+
+ //Needs to take an enumerated type for list direction.
+ ///Constuctor
+ ListMultiMap(SA_POP::FrontBack append_direction = BACK, SA_POP::FrontBack remove_direction = FRONT);
+
+ ///Destructor
+ virtual ~ListMultiMap() { };
+
+ ///Map Insert
+ iterator insert(const value_type val);
+
+ ///Map Erase
+ size_type erase(const key_type& key);
+ void erase(iterator _Where);
+ void erase(iterator _First, iterator _Last);
+
+ ///Begin
+ iterator begin();
+
+ const_iterator begin() const;
+
+ reverse_iterator rbegin();
+
+ const_reverse_iterator rbegin() const;
+
+ ///End
+ iterator end();
+
+ const_iterator end() const;
+
+ reverse_iterator rend();
+
+ const_reverse_iterator rend() const;
+
+ ///Lower Bound
+ iterator lower_bound(const key_type& _Keyval);
+
+ const_iterator lower_bound(const key_type& _Keyval) const;
+
+ ///Upper Bound
+ iterator upper_bound(const key_type& _Keyval);
+
+ const_iterator upper_bound(const key_type& _Keyval) const;
+
+ /// Size
+ size_type size() const;
+
+ ///Empty?
+ bool empty() const;
+
+ ///Count
+ size_type count(const key_type& _Keyval) const;
+
+ ///Clear
+ void clear();
+
+ ///Equal Range
+ _Pairii equal_range(const key_type& _Keyval);
+ _Paircc equal_range(const key_type& _Keyval) const;
+
+ //List Functions
+ ///Erase
+ list_iterator erase(list_iterator _Where);
+
+ ///Front
+ list_reference front();
+ const_list_reference front() const;
+ ///Back
+ list_reference back();
+ const_list_reference back() const;
+
+ ///Push Front
+ void push_front(const list_Ty& _Val);
+
+ ///Pop Front
+ void pop_front();
+
+ ///Push Back
+ void push_back(const list_Ty& _Val);
+
+ ///Pop Back
+ void pop_back();
+
+
+
+
+
+
+ private:
+
+ SA_POP::FrontBack append_dir_;
+ SA_POP::FrontBack remove_dir_;
+ std::multimap<L, T> multimap_;
+ std::list<std::pair<L, T> > list_;
+
+
+ };
+
+}
+
+#include "SA_POP_Utils.cpp"
+
+#endif /* SA_POP_UTILS_H_ */ \ No newline at end of file
diff --git a/SA_POP/SA_PlanCommands.cpp b/SA_POP/SA_PlanCommands.cpp
index fe95276c2ae..5330e4ba280 100644
--- a/SA_POP/SA_PlanCommands.cpp
+++ b/SA_POP/SA_PlanCommands.cpp
@@ -18,6 +18,8 @@
#include "SA_PlanStrategy.h"
#include <string>
#include <stdlib.h>
+#include <fstream>
+#include <iostream>
using namespace SA_POP;
@@ -178,13 +180,20 @@ PlanCommand *SA_AddTaskCmd::clone (void)
// Execute next option for this command.
bool SA_AddTaskCmd::execute_next (void)
{
+
SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+
this->undo();
- if (this->tasks_.empty ())
+
+ bool isInitial = false;
+
+ if (this->tasks_.empty())
return false;
+
this->working_plan_->execute (this);
this->num_tries_++;
+
return true;
};
@@ -210,17 +219,17 @@ std::string SA_AddTaskCmd::get_log_text (void)
log_str += "Adding Task (CommandID ";
log_str += to_string (this->get_id ());
log_str += "): ";
- TaskList::iterator task_iter = this->tasks_.begin ();
+ TaskChoiceList::iterator task_iter = this->tasks_.begin ();
if (task_iter == this->tasks_.end ())
log_str += "[NO TASKS TO ADD]";
else
- log_str += to_string (*task_iter);
+ log_str += to_string (task_iter->task_id);
return log_str;
};
// Set (ordered) list of tasks to add (one per execution) to the plan.
-void SA_AddTaskCmd::set_tasks (const TaskList &tasks)
+void SA_AddTaskCmd::set_tasks (const TaskChoiceList &tasks)
{
if (!this->tasks_.empty ())
throw "SA_POP::SA_AddTaskCmd::set_tasks (): called while current task list is not empty.";
@@ -256,11 +265,19 @@ TaskInstID SA_AddTaskCmd::get_task_inst (void)
return this->last_task_inst_;
};
+TaskInstSet SA_AddTaskCmd::get_satisfied_tasks(void){
+ return this->task_insts_;
+}
+
/// Check if the instance id used by the task of this command already exists.
+
+
bool SA_AddTaskCmd::inst_exists (void)
{
- return !this->used_task_insts_.empty();
+ return (this->last_task_choice_.choice == REUSE_INST);
+
}
+
// Constructor.
SA_AssocTaskImplCmd::SA_AssocTaskImplCmd (SA_WorkingPlan *working_plan)
: working_plan_ (working_plan),
@@ -292,9 +309,19 @@ bool SA_AssocTaskImplCmd::execute_next (void)
{
SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+ if(get_id().step == 12 && get_id().decision_pt == 2 && get_id().seq_num == 1){
+ bool k = true;
+ }
+
this->undo();
- if (this->impls_.empty ())
+
+ got_to_scheduling = false;
+
+
+ if (this->impls_.empty ()){
return false;
+ }
+
this->num_tries_++;
return this->working_plan_->execute (this);
@@ -354,6 +381,14 @@ TaskInstID SA_AssocTaskImplCmd::get_task_inst (void)
return this->task_inst_;
};
+void SA_AssocTaskImplCmd::set_satisfied_insts(TaskInstSet set){
+ this->satisfied_insts = set;
+}
+
+void SA_AssocTaskImplCmd::set_added_links(CLSet set){
+ this->added_links = set;
+}
+
// Constructor.
SA_AddOpenCondsCmd::SA_AddOpenCondsCmd (SA_PlanStrategy *plan_strat)
@@ -513,7 +548,7 @@ std::string SA_RemoveOpenCondsCmd::get_log_text (void)
};
// Set the open conditions to remove.
-void SA_RemoveOpenCondsCmd::set_conds (const CondSet &conds)
+void SA_RemoveOpenCondsCmd::set_conds (const CondSet &conds, const TaskInstSet &tasks)
{
if (!this->conds_.empty ())
throw "SA_POP::SA_RemoveOpenCondsCmd::set_conds (): called while current condition set is not empty.";
@@ -522,21 +557,23 @@ void SA_RemoveOpenCondsCmd::set_conds (const CondSet &conds)
throw "SA_POP::SA_RemoveOpenCondsCmd::set_conds (): called before last execution undone.";
this->conds_ = conds;
+ this->tasks_ = tasks;
};
// Constructor.
SA_AddOpenThreatsCmd::SA_AddOpenThreatsCmd (SA_PlanStrategy *plan_strat)
-: plan_strat_ (plan_strat)
+: plan_strat_ (plan_strat),
+has_executed_ (false)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ this->threats_.clear ();
};
// Destructor.
SA_AddOpenThreatsCmd::~SA_AddOpenThreatsCmd (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // Nothing specific to destruct
};
// Create a deep copy of this command.
@@ -548,17 +585,25 @@ PlanCommand *SA_AddOpenThreatsCmd::clone (void)
// Execute next option for this command.
bool SA_AddOpenThreatsCmd::execute_next (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
-// this->plan_strat_->execute (this);
- return false;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+
+ if (this->threats_.empty ())
+ return false;
+
+ this->undo();
+ this->plan_strat_->execute (this);
+ this->has_executed_ = true;
+ return true;
};
// Undo this command.
void SA_AddOpenThreatsCmd::undo (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// this->plan_strat_->undo (this);
+ if (!this->has_executed_ || this->threats_.empty ())
+ return;
+
+ this->plan_strat_->undo (this);
+ this->threats_.clear ();
};
// Get log text for most recent execution of command.
@@ -574,24 +619,28 @@ std::string SA_AddOpenThreatsCmd::get_log_text (void)
};
// Set the open threats to add.
-void SA_AddOpenThreatsCmd::set_threats (const CLThreatSet &)
+void SA_AddOpenThreatsCmd::set_threats (const CLThreatSet & threats)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ if (!this->threats_.empty ())
+ throw "SA_POP::SA_AddOpenThreatsCmd::set_conds (): called while current Threat set is not empty.";
+
+ this->threats_ = threats;
};
// Constructor.
SA_RemoveOpenThreatsCmd::SA_RemoveOpenThreatsCmd (SA_PlanStrategy *plan_strat)
-: plan_strat_ (plan_strat)
+: plan_strat_ (plan_strat),
+executed_ (false)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ this->threats_.clear ();
};
// Destructor.
SA_RemoveOpenThreatsCmd::~SA_RemoveOpenThreatsCmd (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ //Nothing to destruct
};
// Create a deep copy of this command.
@@ -603,17 +652,24 @@ PlanCommand *SA_RemoveOpenThreatsCmd::clone (void)
// Execute next option for this command.
bool SA_RemoveOpenThreatsCmd::execute_next (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
-// this->plan_strat_->execute (this);
- return false;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+
+ if (this->threats_.empty ())
+ return false;
+
+ this->undo();
+ this->plan_strat_->execute (this);
+ this->executed_ = true;
+ return true;
};
// Undo this command.
void SA_RemoveOpenThreatsCmd::undo (void)
-{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// this->plan_strat_->undo (this);
+{ if (!(this->executed_) || (this->threats_.empty ()))
+ return;
+
+ this->plan_strat_->undo (this);
+ this->threats_.clear ();
};
// Get log text for most recent execution of command.
@@ -629,9 +685,13 @@ std::string SA_RemoveOpenThreatsCmd::get_log_text (void)
};
// Set the open threats to remove.
-void SA_RemoveOpenThreatsCmd::set_threats (const CLThreatSet &)
+void SA_RemoveOpenThreatsCmd::set_threats (const CLThreatSet & threats)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ if (!this->threats_.empty ())
+ throw "SA_POP::SA_RemoveOpenThreatsCmd::set_threats (): called while current threat set is not empty.";
+
+
+ this->threats_ = threats;
};
@@ -640,13 +700,13 @@ void SA_RemoveOpenThreatsCmd::set_threats (const CLThreatSet &)
SA_ResolveCLThreatCmd::SA_ResolveCLThreatCmd (SA_WorkingPlan *working_plan)
: working_plan_ (working_plan)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ choices = 0;
};
// Destructor.
SA_ResolveCLThreatCmd::~SA_ResolveCLThreatCmd (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ //No Temps Necessary, this does nothing
};
// Create a deep copy of this command.
@@ -658,17 +718,80 @@ PlanCommand *SA_ResolveCLThreatCmd::clone (void)
// Execute next option for this command.
bool SA_ResolveCLThreatCmd::execute_next (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
-// this->working_plan_->execute (this);
- return false;
+ bool goodOption = true;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+ if(choices == 0)
+ {
+ got_to_change_precedences = false;
+
+ //Add this next line to execute function
+ this->working_plan_->add_sched_link(this->threat.threat,this->threat.clink.first);
+ choices++;
+ this->first = this->threat.threat;
+ this->second = this->threat.clink.first;
+ this->condition = this->threat.clink.cond;
+
+
+ goodOption = this->working_plan_->execute (this);
+
+ if(goodOption)
+ {
+ return goodOption;
+ }
+
+ }
+
+ if(choices == 1)
+ {
+ this->undo();
+
+ got_to_change_precedences = false;
+
+ //Add this next line to execute function
+ this->working_plan_->add_sched_link(this->threat.clink.second, this->threat.threat);
+ choices++;
+ this->second = this->threat.threat;
+ this->first = this->threat.clink.second;
+ this->condition = this->threat.clink.cond;
+
+ goodOption = this->working_plan_->execute (this);
+
+ if(goodOption)
+ {
+ return goodOption;
+ }
+ else
+ {
+ return false;
+ }
+
+
+ }
+ else
+ {
+ return false;
+ }
+
+
};
// Undo this command.
void SA_ResolveCLThreatCmd::undo (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-// this->working_plan_->undo (this);
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, this->get_log_text ());
+ if(choices == 1)
+ {
+ //Add this next line to execute function
+ this->working_plan_->remove_sched_link(this->threat.threat,this->threat.clink.first);
+ return this->working_plan_->undo (this);
+ }
+ else if(choices == 2)
+ {
+ //Add this next line to execute function
+ this->working_plan_->remove_sched_link(this->threat.clink.second, this->threat.threat);
+ return this->working_plan_->undo (this);
+ }
};
// Get log text for most recent execution of command.
@@ -684,11 +807,17 @@ std::string SA_ResolveCLThreatCmd::get_log_text (void)
};
// Set the causal link threat to resolve.
-void SA_ResolveCLThreatCmd::set_threat (CLThreat &)
+void SA_ResolveCLThreatCmd::set_threat (CLThreat & tht)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ threat = tht;
};
+// Set the task instances to order.
+void SA_ResolveCLThreatCmd::set_task_insts (TaskInstID task_inst_a, TaskInstID task_inst_b)
+{
+ this->first = task_inst_a;
+ this->second = task_inst_b;
+};
// Constructor.
diff --git a/SA_POP/SA_PlanCommands.h b/SA_POP/SA_PlanCommands.h
index adb6be44cfa..8df1edc62d3 100644
--- a/SA_POP/SA_PlanCommands.h
+++ b/SA_POP/SA_PlanCommands.h
@@ -219,7 +219,7 @@ namespace SA_POP {
/**
* @param tasks Ordered list of tasks.
*/
- virtual void set_tasks (const TaskList &tasks);
+ virtual void set_tasks (const TaskChoiceList &tasks);
/// Set causal link info to add to the plan with task.
/**
@@ -248,12 +248,18 @@ namespace SA_POP {
*/
virtual bool inst_exists (void);
+ virtual TaskInstSet get_satisfied_tasks(void);
+
+ virtual Condition get_condition(void){return cond_;};
+
+ virtual CLSet get_causal_insertions(void){return added_links_;};
+
protected:
/// WorkingPlan object that this command works on.
SA_WorkingPlan *working_plan_;
/// Ordered list of tasks to try adding to the plan.
- TaskList tasks_;
+ TaskChoiceList tasks_;
/// Open condition satisfied by these tasks.
Condition cond_;
@@ -270,6 +276,8 @@ namespace SA_POP {
/// Instance of last task tried.
TaskInstID last_task_inst_;
+ TaskChoice last_task_choice_;
+
/// Number of tasks tried.
size_t num_tries_;
@@ -334,6 +342,10 @@ namespace SA_POP {
*/
virtual TaskInstID get_task_inst (void);
+ virtual void set_satisfied_insts(TaskInstSet set);
+
+ virtual void set_added_links(CLSet links);
+
protected:
/// WorkingPlan object that this command works on.
SA_WorkingPlan *working_plan_;
@@ -355,10 +367,34 @@ namespace SA_POP {
SA_AdjustMinTimesCmd min_adj_cmd;
SA_AdjustMaxTimesCmd max_adj_cmd;
+ bool got_to_scheduling;
+
// The changes made in the precedence set due to the selection of this task instance
// are recorded in these sets.
std::set< std::pair<TaskInstID,TaskInstID> > causal_insertions;
std::set< std::pair<TaskInstID,TaskInstID> > simul_insertions;
+
+ TaskInstSet satisfied_insts;
+
+ CLSet added_links;
+
+ SuspendedConditionListenerMap saved_listener_map;
+ SuspendedConditionSet saved_suspended_set;
+
+/*
+ std::map <TaskInstID, TaskInstSet> befores;
+ std::map <TaskInstID, TaskInstSet> afters;
+ std::map <TaskInstID, TaskInstSet> simuls;
+ std::map <TaskInstID, TaskInstSet> unrankeds;
+
+ std::map <TaskInstID, TaskInstSet> befores_after_ex;
+ std::map <TaskInstID, TaskInstSet> afters_after_ex;
+ std::map <TaskInstID, TaskInstSet> simuls_after_ex;
+ std::map <TaskInstID, TaskInstSet> unrankeds_after_ex;
+*/
+
+// PrecedenceGraph precedence_graph_;
+
};
/**
@@ -427,6 +463,10 @@ namespace SA_POP {
/// Flag for whether this has been executed.
bool has_executed_;
+
+ std::map<Condition, CausalLink> link_suspended_on;
+
+
};
/**
@@ -476,7 +516,9 @@ namespace SA_POP {
/**
* @param conds Set of open conditions to remove.
*/
- virtual void set_conds (const CondSet &conds);
+ virtual void set_conds (const CondSet &conds, const TaskInstSet &tasks);
+
+
protected:
/// PlanStrategy object that this command works on.
@@ -485,6 +527,8 @@ namespace SA_POP {
/// Set of conditions to remove from open conditions.
CondSet conds_;
+ TaskInstSet tasks_;
+
/// Map from removed conditions to (removed) task instances.
OpenCondMap removed_;
};
@@ -541,6 +585,12 @@ namespace SA_POP {
/// PlanStrategy object that this command works on.
SA_PlanStrategy *plan_strat_;
+ /// Set of Threats to add to open threats.
+ CLThreatSet threats_;
+
+ /// Flag for whether this has been executed.
+ bool has_executed_;
+
};
/**
@@ -596,6 +646,14 @@ namespace SA_POP {
/// PlanStrategy object that this command works on.
SA_PlanStrategy *plan_strat_;
+ /// Set of threats to remove from open threats.
+ CLThreatSet threats_;
+
+ /// Flag for whether this has been executed.
+ bool executed_;
+
+
+
};
/**
@@ -646,10 +704,47 @@ namespace SA_POP {
*/
virtual void set_threat (CLThreat &threat);
+
+ /// Set the task instances to order.
+ /**
+ * @param task_inst_a One task instance.
+ *
+ * @param task_inst_b The other task instance.
+ */
+ virtual void set_task_insts (TaskInstID task_inst_a,
+ TaskInstID task_inst_b);
+
+ // int choices;
+ // A Type of a list of ResolveSchedOrderCmd pointers
+ typedef std::list<SA_ResolveCLThreatCmd* > ResolveCLThreatCmdList;
+
+ virtual TaskInstID get_first_task(void){return first;}
+ virtual TaskInstID get_second_task(void){return second;}
+
protected:
/// WorkingPlan object that this command works on.
SA_WorkingPlan *working_plan_;
+ CLThreat threat;
+ // The first task instance is scheduled before the second one
+ TaskInstID first,second;
+ Condition condition;
+
+ std::map <TaskInstID, TaskInstSet> befores;
+ std::map <TaskInstID, TaskInstSet> afters;
+ std::map <TaskInstID, TaskInstSet> simuls;
+ std::map <TaskInstID, TaskInstSet> unrankeds;
+
+ bool got_to_change_precedences;
+
+
+ // The min and the max times changed due to this command
+ SA_AdjustMinTimesCmd *adj_min_times_cmd_;
+ SA_AdjustMaxTimesCmd *adj_max_times_cmd_;
+
+ // A list of all the scheduling orderings introduced by this command
+ // This may need to change for a list of ResolveThreatCmd List
+ ResolveCLThreatCmdList cmds_;
};
/**
@@ -718,6 +813,7 @@ namespace SA_POP {
// The first task instance is scheduled before the second one
TaskInstID first,second;
+
// The min and the max times changed due to this command
SA_AdjustMinTimesCmd *adj_min_times_cmd_;
SA_AdjustMaxTimesCmd *adj_max_times_cmd_;
diff --git a/SA_POP/SA_PlanHeuristics.cpp b/SA_POP/SA_PlanHeuristics.cpp
index 115690ad6bd..3fdfc2fc3db 100644
--- a/SA_POP/SA_PlanHeuristics.cpp
+++ b/SA_POP/SA_PlanHeuristics.cpp
@@ -15,6 +15,9 @@
#include "SA_POP_Types.h"
#include "SA_PlanHeuristics.h"
#include "Planner.h"
+#include "SA_WorkingPlan.h"
+#include <algorithm>
+#include <vector>
using namespace SA_POP;
@@ -43,10 +46,88 @@ Condition SA_CondStrategy::choose_cond (const OpenCondMap &open_conds)
{
if (iter->first.kind == SA_POP::DATA)
return iter->first;
+ }
+
+ // If no data conditions, just return first condition.
+ return open_conds.front().first;
+};
+
+// Choose the next open condition to satisfy.
+Condition SA_CondStrategy::choose_cond_suspension (const OpenCondMap &open_conds)
+{
+ if (open_conds.empty ())
+ throw "SA_POP::SA_CondStrategy::choose_cond (): Empty condition list.";
+
+ // Return first data condition.
+ for (OpenCondMap::const_iterator iter = open_conds.begin ();
+ iter != open_conds.end (); iter++)
+ {
+ if (iter->first.kind == SA_POP::DATA)
+ return iter->first;
+ }
+
+ SA_WorkingPlan* working_plan = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ for(OpenCondMap::const_iterator it = open_conds.begin(); it != open_conds.end(); it++){
+
+ if(!working_plan->condition_in_suspended(it->first, it->second)){
+ return it->first;
+ }else{
+ bool grah = true;
+ }
+ }
+
+ return working_plan->get_no_condition();
+
+ // If no data conditions, just return first condition.
+// return open_conds.front().first;
+};
+
+// Choose the next open condition to satisfy.
+Condition SA_CondStrategy::choose_cond_suspension_most_constrained (const OpenCondMap &open_conds)
+{
+
+ if (open_conds.empty ())
+ throw "SA_POP::SA_CondStrategy::choose_cond (): Empty condition list.";
+
+ // Return first data condition.
+ for (OpenCondMap::const_iterator iter = open_conds.begin ();
+ iter != open_conds.end (); iter++)
+ {
+ if (iter->first.kind == SA_POP::DATA)
+ return iter->first;
+ }
+
+ std::map<int, std::pair<Condition, TaskInstID>> by_num_satisfying;
+
+ for(OpenCondMap::const_iterator iter = open_conds.begin();
+ iter != open_conds.end(); iter++){
+
+ int num_sat = this->planner_->get_satisfying_tasks(iter->first).size();
+
+
+ by_num_satisfying.insert(std::pair<int, std::pair<Condition, TaskInstID>>(num_sat, *iter));
+ }
+
+ SA_WorkingPlan* working_plan = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ for(std::map<int, std::pair<Condition, TaskInstID>>::iterator it = by_num_satisfying.begin(); it != by_num_satisfying.end(); it++){
+
+
+ if(!working_plan->condition_in_suspended(it->second.first, it->second.second)){
+
+ Condition cond = it->second.first;
+
+ return cond;
+ }else{
+ bool grah = true;
+ }
}
+ return working_plan->get_no_condition();
+
// If no data conditions, just return first condition.
- return open_conds.begin ()->first;
+// return open_conds.front().first;
};
@@ -64,13 +145,134 @@ SA_TaskStrategy::~SA_TaskStrategy (void)
// Nothing to do.
};
+
+
+TaskChoiceList SA_TaskStrategy::choose_task_fair (Condition open_cond)
+{
+
+ TaskSet tasks;
+
+ // if(this->planner_->get_working_plan()->get_all_insts().size() > 8){
+
+// TaskChoiceList s;
+ // s.clear();
+// return s;
+ // }
+
+ tasks = this->planner_->get_satisfying_tasks (open_cond);
+
+
+ // Add tasks to map with EU (to sort).
+ std::multimap<EUCalc, TaskID> task_map;
+ task_map.clear ();
+ for (TaskSet::iterator iter = tasks.begin (); iter != tasks.end (); iter++)
+ {
+ task_map.insert (std::make_pair (
+ this->planner_->get_task_future_eu (*iter), *iter));
+ }
+
+ std::multimap<TaskID, TaskInstID> tasks_to_insts;
+
+ SA_WorkingPlan* working_plan = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ InstToTaskMap inst_task_map = working_plan->get_task_insts();
+
+ for(InstToTaskMap::iterator it = inst_task_map.begin();
+ it != inst_task_map.end(); it++){
+
+ tasks_to_insts.insert(std::pair<TaskID, TaskInstID>(it->second, it->first));
+ }
+
+ // Add tasks to list in reverse order of map (highest EU first).
+ TaskChoiceList task_list;
+ task_list.clear ();
+
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ // WE NEED TO PUT A THRESHOLD ON PROBABILITY OF TRUE/FALSE INSTEAD OF COMPARING A DOUBLE TO A BOOL.
+ //If init can handle it, put it on here first
+ if(this->planner_->get_cond_val(open_cond.id) == open_cond.value){
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ TaskChoice init_choice;
+ init_choice.choice = REUSE_INST;
+ init_choice.task_id = INIT_TASK_ID;
+ init_choice.task_inst_id = INIT_TASK_INST_ID;
+
+ task_list.push_back(init_choice);
+ }
+
+ std::vector<SortTaskByTime> tasks_with_existing_instances;
+
+ for (std::multimap<EUCalc, TaskID>::reverse_iterator iter = task_map.rbegin ();
+ iter != task_map.rend (); iter++)
+ {
+
+ if(tasks_to_insts.lower_bound(iter->second) == tasks_to_insts.upper_bound(iter->second)){
+
+ TaskChoice task_choice;
+ task_choice.choice = NEW_INST;
+ task_choice.task_id = iter->second;
+ task_choice.task_inst_id = -2;
+
+ task_list.push_back(task_choice);
+
+ }else{
+
+ SortTaskByTime to_sort;
+ to_sort.task_id = iter->second;
+ to_sort.last_instance = 0;
+
+ for(std::multimap<TaskID, TaskInstID>::iterator it = tasks_to_insts.lower_bound(iter->second); it != tasks_to_insts.upper_bound(iter->second);
+ it++){
+
+ TaskChoice task_choice;
+ task_choice.choice = REUSE_INST;
+ task_choice.task_id = it->first;
+ task_choice.task_inst_id = it->second;
+ task_list.push_back(task_choice);
+
+ to_sort.note_instance(it->second);
+ }
+
+ // if(!(iter->second == INIT_TASK_ID && this->planner_->init_added)){
+ tasks_with_existing_instances.push_back(to_sort);
+ // }
+
+ }
+ }
+
+ std::sort(tasks_with_existing_instances.begin(), tasks_with_existing_instances.end());
+
+ for(std::vector<SortTaskByTime>::iterator it = tasks_with_existing_instances.begin(); it != tasks_with_existing_instances.end(); it++){
+
+
+
+ TaskChoice task_choice;
+ task_choice.choice = NEW_INST;
+ task_choice.task_id = it->task_id;
+ task_choice.task_inst_id = -2;
+ task_list.push_back(task_choice);
+ }
+
+
+ return task_list;
+
+
+};
+
+
+
+
// Choose the (ordering of) task(s) to satisfy an open condition.
-TaskList SA_TaskStrategy::choose_task (Condition open_cond)
+TaskChoiceList SA_TaskStrategy::choose_task (Condition open_cond)
{
TaskSet tasks = this->planner_->get_satisfying_tasks (open_cond);
+// if(this->planner_->init_added){
+// tasks.erase(INIT_TASK_ID);
+// }
+
// Add tasks to map with EU (to sort).
- std::map<EUCalc, TaskID> task_map;
+ std::multimap<EUCalc, TaskID> task_map;
task_map.clear ();
for (TaskSet::iterator iter = tasks.begin (); iter != tasks.end (); iter++)
{
@@ -78,15 +280,65 @@ TaskList SA_TaskStrategy::choose_task (Condition open_cond)
this->planner_->get_task_future_eu (*iter), *iter));
}
+ std::multimap<TaskID, TaskInstID> tasks_to_insts;
+
+ SA_WorkingPlan* working_plan = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ InstToTaskMap inst_task_map = working_plan->get_task_insts();
+
+ for(InstToTaskMap::iterator it = inst_task_map.begin();
+ it != inst_task_map.end(); it++){
+ tasks_to_insts.insert(std::pair<TaskID, TaskInstID>(it->second, it->first));
+ }
+
// Add tasks to list in reverse order of map (highest EU first).
- TaskList task_list;
+ TaskChoiceList task_list;
task_list.clear ();
- for (std::map<EUCalc, TaskID>::reverse_iterator iter = task_map.rbegin ();
+
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ // WE NEED TO PUT A THRESHOLD ON PROBABILITY OF TRUE/FALSE INSTEAD OF COMPARING A DOUBLE TO A BOOL.
+ //If init can handle it, put it on here first
+ if(this->planner_->get_cond_val(open_cond.id) == open_cond.value){
+//*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****TEMP*****
+ TaskChoice init_choice;
+ init_choice.choice = REUSE_INST;
+ init_choice.task_id = INIT_TASK_ID;
+ init_choice.task_inst_id = INIT_TASK_INST_ID;
+
+ task_list.push_back(init_choice);
+ }
+
+
+ for (std::multimap<EUCalc, TaskID>::reverse_iterator iter = task_map.rbegin ();
iter != task_map.rend (); iter++)
{
- task_list.push_back (iter->second);
+
+ for(std::multimap<TaskID, TaskInstID>::iterator it = tasks_to_insts.lower_bound(iter->second); it != tasks_to_insts.upper_bound(iter->second);
+ it++){
+
+ TaskChoice task_choice;
+ task_choice.choice = REUSE_INST;
+ task_choice.task_id = it->first;
+ task_choice.task_inst_id = it->second;
+
+ task_list.push_back(task_choice);
+ }
+
+ TaskChoice task_choice;
+ task_choice.choice = NEW_INST;
+ task_choice.task_id = iter->second;
+ task_choice.task_inst_id = -2;
+
+ task_list.push_back(task_choice);
+ // task_list.push_back(
+// task_list.choice_list.push_back (std::pair<int, int>(TASK_INST_ID, iter->second));
}
+
+
+
return task_list;
+
+
};
diff --git a/SA_POP/SA_PlanHeuristics.h b/SA_POP/SA_PlanHeuristics.h
index ab4a859d982..9604719baee 100644
--- a/SA_POP/SA_PlanHeuristics.h
+++ b/SA_POP/SA_PlanHeuristics.h
@@ -15,6 +15,7 @@
#ifndef SA_POP_SA_PLAN_HEURISTICS_H_
#define SA_POP_SA_PLAN_HEURISTICS_H_
+
#include "SA_POP_Types.h"
#include "PlanHeuristics.h"
@@ -44,6 +45,10 @@ namespace SA_POP {
* @return Next open condition to satisfy.
*/
virtual Condition choose_cond (const OpenCondMap &open_conds);
+
+ virtual Condition choose_cond_suspension (const OpenCondMap &open_conds);
+
+ virtual Condition choose_cond_suspension_most_constrained (const OpenCondMap &open_conds);
};
/**
@@ -70,7 +75,15 @@ namespace SA_POP {
*
* @return Sorted list of tasks that satisfy given condition.
*/
- virtual TaskList choose_task (Condition open_cond);
+ virtual TaskChoiceList choose_task (Condition open_cond);
+
+ /// Choose the (ordering of) task(s) to satisfy an open condition. The cool way
+ /**
+ * @param open_cond Open condition to satisfy.
+ *
+ * @return Sorted list of tasks that satisfy given condition.
+ */
+ virtual TaskChoiceList choose_task_fair (Condition open_cond);
};
/**
@@ -101,6 +114,8 @@ namespace SA_POP {
};
+
+
}; /* SA_POP namespace */
diff --git a/SA_POP/SA_PlanStrategy.cpp b/SA_POP/SA_PlanStrategy.cpp
index 6cc9024686e..bd2de962fcd 100644
--- a/SA_POP/SA_PlanStrategy.cpp
+++ b/SA_POP/SA_PlanStrategy.cpp
@@ -3,14 +3,14 @@
//=============================================================================
/**
- * @file SA_PlanStrategy.cpp
- *
- * This file contains the implementation of the SA_PlanStrategy concrete class,
- * which implements a PlanStrategy for use with spreading activation networks
- * and precedence graphs.
- *
- * @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
- */
+* @file SA_PlanStrategy.cpp
+*
+* This file contains the implementation of the SA_PlanStrategy concrete class,
+* which implements a PlanStrategy for use with spreading activation networks
+* and precedence graphs.
+*
+* @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
+*/
//=============================================================================
#include <set>
@@ -19,117 +19,123 @@
#include "Planner.h"
#include "PlanHeuristics.h"
#include "PlanCommands.h"
+#include "SA_WorkingPlan.h"
+#include <fstream>
+
+
+
using namespace SA_POP;
// Constructor.
SA_PlanStrategy::SA_PlanStrategy (SA_POP::Planner *planner,
- CondStrategy *cond_choice, TaskStrategy *task_choice,
- ImplStrategy *impl_choice)
-: PlanStrategy (planner),
-has_cmds_ (false),
-cur_task_ (SA_POP::NULL_TASK_ID),
-cur_task_inst_ (SA_POP::NULL_TASK_ID),
-cur_step_ (0),
-cur_decision_pt_ (SA_POP::SA_PlanStrategy::TASK_DECISION),
-cur_seq_num_ (1),
-cond_choice_ (cond_choice),
-task_choice_ (task_choice),
-impl_choice_ (impl_choice),
-add_conds_cmd_ (0),
-rmv_conds_cmd_ (0),
-add_threats_cmd_ (0),
-rmv_threats_cmd_ (0),
-add_task_cmd_ (0),
-assoc_impl_cmd_ (0),
-resolve_threat_cmd_ (0)
+ CondStrategy *cond_choice, TaskStrategy *task_choice,
+ ImplStrategy *impl_choice)
+ : PlanStrategy (planner),
+ has_cmds_ (false),
+ cur_task_ (SA_POP::NULL_TASK_ID),
+ cur_task_inst_ (SA_POP::NULL_TASK_ID),
+ cur_step_ (0),
+ cur_decision_pt_ (SA_POP::SA_PlanStrategy::TASK_DECISION),
+ cur_seq_num_ (1),
+ cond_choice_ (cond_choice),
+ task_choice_ (task_choice),
+ impl_choice_ (impl_choice),
+ add_conds_cmd_ (0),
+ rmv_conds_cmd_ (0),
+ add_threats_cmd_ (0),
+ rmv_threats_cmd_ (0),
+ add_task_cmd_ (0),
+ assoc_impl_cmd_ (0),
+ resolve_threat_cmd_ (0),
+ open_conds_(BACK, FRONT)
{
- this->add_conds_cmd_ = new SA_AddOpenCondsCmd (this);
- this->rmv_conds_cmd_ = new SA_RemoveOpenCondsCmd (this);
- this->add_threats_cmd_ = new SA_AddOpenThreatsCmd (this);
- this->rmv_threats_cmd_ = new SA_RemoveOpenThreatsCmd (this);
- this->open_conds_.clear ();
- this->open_threats_.clear ();
+ this->add_conds_cmd_ = new SA_AddOpenCondsCmd (this);
+ this->rmv_conds_cmd_ = new SA_RemoveOpenCondsCmd (this);
+ this->add_threats_cmd_ = new SA_AddOpenThreatsCmd (this);
+ this->rmv_threats_cmd_ = new SA_RemoveOpenThreatsCmd (this);
+ this->open_conds_.clear ();
+ this->open_threats_.clear ();
};
// Destructor.
SA_PlanStrategy::~SA_PlanStrategy (void)
{
- // Delete heuristic strategies.
- delete this->cond_choice_;
- delete this->task_choice_;
- delete this->impl_choice_;
+ // Delete heuristic strategies.
+ delete this->cond_choice_;
+ delete this->task_choice_;
+ delete this->impl_choice_;
};
void SA_PlanStrategy::reset()
{
- has_cmds_ = false;
- cur_task_ = SA_POP::NULL_TASK_ID;
- cur_task_inst_ = SA_POP::NULL_TASK_ID;
- cur_step_ = 0;
- cur_decision_pt_ = SA_POP::SA_PlanStrategy::TASK_DECISION;
- cur_seq_num_ = 1;
- this->add_conds_cmd_ = new SA_AddOpenCondsCmd (this);
- this->rmv_conds_cmd_ = new SA_RemoveOpenCondsCmd (this);
- this->add_threats_cmd_ = new SA_AddOpenThreatsCmd (this);
- this->rmv_threats_cmd_ = new SA_RemoveOpenThreatsCmd (this);
- this->open_conds_.clear ();
- this->open_threats_.clear ();
+ has_cmds_ = false;
+ cur_task_ = SA_POP::NULL_TASK_ID;
+ cur_task_inst_ = SA_POP::NULL_TASK_ID;
+ cur_step_ = 0;
+ cur_decision_pt_ = SA_POP::SA_PlanStrategy::TASK_DECISION;
+ cur_seq_num_ = 1;
+ this->add_conds_cmd_ = new SA_AddOpenCondsCmd (this);
+ this->rmv_conds_cmd_ = new SA_RemoveOpenCondsCmd (this);
+ this->add_threats_cmd_ = new SA_AddOpenThreatsCmd (this);
+ this->rmv_threats_cmd_ = new SA_RemoveOpenThreatsCmd (this);
+ this->open_conds_.clear ();
+ this->open_threats_.clear ();
};
// Set command prototypes to use in planning.
void SA_PlanStrategy::set_commands (AddTaskCmd *add_task_cmd,
- AssocTaskImplCmd *assoc_impl_cmd,
- ResolveCLThreatCmd *resolve_threat_cmd)
+ AssocTaskImplCmd *assoc_impl_cmd,
+ ResolveCLThreatCmd *resolve_threat_cmd)
{
- this->has_cmds_ = true;
-
- if (add_task_cmd)
- this->add_task_cmd_ = add_task_cmd;
- else if (this->add_task_cmd_ == 0)
- this->has_cmds_ = false;
-
- if (assoc_impl_cmd)
- this->assoc_impl_cmd_ = assoc_impl_cmd;
- else if (this->assoc_impl_cmd_ == 0)
- this->has_cmds_ = false;
-
- if (resolve_threat_cmd)
- this->resolve_threat_cmd_ = resolve_threat_cmd;
- else if (this->resolve_threat_cmd_ == 0)
- this->has_cmds_ = false;
+ this->has_cmds_ = true;
+
+ if (add_task_cmd)
+ this->add_task_cmd_ = add_task_cmd;
+ else if (this->add_task_cmd_ == 0)
+ this->has_cmds_ = false;
+
+ if (assoc_impl_cmd)
+ this->assoc_impl_cmd_ = assoc_impl_cmd;
+ else if (this->assoc_impl_cmd_ == 0)
+ this->has_cmds_ = false;
+
+ if (resolve_threat_cmd)
+ this->resolve_threat_cmd_ = resolve_threat_cmd;
+ else if (this->resolve_threat_cmd_ == 0)
+ this->has_cmds_ = false;
};
// Set goals.
void SA_PlanStrategy::set_goals (GoalMap goals)
{
- for (SA_POP::GoalMap::iterator iter = goals.begin ();
- iter != goals.end (); iter++)
- {
- Condition cond;
- cond.id = iter->first;
- if (iter->second > 0)
- cond.value = true;
- else
- cond.value = false;
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // Get type of condition.
- cond.kind = SA_POP::SYSTEM;
-
- this->open_conds_.insert (std::make_pair (cond, SA_POP::GOAL_TASK_INST_ID));
- }
+ for (SA_POP::GoalMap::iterator iter = goals.begin ();
+ iter != goals.end (); iter++)
+ {
+ Condition cond;
+ cond.id = iter->first;
+ if (iter->second > 0)
+ cond.value = true;
+ else
+ cond.value = false;
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // Get type of condition.
+ cond.kind = SA_POP::SYSTEM;
+
+ this->open_conds_.insert (std::make_pair (cond, SA_POP::GOAL_TASK_INST_ID));
+ }
};
// Get command ID to use for next command.
CommandID SA_PlanStrategy::get_next_cmd_id (void)
{
- CommandID temp;
- temp.step = this->cur_step_;
- temp.decision_pt = this->cur_decision_pt_;
- temp.seq_num = this->cur_seq_num_;
+ CommandID temp;
+ temp.step = this->cur_step_;
+ temp.decision_pt = this->cur_decision_pt_;
+ temp.seq_num = this->cur_seq_num_;
- this->cur_seq_num_++;
- return temp;
+ this->cur_seq_num_++;
+ return temp;
};
// Recursively satisfy all open conditions (including recursive
@@ -140,351 +146,521 @@ bool SA_PlanStrategy::satisfy_open_conds (void)
if (this->open_conds_.empty ())
return this->planner_->full_sched();
- // Increment step counter.
- this->cur_step_++;
+ if( MAX_TASK_INSTS == -1 ||
+ !(this->planner_->get_working_plan()->get_all_insts().size() > MAX_TASK_INSTS)){
+ // Increment step counter.
+ this->cur_step_++;
- // Set decision point and reset sequence number for commands.
- this->cur_decision_pt_ = SA_PlanStrategy::TASK_DECISION;
- this->cur_seq_num_ = 1;
+ // Set decision point and reset sequence number for commands.
+ this->cur_decision_pt_ = SA_PlanStrategy::TASK_DECISION;
+ this->cur_seq_num_ = 1;
- // Variable for preconditions of current task.
- CondSet preconds;
+ // Variable for preconditions of current task.
+ CondSet preconds;
- // Choose an open condition to satisfy.
- Condition open_cond = this->cond_choice_->choose_cond (this->open_conds_);
+ // Choose an open condition to satisfy.
+ Condition open_cond = this->cond_choice_->choose_cond_suspension (this->open_conds_);
+ SA_WorkingPlan* working_plan_tmp = (SA_WorkingPlan*)this->planner_->get_working_plan();
+ if(working_plan_tmp->is_null_condition(open_cond)){
+ return false;
+ }
- // Choose task to satisfy open condition (actually an ordered list of
- // tasks to try), passing command to planner to be executed next.
- AddTaskCmd *add_task_cmd = this->satisfy_cond (open_cond);
+ // Choose task to satisfy open condition (actually an ordered list of
+ // tasks to try), passing command to planner to be executed next.
+ AddTaskCmd *add_task_cmd = this->satisfy_cond (open_cond);
- // Try tasks until one yields a complete plan or all have been tried.
- while (this->planner_->try_next (add_task_cmd->get_id ())) {
- // Get current task and task instance.
- this->cur_task_ = add_task_cmd->get_task ();
- this->cur_task_inst_ = add_task_cmd->get_task_inst ();
- // Remove open condition.
- CommandID rmv_cond_cmd_id = this->rmv_open_cond (open_cond);
+ TaskInstSet old_satisfied_insts = this->satisfied_insts;
+
+ this->satisfied_insts = add_task_cmd->get_satisfied_tasks();
+
+ TaskInstID prev_cur_inst = this->cur_task_inst_;
+
+ // Try tasks until one yields a complete plan or all have been tried.
+ while (this->planner_->try_next (add_task_cmd->get_id ())) {
+
+ this->added_links = add_task_cmd->get_causal_insertions();
+
+ // Get current task and task instance.
+ this->cur_task_ = add_task_cmd->get_task ();
+
+ this->cur_task_inst_ = add_task_cmd->get_task_inst ();
+ // Remove open condition.
+ CommandID rmv_cond_cmd_id = this->rmv_open_cond (open_cond, add_task_cmd->get_satisfied_tasks());
+
+ TaskID stored_task = this->cur_task_;
+
+ bool to_fail = false;
+
+ // Add preconditions of this task of we didn't reuse the task instance.
+ CommandID add_preconds_cmd_id;
+ if(!add_task_cmd->inst_exists())
+ {
+ preconds = this->planner_->get_unsat_preconds (this->cur_task_);
+ add_preconds_cmd_id =
+ this->add_open_conds (preconds, this->cur_task_inst_);
+ }
+
+ //Do not execute if the condition has been noted before and not helped
+ std::pair<bool, CommandID> return_data = this->store_map.should_continue(add_task_cmd->get_id(), add_task_cmd->get_condition(),
+ stored_task, this->open_conds_, this->planner_->get_working_plan()->get_task_insts());
+
+ if(return_data.first)
+ {
+ // Try to satisfy threats and continue recursive planning.
+ if (this->satisfy_everything())
+ return true;
+
+ }
+
+ this->store_map.undo_binding(add_task_cmd->get_id(), add_task_cmd->get_condition(), stored_task);
+
+ std::ostringstream debug_text;
+ debug_text<<" the task instance being deleted is "<<add_task_cmd->get_task_inst()<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ // Undo addition of preconditions from this task if we didn't reuse the task instance.
+ if(!add_task_cmd->inst_exists())
+ this->planner_->undo_command (add_preconds_cmd_id);
+
+ // Undo removal of open condition.
+ this->planner_->undo_command (rmv_cond_cmd_id);
+
+ }
+
+ this->cur_task_inst_ = prev_cur_inst;
+
+ SA_POP_DEBUG (SA_POP_DEBUG_NORMAL, "Backtracking to previous step...");
+ // Undo addition of task.
+
+ this->satisfied_insts = old_satisfied_insts;
+ this->planner_->undo_command (add_task_cmd->get_id ());
+
+
+
+ // Decrement step.
+ this->cur_step_--;
- // Add preconditions of this task of we didn't reuse the task instance.
- CommandID add_preconds_cmd_id;
- if(!add_task_cmd->inst_exists())
- {
- preconds = this->planner_->get_unsat_preconds (this->cur_task_);
- add_preconds_cmd_id =
- this->add_open_conds (preconds, this->cur_task_inst_);
}
- // Set decision point and reset sequence number for commands.
- this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION;
- this->cur_seq_num_ = 1;
-
- // Add causal link threats to open threats.
- bool are_threats = !this->planner_->get_all_threats ().empty ();
- CommandID add_threats_cmd_id;
- if (are_threats)
- add_threats_cmd_id =
- this->add_open_threats (this->planner_->get_all_threats ());
-
- // Try to satisfy threats and continue recursive planning.
- if (this->satisfy_open_threats ())
- return true;
-
- SA_POP_DEBUG(SA_POP_DEBUG_NORMAL, "Backtracking from task addition...");
- // Undo addition of causal link threats from this task.
- if (are_threats)
- this->planner_->undo_command (add_threats_cmd_id);
- std::cout<<" the task instance being deleted is "<<add_task_cmd->get_task_inst()<<std::endl;
- // Undo addition of preconditions from this task if we didn't reuse the task instance.
- if(!add_task_cmd->inst_exists())
- this->planner_->undo_command (add_preconds_cmd_id);
-
- // Undo removal of open condition.
- this->planner_->undo_command (rmv_cond_cmd_id);
-
- }
-
- SA_POP_DEBUG (SA_POP_DEBUG_NORMAL, "Backtracking to previous step...");
- // Undo addition of task.
- this->planner_->undo_command (add_task_cmd->get_id ());
-
- // Decrement step.
- this->cur_step_--;
-
- // No task could satisfy open condition, so return failure.
- return false;
+
+ // No task could satisfy open condition, so return failure.
+ return false;
};
+bool SA_PlanStrategy::satisfy_everything(){
+
+ //for each implementation
+ this->cur_decision_pt_ = SA_PlanStrategy::IMPL_DECISION;
+ this->cur_seq_num_ = 1;
+
+ AssocTaskImplCmd *assoc_impl_cmd;
+ TaskImplList impl_list;
+
+ // Choose a task implementation.
+ assoc_impl_cmd =
+ static_cast<AssocTaskImplCmd *> (this->assoc_impl_cmd_->clone ());
+ if(!this->planner_->inst_exists(this->cur_task_inst_)) impl_list = this->impl_choice_->choose_impl (this->cur_task_inst_);
+ else impl_list.push_back(this->planner_->get_impl_id(this->cur_task_inst_));
+ assoc_impl_cmd->set_id (this->get_next_cmd_id ());
+ assoc_impl_cmd->set_assoc (this->cur_task_inst_, impl_list);
+ this->planner_->add_command (assoc_impl_cmd);
+
+ assoc_impl_cmd->set_satisfied_insts(this->satisfied_insts);
+
+ assoc_impl_cmd->set_added_links(this->added_links);
+
+
+ this->cur_task_inst_ = assoc_impl_cmd->get_task_inst ();
+
+ while (this->planner_->try_next (assoc_impl_cmd->get_id ()))
+ {
+
+ //Move this code to the threat resolution sequence
+ // Set decision point and reset sequence number for commands.
+ this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION;
+ this->cur_seq_num_ = 1;
+
+
+ //Deal with threats
+
+ //Actually build the list of threats
+ this->planner_->generate_all_threats();
+
+
+
+ // Add causal link threats to open threats.
+ bool are_threats = !(this->planner_->get_all_threats().empty ());
+ CommandID add_threats_cmd_id;
+ if (are_threats)
+ add_threats_cmd_id =
+ this->add_open_threats (this->planner_->get_all_threats ());
+
+ if(this->get_next_threat_resolution()){
+ return true;
+ }
+ else{
+
+ this->cur_decision_pt_ = SA_PlanStrategy::IMPL_DECISION;
+ }
+
+ SA_POP_DEBUG(SA_POP_DEBUG_NORMAL, "Backtracking from task assoc...");
+ // Undo addition of causal link threats from this task.
+ if (are_threats)
+ this->planner_->undo_command (add_threats_cmd_id);
+
+
+ }
+
+ //Undo the AssocImplCmd
+
+ planner_->undo_command(assoc_impl_cmd->get_id());
+
+ this->cur_decision_pt_ = SA_PlanStrategy::IMPL_DECISION;
+
+ return false;
+}
+bool SA_PlanStrategy::satisfy_schedule(void){
+
+
+ // Set decision point and reset sequence number for commands.
+ this->cur_decision_pt_ = SA_PlanStrategy::SCHEDULE_DECISION;
+ this->cur_seq_num_ = 1;
+
+ // Try to schedule and recursively continue planning.
+ if (this->planner_->recurse_sched (this->cur_task_inst_))
+ return true;
+
+ return false;
+}
+
+bool SA_PlanStrategy::get_next_threat_resolution(){
+
+ // Choose an open threat to satisfy and remove from open threats.
+
+ if(open_threats_.empty()){
+
+ return satisfy_schedule();
+ }
+ this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION;
+ CLThreat threat = *this->open_threats_.begin ();
+ CommandID rmv_threat_cmd_id = this->rmv_open_threat (threat);
+
+ this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION;
+
+ // Create threat resolution command and add to planner.
+ ResolveCLThreatCmd *resolve_threat_cmd =
+ static_cast<ResolveCLThreatCmd *> (this->resolve_threat_cmd_->clone ());
+ resolve_threat_cmd->set_id (this->get_next_cmd_id ());
+ resolve_threat_cmd->set_threat (threat);
+ this->planner_->add_command (resolve_threat_cmd);
+
+ while(this->planner_->try_next(resolve_threat_cmd->get_id())){
+
+ if (this->get_next_threat_resolution ())
+ return true;
+
+ }
+
+ this->cur_decision_pt_ = SA_PlanStrategy::THREAT_DECISION;
+ this->planner_->undo_command (resolve_threat_cmd->get_id ());
+
+ this->open_threats_.insert(threat);
+
+ // Undo removal of open threat.
+ this->planner_->undo_command (rmv_threat_cmd_id);
+
+ return false;
+
+}
+
+
// Get a PlanCommand prototype for adding open conditions,
// which works on this strategy.
AddOpenCondsCmd *SA_PlanStrategy::get_AddOpenCondsCmd (void)
{
- return static_cast<AddOpenCondsCmd *> (this->add_conds_cmd_->clone ());
+ return static_cast<AddOpenCondsCmd *> (this->add_conds_cmd_->clone ());
};
// Get a PlanCommand prototype for removing open conditions,
// which works on this strategy.
RemoveOpenCondsCmd *SA_PlanStrategy::get_RemoveOpenCondsCmd (void)
{
- return static_cast<RemoveOpenCondsCmd *> (this->rmv_conds_cmd_->clone ());
+ return static_cast<RemoveOpenCondsCmd *> (this->rmv_conds_cmd_->clone ());
};
// Get an command prototype for adding causal link threats, which works on
// this strategy.
AddOpenThreatsCmd *SA_PlanStrategy::get_AddOpenThreatsCmd (void)
{
- return static_cast<AddOpenThreatsCmd *> (this->add_threats_cmd_->clone ());
+ return static_cast<AddOpenThreatsCmd *> (this->add_threats_cmd_->clone ());
};
// Get a PlanCommand prototype for removing causal link threats,
// which works on this strategy.
RemoveOpenThreatsCmd *SA_PlanStrategy::get_RemoveOpenThreatsCmd (void)
{
- return static_cast<RemoveOpenThreatsCmd *> (this->rmv_threats_cmd_->clone ());
+ return static_cast<RemoveOpenThreatsCmd *> (this->rmv_threats_cmd_->clone ());
};
// Execute a command to add open conditions to planning.
void SA_PlanStrategy::execute (SA_AddOpenCondsCmd *cmd)
{
- for (CondSet::iterator iter = cmd->conds_.begin ();
- iter != cmd->conds_.end (); iter++)
- {
- this->open_conds_.insert (std::make_pair (*iter, cmd->task_inst_));
- }
+ SA_WorkingPlan* working_plan_tmp = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ for (CondSet::iterator iter = cmd->conds_.begin ();
+ iter != cmd->conds_.end (); iter++)
+ {
+ this->open_conds_.insert (std::make_pair (*iter, cmd->task_inst_));
+
+ CausalLink closest_on_path = working_plan_tmp->clink_on_path(*iter, cmd->task_inst_);
+ if(!working_plan_tmp->is_null_link(closest_on_path)){
+ working_plan_tmp->suspend_condition(*iter, cmd->task_inst_, closest_on_path);
+
+ }
+ cmd->link_suspended_on.insert(std::pair<Condition, CausalLink>(*iter, closest_on_path));
+ }
};
// Undo a command to add open conditions to planning.
void SA_PlanStrategy::undo (SA_AddOpenCondsCmd *cmd)
{
- // Remove open conditions mapped to the specified task instance.
- std::cout<<"removing open conds mapped to "<<cmd->task_inst_<<std::endl;
+ std::ostringstream debug_text;
+
+ SA_WorkingPlan* work_plan_tmp = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ // Remove open conditions mapped to the specified task instance.
+ debug_text<<"removing open conds mapped to "<<cmd->task_inst_<<std::endl;
for (CondSet::iterator cond_iter = cmd->conds_.begin ();
- cond_iter != cmd->conds_.end (); cond_iter++)
- {
- std::cout<<"checking for "<<cond_iter->id<<std::endl;
- for (OpenCondMap::iterator open_iter =
- this->open_conds_.lower_bound (*cond_iter);
- open_iter != this->open_conds_.upper_bound (*cond_iter);)
- {
- OpenCondMap::iterator prev_iter = open_iter;
- open_iter++;
- if (prev_iter->second == cmd->task_inst_)
- {
- std::cout<<"in planstrat erasing from open_conds_ "<<prev_iter->first.id<<" to "<<prev_iter->second<<std::endl;
- this->open_conds_.erase (prev_iter);
- }
+ cond_iter != cmd->conds_.end (); cond_iter++)
+ {
+ CausalLink lnk = (cmd->link_suspended_on.find(*cond_iter))->second;
+ if(!work_plan_tmp->is_null_link(lnk)){
+ work_plan_tmp->resume_condition(*cond_iter, cmd->task_inst_, lnk);
+ }
+
+ debug_text<<"checking for "<<cond_iter->id<<std::endl;
+ for (OpenCondMap::iterator open_iter =
+ this->open_conds_.lower_bound (*cond_iter);
+ open_iter != this->open_conds_.upper_bound (*cond_iter);)
+ {
+ OpenCondMap::iterator prev_iter = open_iter;
+ open_iter++;
+ if (prev_iter->second == cmd->task_inst_)
+ {
+ debug_text<<"in planstrat erasing from open_conds_ "<<prev_iter->first.id<<" to "<<prev_iter->second<<std::endl;
+ this->open_conds_.erase (prev_iter);
+ }
+ }
}
- }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
};
// Execute a command to remove open conditions from planning.
void SA_PlanStrategy::execute (SA_RemoveOpenCondsCmd *cmd)
{
- // Remove open conditions, keeping track of removed cond->inst mapping.
- for (CondSet::iterator cond_iter = cmd->conds_.begin ();
- cond_iter != cmd->conds_.end (); cond_iter++)
- {
- for (OpenCondMap::iterator open_iter =
- this->open_conds_.lower_bound (*cond_iter);
- open_iter != this->open_conds_.upper_bound (*cond_iter); )
- {
- cmd->removed_.insert (std::make_pair
- (open_iter->first, open_iter->second));
- OpenCondMap::iterator prev_iter = open_iter;
- open_iter++;
- this->open_conds_.erase (prev_iter);
- }
- }
+ // Remove open conditions, keeping track of removed cond->inst mapping.
+
+ SA_WorkingPlan* working_plan_tmp = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ for(CondSet::iterator cond_it = cmd->conds_.begin(); cond_it != cmd->conds_.end();
+ cond_it++){
+
+ for(TaskInstSet::iterator task_it = cmd->tasks_.begin();
+ task_it != cmd->tasks_.end(); task_it++){
+
+ for(OpenCondMap::iterator o_it = open_conds_.lower_bound(*cond_it);
+ o_it != open_conds_.upper_bound(*cond_it); ){
+
+ if(o_it->second == *task_it){
+
+ OpenCondMap::iterator prev_iter = o_it;
+ o_it++;
+
+ cmd->removed_.insert (std::make_pair
+ (*cond_it, *task_it));
+
+ open_conds_.erase(prev_iter);
+ }else{
+ o_it++;
+ }
+ }
+ }
+ }
};
// Undo a command to remove open conditions from planning.
void SA_PlanStrategy::undo (SA_RemoveOpenCondsCmd *cmd)
{
- // Insert removed open condition to task instance mapping.
- for (OpenCondMap::iterator open_iter = cmd->removed_.begin ();
- open_iter != cmd->removed_.end (); open_iter++)
- {
- std::cout<<"in planstrat undo adding "<<open_iter->first.id<<" to "<<open_iter->second<<std::endl;
- this->open_conds_.insert (std::make_pair
- (open_iter->first, open_iter->second));
- }
+
+ std::ostringstream debug_text;
+ // Insert removed open condition to task instance mapping.
+ for (OpenCondMap::iterator open_iter = cmd->removed_.begin ();
+ open_iter != cmd->removed_.end (); open_iter++)
+ {
+ debug_text<<"in planstrat undo adding "<<open_iter->first.id<<" to "<<open_iter->second<<std::endl;
+ this->open_conds_.push_front (std::make_pair
+ (open_iter->first, open_iter->second));
+ }
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
};
// Execute a command to add causal link threats to planning.
-void SA_PlanStrategy::execute (SA_AddOpenThreatsCmd *)
+void SA_PlanStrategy::execute (SA_AddOpenThreatsCmd *cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ for (CLThreatSet::iterator iter = cmd->threats_.begin ();
+ iter != cmd->threats_.end (); iter++)
+ {
+ CLThreat threat = *iter;
+ this->open_threats_.insert (threat);
+ }
};
// Undo a command to add causal link threats to planning.
-void SA_PlanStrategy::undo (SA_AddOpenThreatsCmd *)
+void SA_PlanStrategy::undo (SA_AddOpenThreatsCmd * cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ std::ostringstream debug_text;
+ // Remove open conditions mapped to the specified task instance.
+ debug_text<<"undoing open threats" <<std::endl;
+ for (CLThreatSet::iterator cond_iter = cmd->threats_.begin ();
+ cond_iter != cmd->threats_.end (); cond_iter++)
+ {
+ CLThreat threat = *cond_iter;
+ this->open_threats_.erase (threat);
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
};
// Execute a command to remove causal link threats from planning.
-void SA_PlanStrategy::execute (SA_RemoveOpenThreatsCmd *)
+void SA_PlanStrategy::execute (SA_RemoveOpenThreatsCmd * cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ std::ostringstream debug_text;
+ // Remove open conditions mapped to the specified task instance.
+ debug_text<<"removing open threats" <<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ for (CLThreatSet::iterator cond_iter = cmd->threats_.begin ();
+ cond_iter != cmd->threats_.end (); cond_iter++)
+ {
+ CLThreat threat = *cond_iter;
+ this->open_threats_.erase (threat);
+ }
};
// Undo a command to remove causal link threats from planning.
-void SA_PlanStrategy::undo (SA_RemoveOpenThreatsCmd *)
+void SA_PlanStrategy::undo (SA_RemoveOpenThreatsCmd * cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ for (CLThreatSet::iterator iter = cmd->threats_.begin ();
+ iter != cmd->threats_.end (); iter++)
+ {
+ CLThreat threat = *iter;
+ //this->closed_threats_.erase (threat);
+ this->open_threats_.insert (threat);
+ }
};
-// Recursively satisfy all open causal link threats and continue planning.
-bool SA_PlanStrategy::satisfy_open_threats (void)
-{
- if (this->open_threats_.empty ()) {
- // Set decision point and reset sequence number for commands.
- this->cur_decision_pt_ = SA_PlanStrategy::IMPL_DECISION;
- this->cur_seq_num_ = 1;
-
- // Choose a task implementation.
- AssocTaskImplCmd *assoc_impl_cmd =
- static_cast<AssocTaskImplCmd *> (this->assoc_impl_cmd_->clone ());
- TaskImplList impl_list;
- if(!this->planner_->inst_exists(this->cur_task_inst_)) impl_list = this->impl_choice_->choose_impl (this->cur_task_inst_);
- else impl_list.push_back(this->planner_->get_impl_id(this->cur_task_inst_));
- assoc_impl_cmd->set_id (this->get_next_cmd_id ());
- assoc_impl_cmd->set_assoc (this->cur_task_inst_, impl_list);
- this->planner_->add_command (assoc_impl_cmd);
-
- // Try task implementations until one yields a complete plan or all have
- // been tried.
- while (this->planner_->try_next (assoc_impl_cmd->get_id ())) {
- // Get the task instance.
- this->cur_task_inst_ = assoc_impl_cmd->get_task_inst ();
- // Set decision point and reset sequence number for commands.
- this->cur_decision_pt_ = SA_PlanStrategy::SCHEDULE_DECISION;
- this->cur_seq_num_ = 1;
-
- // Try to schedule and recursively continue planning.
- if (this->planner_->recurse_sched (this->cur_task_inst_))
- return true;
- }
-
- // No task implementation worked so return failure.
- return false;
- }
-
- // Choose an open threat to satisfy and remove from open threats.
- CLThreat threat = *this->open_threats_.begin ();
- CommandID rmv_threat_cmd_id = this->rmv_open_threat (threat);
-
- // Create threat resolution command and add to planner.
- ResolveCLThreatCmd *resolve_threat_cmd =
- static_cast<ResolveCLThreatCmd *> (this->resolve_threat_cmd_->clone ());
- resolve_threat_cmd->set_id (this->get_next_cmd_id ());
- resolve_threat_cmd->set_threat (threat);
- this->planner_->add_command (resolve_threat_cmd);
-
- // Try threat resolutions until one yields a complete plan or all have been
- // tried.
- while (this->planner_->try_next (resolve_threat_cmd->get_id ())) {
- if (this->satisfy_open_threats ())
- return true;
- }
-
- // Undo threat resolution.
- this->planner_->undo_command (resolve_threat_cmd->get_id ());
-
- // Undo removal of open threat.
- this->planner_->undo_command (rmv_threat_cmd_id);
-
- // No threat resolution was successful so return failure.
- return false;
-};
+
+
// Satisfy an open condition with an appropriate task.
AddTaskCmd *SA_PlanStrategy::satisfy_cond (Condition open_cond)
{
- // Get add task command.
- AddTaskCmd *add_task_cmd =
- static_cast<AddTaskCmd *> (this->add_task_cmd_->clone ());
- TaskList task_list = this->task_choice_->choose_task (open_cond);
- add_task_cmd->set_id (this->get_next_cmd_id ());
- add_task_cmd->set_tasks (task_list);
-
- // Get task instances requiring this open condition, and set in command.
- TaskInstSet inst_set;
- inst_set.clear ();
- for (OpenCondMap::iterator iter = this->open_conds_.lower_bound (open_cond);
- iter != this->open_conds_.upper_bound (open_cond); iter++)
- {
- inst_set.insert (iter->second);
- }
- add_task_cmd->set_causal_info (open_cond, inst_set);
-
- // Add command to planner to be executed next.
- this->planner_->add_command (add_task_cmd);
-
- // Return pointer to command.
- return add_task_cmd;
+ // Get add task command.
+ AddTaskCmd *add_task_cmd =
+ static_cast<AddTaskCmd *> (this->add_task_cmd_->clone ());
+ TaskChoiceList task_list = this->task_choice_->choose_task_fair (open_cond);
+ add_task_cmd->set_id (this->get_next_cmd_id ());
+ add_task_cmd->set_tasks (task_list);
+
+ // Get task instances requiring this open condition, and set in command.
+ TaskInstSet inst_set;
+ inst_set.clear ();
+ for (OpenCondMap::iterator iter = this->open_conds_.lower_bound (open_cond);
+ iter != this->open_conds_.upper_bound (open_cond); iter++)
+ {
+ if(iter->first.value == open_cond.value){
+ inst_set.insert (iter->second);
+ break;
+ }
+ }
+ add_task_cmd->set_causal_info (open_cond, inst_set);
+
+ // Add command to planner to be executed next.
+ this->planner_->add_command (add_task_cmd);
+
+ // Return pointer to command.
+ return add_task_cmd;
};
// Add open conditions.
CommandID SA_PlanStrategy::add_open_conds (const CondSet &open_conds,
- TaskInstID task_inst)
+ TaskInstID task_inst)
{
- // Get command to add open conditions for task instance.
- AddOpenCondsCmd *add_conds_cmd =
- static_cast<AddOpenCondsCmd *> (this->add_conds_cmd_->clone ());
- add_conds_cmd->set_conds (open_conds);
- add_conds_cmd->set_task_inst (task_inst);
- CommandID cmd_id = this->get_next_cmd_id ();
- add_conds_cmd->set_id (cmd_id);
-
- // Execute command immediately and return command id.
- this->planner_->execute_command (add_conds_cmd);
- return cmd_id;
+ // Get command to add open conditions for task instance.
+ AddOpenCondsCmd *add_conds_cmd =
+ static_cast<AddOpenCondsCmd *> (this->add_conds_cmd_->clone ());
+ add_conds_cmd->set_conds (open_conds);
+ add_conds_cmd->set_task_inst (task_inst);
+ CommandID cmd_id = this->get_next_cmd_id ();
+ add_conds_cmd->set_id (cmd_id);
+
+ // Execute command immediately and return command id.
+ this->planner_->execute_command (add_conds_cmd);
+ return cmd_id;
};
// Remove open condition.
-CommandID SA_PlanStrategy::rmv_open_cond (Condition open_cond)
+CommandID SA_PlanStrategy::rmv_open_cond (Condition open_cond, TaskInstSet tasks)
{
- // Get commmand to remove open conditions.
- RemoveOpenCondsCmd *rmv_conds_cmd =
- static_cast<RemoveOpenCondsCmd *> (this->rmv_conds_cmd_->clone ());
- CondSet conds;
- conds.insert (open_cond);
- rmv_conds_cmd->set_conds (conds);
- CommandID cmd_id = this->get_next_cmd_id ();
- rmv_conds_cmd->set_id (cmd_id);
-
- // Execute command immediately and return command id.
- this->planner_->execute_command (rmv_conds_cmd);
- return cmd_id;
+ // Get commmand to remove open conditions.
+ RemoveOpenCondsCmd *rmv_conds_cmd =
+ static_cast<RemoveOpenCondsCmd *> (this->rmv_conds_cmd_->clone ());
+ CondSet conds;
+ conds.insert (open_cond);
+ rmv_conds_cmd->set_conds (conds, tasks);
+ CommandID cmd_id = this->get_next_cmd_id ();
+ rmv_conds_cmd->set_id (cmd_id);
+
+ // Execute command immediately and return command id.
+ this->planner_->execute_command (rmv_conds_cmd);
+ return cmd_id;
};
// Add open causal link threats.
CommandID SA_PlanStrategy::add_open_threats (const CLThreatSet &threats)
{
- // Get commmand to add open threats.
- AddOpenThreatsCmd *add_threats_cmd =
- static_cast<AddOpenThreatsCmd *> (this->add_threats_cmd_->clone ());
- add_threats_cmd->set_threats (threats);
- CommandID cmd_id = this->get_next_cmd_id ();
- add_threats_cmd->set_id (cmd_id);
-
- // Execute command immediately and return command id.
- this->planner_->execute_command (add_threats_cmd);
- return cmd_id;
+ // Get commmand to add open threats.
+ AddOpenThreatsCmd *add_threats_cmd =
+ static_cast<AddOpenThreatsCmd *> (this->add_threats_cmd_->clone ());
+ add_threats_cmd->set_threats (threats);
+ CommandID cmd_id = this->get_next_cmd_id ();
+ add_threats_cmd->set_id (cmd_id);
+
+ // Execute command immediately and return command id.
+ this->planner_->execute_command (add_threats_cmd);
+ return cmd_id;
};
// Remove open causal link threat.
CommandID SA_PlanStrategy::rmv_open_threat (CLThreat threat)
{
- // Get commmand to remove open threats.
- RemoveOpenThreatsCmd *rmv_threats_cmd =
- static_cast<RemoveOpenThreatsCmd *> (this->rmv_threats_cmd_->clone ());
- CLThreatSet threats;
- threats.insert (threat);
- rmv_threats_cmd->set_threats (threats);
- CommandID cmd_id = this->get_next_cmd_id ();
- rmv_threats_cmd->set_id (cmd_id);
-
- // Execute command immediately and return command id.
- this->planner_->execute_command (rmv_threats_cmd);
- return cmd_id;
+ // Get commmand to remove open threats.
+ RemoveOpenThreatsCmd *rmv_threats_cmd =
+ static_cast<RemoveOpenThreatsCmd *> (this->rmv_threats_cmd_->clone ());
+ CLThreatSet threats;
+ threats.insert (threat);
+ rmv_threats_cmd->set_threats (threats);
+ CommandID cmd_id = this->get_next_cmd_id ();
+ rmv_threats_cmd->set_id (cmd_id);
+
+ // Execute command immediately and return command id.
+ this->planner_->execute_command (rmv_threats_cmd);
+ return cmd_id;
};
diff --git a/SA_POP/SA_PlanStrategy.h b/SA_POP/SA_PlanStrategy.h
index 3d4fcebede3..b3933ffe964 100644
--- a/SA_POP/SA_PlanStrategy.h
+++ b/SA_POP/SA_PlanStrategy.h
@@ -183,6 +183,10 @@ namespace SA_POP {
*/
virtual void undo (SA_RemoveOpenThreatsCmd *cmd);
+ virtual bool satisfy_everything();
+ virtual bool satisfy_schedule(void);
+ virtual bool get_next_threat_resolution();
+
protected:
// ************************************************************************
// State information.
@@ -198,6 +202,9 @@ namespace SA_POP {
/// Set of open causal link threats.
CLThreatSet open_threats_;
+ /// Set of open causal link threats.
+ CLThreatSet closed_threats_;
+
/// ID of current task being tried (to satisfy an open condition).
TaskID cur_task_;
@@ -213,7 +220,10 @@ namespace SA_POP {
/// Current sequence number for commands in this decision point.
int cur_seq_num_;
+ ///Holds info about which tasks an add task cmd has satisfied
+ TaskInstSet satisfied_insts;
+ CLSet added_links;
// ************************************************************************
// Decision point numbers.
@@ -223,16 +233,16 @@ namespace SA_POP {
static const int TASK_DECISION = 1;
/// Causal link threat handling is second decision point.
- static const int THREAT_DECISION = 2;
+ static const int THREAT_DECISION = 3;
/// Task implementation choice is third decision point.
- static const int IMPL_DECISION = 3;
+ static const int IMPL_DECISION = 2;
/// Scheduling is fourth decision point.
- static const int SCHEDULE_DECISION = 3;
-
-
+ static const int SCHEDULE_DECISION = 4;
+ StoredConditionEvaluator store_map;
+
// ************************************************************************
// Decision point heuristic strategies.
// ************************************************************************
@@ -281,8 +291,6 @@ namespace SA_POP {
/// plan (with promotion or demotion).
ResolveCLThreatCmd *resolve_threat_cmd_;
-
-
// ************************************************************************
// Internal helper methods.
// ************************************************************************
@@ -291,7 +299,7 @@ namespace SA_POP {
/**
* @return True if planning succeeded, false otherwise.
*/
- virtual bool satisfy_open_threats (void);
+// virtual bool satisfy_open_threats (void);
/// Satisfy an open condition with an appropriate task.
/**
@@ -318,7 +326,7 @@ namespace SA_POP {
*
* @return ID of command passed to planner to remove open condition.
*/
- virtual CommandID rmv_open_cond (Condition open_cond);
+ virtual CommandID rmv_open_cond (Condition open_cond, TaskInstSet tasks);
/// Add open causal link threats.
/**
diff --git a/SA_POP/SA_SchedStrategy.cpp b/SA_POP/SA_SchedStrategy.cpp
index ed333eb1864..d975bb145c5 100644
--- a/SA_POP/SA_SchedStrategy.cpp
+++ b/SA_POP/SA_SchedStrategy.cpp
@@ -14,9 +14,13 @@
#include "SA_POP_Types.h"
#include "SA_SchedStrategy.h"
+#include "SA_WorkingPlan.h"
#include "Planner.h"
#include <list>
#include <set>
+#include <fstream>
+#include <algorithm>
+#include <vector>
using namespace SA_POP;
// Constructor.
@@ -82,6 +86,9 @@ CommandID SA_SchedStrategy::get_next_cmd_id (void)
// satisfaction of open conditions by recursive call back to planning).
bool SA_SchedStrategy::satisfy_sched (TaskInstID task_inst)
{
+
+
+
//****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
//return this->planner_->recurse_plan ();
// Adjust schedule.
@@ -89,13 +96,20 @@ bool SA_SchedStrategy::satisfy_sched (TaskInstID task_inst)
// Get the current command id to backtrack to.
CommandID cur_cmd_id = this->planner_->cur_command_id();
this->cur_seq_num_=1;
+
// Do the energy propogation for this task instance
// This function automatically does this for the task instances before and after it.
+
+
+
if(!this->energy_prop(task_inst))
{
+
+
this->planner_->undo_through(cur_cmd_id);
return false;
}
+
// Do the balance propogation related to time windows for this task instance
// and those unranked with respect to it
if(!this->time_balance_prop(task_inst))
@@ -140,7 +154,15 @@ bool SA_SchedStrategy::satisfy_sched (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
- return this->planner_->recurse_plan ();
+
+
+
+ if(!this->planner_->recurse_plan ()){
+ this->planner_->undo_through(cur_cmd_id);
+ return false;
+ }else{
+ return true;
+ }
};
// Satisfy fully instantiated plan.
@@ -156,6 +178,131 @@ bool SA_SchedStrategy::satisfy_full_sched ()
this->planner_->undo_through(cur_cmd_id);
return false;
}
+
+ SA_WorkingPlan* working_plan_tmp = (SA_WorkingPlan*)this->planner_->get_working_plan();
+
+ // working_plan_tmp->get_precedence_graph()
+ PrecedenceSet befores = (working_plan_tmp->get_precedence_graph().find(BEFORE)->second);
+ PrecedenceSet afters = (working_plan_tmp->get_precedence_graph().find(AFTER)->second);
+ PrecedenceSet simuls = (working_plan_tmp->get_precedence_graph().find(SIMUL)->second);
+ PrecedenceSet unrankeds = (working_plan_tmp->get_precedence_graph().find(UNRANKED)->second);
+
+ //double current_execution_time = 0
+ //vector currently executing actions
+
+
+ std::vector<TaskInstEndTimeSet> executing_tasks;
+
+ double current_execution_time = 0;
+
+ int total_tasks = befores.size();
+ int completed_tasks = 0;
+
+ while(completed_tasks < total_tasks){
+
+ for(PrecedenceSet::iterator it = befores.begin(); it != befores.end();){
+
+ PrecedenceSet::iterator prev_it = it++;
+ if((befores.find(prev_it->first))->second.empty()){
+
+ TaskInstEndTimeSet new_execute;
+ new_execute.inst = prev_it->first;
+
+
+ if(prev_it->first == INIT_TASK_INST_ID){
+ new_execute.end_time = current_execution_time + 0;
+ }else{
+ new_execute.end_time = current_execution_time + this->planner_->get_impl(working_plan_tmp->get_impl_id(prev_it->first))
+ ->get_duration();
+ }
+
+ executing_tasks.push_back(new_execute);
+ befores.erase(prev_it);
+ }
+ }
+
+ std::sort(executing_tasks.begin(), executing_tasks.end());
+
+ TaskInstEndTimeSet next_done = *executing_tasks.begin();
+ current_execution_time = next_done.end_time;
+
+ std::list<TaskInstEndTimeSet> to_remove;
+
+ for(std::vector<TaskInstEndTimeSet>::iterator it3 = executing_tasks.begin();
+ it3 != executing_tasks.end();){
+
+ if(it3->end_time != current_execution_time){
+ break;
+ }
+ std::vector<TaskInstEndTimeSet>::iterator prev_it = it3++;
+
+ std::cout<<"Task "<<prev_it->inst<<" finishes at time "<<prev_it->end_time<<std::endl;
+ completed_tasks++;
+
+ for(PrecedenceSet::iterator it2 = befores.begin(); it2 != befores.end(); it2++){
+ it2->second.erase(prev_it->inst);
+ }
+ befores.erase(prev_it->inst);
+ to_remove.push_front(*prev_it);
+ // executing_tasks.erase(prev_it);
+ }
+
+ for( std::list<TaskInstEndTimeSet>::iterator it3 = to_remove.begin(); it3 != to_remove.end(); it3++){
+ std::vector<TaskInstEndTimeSet>::iterator it4;
+ for(it4 = executing_tasks.begin(); it4 != executing_tasks.end(); it4++){
+ if(it4->inst == it3->inst){
+ break;
+ }
+ }
+ executing_tasks.erase(it4);
+ }
+ }
+
+ //while #actions finished != total actions
+ //find all actions with no more befores
+ //add to currently executing actions sorted by current_time + their duration
+ //take action(s if there are multiple that end at the same time) off currently executing actions
+ //
+ //remove them from the befores of all other actions
+ //remove them from befores
+ //current execution time = when they finish
+
+ /*
+ std::list<TaskInstID> execute_this_time;
+
+ int time = 0;
+ while(!befores.empty()){
+
+ execute_this_time.clear();
+
+ for(PrecedenceSet::iterator it = befores.begin(); it != befores.end();){
+
+ PrecedenceSet::iterator prev_it = it++;
+
+ if((befores.find(prev_it->first))->second.empty()){
+
+ execute_this_time.push_front(prev_it->first);
+
+ befores.erase(prev_it);
+ }
+ }
+
+
+ for(std::list<TaskInstID>::iterator it = execute_this_time.begin(); it != execute_this_time.end(); it++){
+
+ std::cout<<"Task "<<(*it)<<" can execute at time "<<time<<std::endl;
+
+ for(PrecedenceSet::iterator it2 = befores.begin(); it2 != befores.end(); it2++){
+ it2->second.erase(*it);
+ }
+ }
+ time++;
+
+
+
+ }
+ */
+
return true;
};
/// Calculate the min and max levels for the consumer of a task instance
@@ -172,6 +319,9 @@ void SA_SchedStrategy::calculate_levels(TaskInstID task_inst)
ResourceValue Q=this->planner_->get_capacity(rm_iter->first);
// The max and min levels at the consumer
ResourceValue cons_min=Q,cons_max=Q;
+
+ std::ostringstream debug_text;
+
for(TaskInstSet::const_iterator iter=unranked->begin();iter!=unranked->end();iter++)
{
// get the resourse usage by the task instance in the unranked set
@@ -184,16 +334,20 @@ void SA_SchedStrategy::calculate_levels(TaskInstID task_inst)
//The consumer of *iter can be executed before and its producer after the consumer of task_inst
if(start_win.second==NULL_TIME || temp_start.first<start_win.second)
{
- std::cout<<"The consumer of "<<*iter<<" can be executed before and its producer after the consumer of "<<task_inst<<std::endl;
+ debug_text<<"The consumer of "<<*iter<<" can be executed before and its producer after the consumer of "<<task_inst<<std::endl;
cons_min-=temp_rm_iter->second;
}
// The consumer of *iter has to executed before the consumer of task_inst
if(temp_start.second!=NULL_TIME && temp_start.second<start_win.first)
{
- std::cout<<"THe consumer of "<<*iter<<" has to executed before the consumer of "<<task_inst<<std::endl;
+ debug_text<<"THe consumer of "<<*iter<<" has to executed before the consumer of "<<task_inst<<std::endl;
cons_max-=temp_rm_iter->second;
}
}
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
LevelMap temp;
MinimumLevels::iterator iter1=this->min_cons_levels_.find(rm_iter->first);
// Insert dummy levels if this is a new task instance
@@ -290,7 +444,14 @@ bool SA_SchedStrategy::search(double min_crit)
for(TaskInstSet::iterator iter=all.begin();iter!=all.end();iter++)
{
Criticality crit_cons = this->crit(*iter);
- std::cout<<"Criticality of "<<*iter<<" consumer: "<<crit_cons.second<<std::endl;
+
+ std::ostringstream debug_text;
+
+ debug_text<<"Criticality of "<<*iter<<" consumer: "<<crit_cons.second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+
if(crit_cons.second>=max_crit.second)
{
max_crit=crit_cons;
@@ -341,7 +502,12 @@ bool SA_SchedStrategy::search(double min_crit)
///Precedence Link Based Balance Constraint Propogation 5.3.3 (labourie paper)
bool SA_SchedStrategy::prec_balance_prop (TaskInstID task_inst)
{
- std::cout<<"Doing Precedence balance prop for "<<task_inst<<std::endl;
+
+ std::ostringstream debug_text;
+ debug_text<<"Doing Precedence balance prop for "<<task_inst<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
CommandID cur_cmd_id = this->planner_->cur_command_id();
const TaskInstSet *unranked = this->planner_->get_prec_insts(task_inst,UNRANKED);
TimeWindow start_win = this->planner_->get_start_window(task_inst);
@@ -358,7 +524,10 @@ bool SA_SchedStrategy::prec_balance_prop (TaskInstID task_inst)
TimeWindow temp_end = this->planner_->get_end_window(*iter);
if(temp_start.second!=NULL_TIME && temp_start.second<start_win.first)
{
- std::cout<<"The consumer of "<<*iter<<" has to executed before"<<std::endl;
+ debug_text<<"The consumer of "<<*iter<<" has to executed before"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
if(temp_end.first!=NULL_TIME && (start_win.second==NULL_TIME || temp_end.first<start_win.second)) producers_unranked.insert(*iter);
//The consumer has to be executed before this task instance
ResourceMap temp_rm = this->planner_->get_all_resources(this->planner_->get_task_impl_from_inst(*iter));
@@ -401,7 +570,12 @@ bool SA_SchedStrategy::prec_balance_prop (TaskInstID task_inst)
///Time Based Balance Constraint Propogation 5.3.3 (labourie paper)
bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
{
- std::cout<<"Doing time balance prop for "<<task_inst<<std::endl;
+
+ std::ostringstream debug_text;
+ debug_text<<"Doing time balance prop for "<<task_inst<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
CommandID cur_cmd_id = this->planner_->cur_command_id();
const TaskInstSet *unranked = this->planner_->get_prec_insts(task_inst,UNRANKED);
TimeWindow start_win = this->planner_->get_start_window(task_inst);
@@ -420,7 +594,11 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
TimeWindow temp_end = this->planner_->get_end_window(*iter);
if(temp_start.second!=NULL_TIME && temp_start.second<start_win.first)
{
- std::cout<<"THe consumer of "<<*iter<<" has to executed before"<<std::endl;
+
+ debug_text<<"THe consumer of "<<*iter<<" has to execute before"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
//The consumer has to be executed before this task instance
ResourceMap temp_rm = this->planner_->get_all_resources(this->planner_->get_task_impl_from_inst(*iter));
ResourceMap::iterator temp_rm_iter = temp_rm.find(rm_iter->first);
@@ -429,7 +607,11 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
if(temp_end.first!=NULL_TIME && (start_win.second==NULL_TIME || temp_end.first<start_win.second))
{
// This task instance can be pushed before the task instance
- std::cout<<"Task inst "<<*iter<<" can cause trouble"<<std::endl;
+ debug_text<<"Task inst "<<*iter<<" can cause trouble"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+
if(producers_unranked.empty())
producers_unranked.push_front(*iter);
else
@@ -446,15 +628,23 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
else continue;
}
}
- std::cout<<"The producers_unranked list is: "<<std::endl;
+
+ debug_text<<"The producers_unranked list is: "<<std::endl;
for(std::list<TaskInstID>::iterator iter2=producers_unranked.begin();iter2!=producers_unranked.end();iter2++)
{
- std::cout<<*iter2<<" ";
+ debug_text<<*iter2<<" ";
}
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
if(level_before<0)
{
- std::cout<<"The level_before is negative"<<std::endl;
+ debug_text<<"The level_before is negative"<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
ResourceValue level_prod=0;
std::list<TaskInstID>::iterator iter2=producers_unranked.begin();
for(;iter2!=producers_unranked.end();iter2++)
@@ -466,7 +656,11 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
}
if(iter2==producers_unranked.end()) return false;
TimeWindow temp2_end = this->planner_->get_end_window(*iter2);
- std::cout<<"greater than "<<*iter2<<std::endl;
+ debug_text<<"greater than "<<*iter2<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
if(temp2_end.first>start_win.first)
{
AdjustMinTimesCmd *adj_min_times_cmd = static_cast<AdjustMinTimesCmd *> (this->adj_min_times_cmd_->clone ());
@@ -489,7 +683,10 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
const TaskInstSet *simul = this->planner_->get_prec_insts(task_inst,SIMUL);
for(TaskInstSet::const_iterator iter=simul->begin();iter!=simul->end();iter++)
{
- std::cout<<"calculating for "<<*iter<<std::endl;
+ debug_text<<"calculating for "<<*iter<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
ResourceMap temp_rm = this->planner_->get_all_resources(this->planner_->get_task_impl_from_inst(*iter));
ResourceMap::iterator temp_rm_iter = temp_rm.find(rm_iter->first);
//This task instance doesn't use this resource
@@ -500,7 +697,10 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
std::list<TaskInstID> producers_unranked;
for(TaskInstSet::const_iterator iter=unranked->begin();iter!=unranked->end();iter++)
{
- std::cout<<"checking out "<<*iter<<std::endl;
+ debug_text<<"checking out "<<*iter<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
TimeWindow temp_start = this->planner_->get_start_window(*iter);
TimeWindow temp_end = this->planner_->get_end_window(*iter);
if(end_win.first==NULL_TIME ||(temp_start.second!=NULL_TIME && temp_start.second<end_win.first))
@@ -564,7 +764,12 @@ bool SA_SchedStrategy::time_balance_prop (TaskInstID task_inst)
//otherwise, repeat these for this task instance till the windows stop changing and stop in this branch.
bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
{
- std::cout<<"Doing energy precedence calculations for "<<task_inst<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"Doing energy precedence calculations for "<<task_inst<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
CommandID cur_cmd_id = this->planner_->cur_command_id();
AdjustMinTimesCmd *adj_min_times_cmd = static_cast<AdjustMinTimesCmd *> (this->adj_min_times_cmd_->clone ());
AdjustMaxTimesCmd *adj_max_times_cmd = static_cast<AdjustMaxTimesCmd *> (this->adj_max_times_cmd_->clone ());
@@ -578,7 +783,7 @@ bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
{
//Based on all task instances before task_inst
ResourceValue Q = this->planner_->get_capacity(rm_iter->first);
- std::cout<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
+ debug_text<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
double first_before=-1,first_after=-1,second_before=0,second_after=0;
const TaskInstSet *before = this->planner_->get_prec_insts(task_inst,BEFORE);
const TaskInstSet *after = this->planner_->get_prec_insts(task_inst,AFTER);
@@ -616,7 +821,11 @@ bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
}
if(first_after!=-1 && max_end>first_after-second_after) max_end=first_after-second_after;
}
- std::cout<<"After calculations for resource "<<rm_iter->first<<" start_min="<<min_start<<" and end_max="<<max_end<<std::endl;
+ debug_text<<"After calculations for resource "<<rm_iter->first<<" start_min="<<min_start<<" and end_max="<<max_end<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
}
if(min_start!=start_win.first)
{
@@ -628,7 +837,10 @@ bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
+ }else{
+ delete adj_min_times_cmd;
}
+
if(max_end!=end_win.second)
{
max_times_changed=true;
@@ -639,6 +851,8 @@ bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
+ }else{
+ delete adj_max_times_cmd;
}
if(min_times_changed || max_times_changed)
{
@@ -657,29 +871,32 @@ bool SA_SchedStrategy::energy_prop (TaskInstID task_inst)
const TaskInstSet *aft = this->planner_->get_prec_insts(task_inst,AFTER);
const TaskInstSet *bef = this->planner_->get_prec_insts(task_inst,BEFORE);
- for(TaskInstSet::const_iterator iter = aft->begin();iter!=aft->end();iter++)
- {
- if(!this->energy_prop_after(*iter))
- {
- this->planner_->undo_through(cur_cmd_id);
- return false;
- }
- }
+ for(TaskInstSet::const_iterator iter = aft->begin();iter!=aft->end();iter++)
+ {
+ if(!this->energy_prop_after(*iter))
+ {
+ this->planner_->undo_through(cur_cmd_id);
+ return false;
+ }
+ }
- for(TaskInstSet::const_iterator iter = bef->begin();iter!=bef->end();iter++)
- {
- if(!this->energy_prop_before(*iter))
- {
- this->planner_->undo_through(cur_cmd_id);
- return false;
- }
- }
+ for(TaskInstSet::const_iterator iter = bef->begin();iter!=bef->end();iter++)
+ {
+ if(!this->energy_prop_before(*iter))
+ {
+ this->planner_->undo_through(cur_cmd_id);
+ return false;
+ }
+ }
+
return true;
}
/// Do the uni directional energy precedence propogation in the after direction
bool SA_SchedStrategy::energy_prop_after (TaskInstID task_inst)
{
- std::cout<<"Doing energy precedence after calculations for "<<task_inst<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"Doing energy precedence after calculations for "<<task_inst<<std::endl;
CommandID cur_cmd_id = this->planner_->cur_command_id();
AdjustMinTimesCmd *adj_min_times_cmd = static_cast<AdjustMinTimesCmd *> (this->adj_min_times_cmd_->clone ());
TimeWindow start_win = this->planner_->get_start_window(task_inst);
@@ -691,7 +908,7 @@ bool SA_SchedStrategy::energy_prop_after (TaskInstID task_inst)
{
//Based on all task instances before task_inst
ResourceValue Q = this->planner_->get_capacity(rm_iter->first);
- std::cout<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
+ debug_text<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
double first_before=-1,second_before=0;
const TaskInstSet *before = this->planner_->get_prec_insts(task_inst,BEFORE);
if(!before->empty())
@@ -707,7 +924,10 @@ bool SA_SchedStrategy::energy_prop_after (TaskInstID task_inst)
}
if(first_before!=-1 && min_start<first_before+second_before) min_start=first_before+second_before;
}
- std::cout<<"After after calculations for resource "<<rm_iter->first<<" start_min="<<min_start<<std::endl;
+ debug_text<<"After after calculations for resource "<<rm_iter->first<<" start_min="<<min_start<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
}
if(min_start!=start_win.first)
{
@@ -719,7 +939,11 @@ bool SA_SchedStrategy::energy_prop_after (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
+ }else{
+ delete adj_min_times_cmd;
}
+
+
if(min_times_changed)
{
//Since the time windows have changed, some unranked task instances have gone to before or after.
@@ -729,25 +953,28 @@ bool SA_SchedStrategy::energy_prop_after (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
- }
- //TaskInstSet aft = this->planner_->after_orderings(task_inst);
- //TaskInstSet bef = this->planner_->before_orderings(task_inst);
- const TaskInstSet *aft = this->planner_->get_prec_insts(task_inst,AFTER);
+
+ //TaskInstSet aft = this->planner_->after_orderings(task_inst);
+ //TaskInstSet bef = this->planner_->before_orderings(task_inst);
+ const TaskInstSet *aft = this->planner_->get_prec_insts(task_inst,AFTER);
- for(TaskInstSet::const_iterator iter = aft->begin();iter!=aft->end();iter++)
- {
- if(!this->energy_prop_after(*iter))
- {
- this->planner_->undo_through(cur_cmd_id);
- return false;
- }
- }
+ for(TaskInstSet::const_iterator iter = aft->begin();iter!=aft->end();iter++)
+ {
+ if(!this->energy_prop_after(*iter))
+ {
+ this->planner_->undo_through(cur_cmd_id);
+ return false;
+ }
+ }
+ }
return true;
}
/// Do the uni directional energy precedence propogation in the after direction
bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
{
- std::cout<<"Doing before energy precedence calculations for "<<task_inst<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"Doing before energy precedence calculations for "<<task_inst<<std::endl;
CommandID cur_cmd_id = this->planner_->cur_command_id();
AdjustMaxTimesCmd *adj_max_times_cmd = static_cast<AdjustMaxTimesCmd *> (this->adj_max_times_cmd_->clone ());
TimeWindow start_win = this->planner_->get_start_window(task_inst);
@@ -760,7 +987,7 @@ bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
{
//Based on all task instances before task_inst
ResourceValue Q = this->planner_->get_capacity(rm_iter->first);
- std::cout<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
+ debug_text<<"The capacity of resource:"<<rm_iter->first<<" is "<<Q<<std::endl;
double first_after=-1,second_after=0;
const TaskInstSet *after = this->planner_->get_prec_insts(task_inst,AFTER);
if(!after->empty() && end_win.second!=NULL_TIME)
@@ -783,7 +1010,10 @@ bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
}
if(first_after!=-1 && max_end>first_after-second_after) max_end=first_after-second_after;
}
- std::cout<<"After before calculations for resource "<<rm_iter->first<<" and end_max="<<max_end<<std::endl;
+ debug_text<<"After before calculations for resource "<<rm_iter->first<<" and end_max="<<max_end<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
}
if(max_end!=end_win.second)
{
@@ -795,6 +1025,8 @@ bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
+ }else{
+ delete adj_max_times_cmd;
}
if(max_times_changed)
{
@@ -805,9 +1037,9 @@ bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
this->planner_->undo_through(cur_cmd_id);
return false;
}
- }
+
//TaskInstSet bef = this->planner_->before_orderings(task_inst);
- const TaskInstSet *bef = this->planner_->get_prec_insts(task_inst,BEFORE);
+ const TaskInstSet *bef = this->planner_->get_prec_insts(task_inst,BEFORE);
for(TaskInstSet::const_iterator iter = bef->begin();iter!=bef->end();iter++)
{
@@ -817,5 +1049,7 @@ bool SA_SchedStrategy::energy_prop_before (TaskInstID task_inst)
return false;
}
}
+
+ }
return true;
}
diff --git a/SA_POP/SA_SchedStrategy.h b/SA_POP/SA_SchedStrategy.h
index 89c55a9f8fa..95b9e74fd2a 100644
--- a/SA_POP/SA_SchedStrategy.h
+++ b/SA_POP/SA_SchedStrategy.h
@@ -168,7 +168,7 @@ namespace SA_POP {
// ************************************************************************
/// Scheduling is fourth decision point.
- static const int SCHEDULE_DECISION = 3;
+ static const int SCHEDULE_DECISION = 4;
// ************************************************************************
// Prototypes of commands that work on other objects.
diff --git a/SA_POP/SA_WorkingPlan.cpp b/SA_POP/SA_WorkingPlan.cpp
index 4b3c66af188..b619a1e6d0f 100644
--- a/SA_POP/SA_WorkingPlan.cpp
+++ b/SA_POP/SA_WorkingPlan.cpp
@@ -3,13 +3,13 @@
//=============================================================================
/**
- * @file SA_WorkingPlan.cpp
- *
- * This file contains the implementation of the SA_WorkingPlan concrete class,
- * which implements a WorkingPlan that uses precedence graphs for scheduling.
- *
- * @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
- */
+* @file SA_WorkingPlan.cpp
+*
+* This file contains the implementation of the SA_WorkingPlan concrete class,
+* which implements a WorkingPlan that uses precedence graphs for scheduling.
+*
+* @author John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
+*/
//=============================================================================
#include "SA_POP_Types.h"
@@ -18,6 +18,8 @@
#include "PlanCommands.h"
#include "SA_PlanCommands.h"
+#include <stack>
+#include <fstream>
using namespace SA_POP;
@@ -34,581 +36,547 @@ adj_min_times_cmd_ (0),
adj_max_times_cmd_ (0),
add_threats_cmd_ (0)
{
- this->task_insts_.clear ();
- this->task_impls_.clear ();
- this->causal_links_.clear ();
- this->reused_insts_.clear();
- this->sched_links_.clear();
-
- // Clear goal.
- this->goal_.goal_id = "NULL";
- this->goal_.name = "NULL";
- this->goal_.abs_times.clear ();
- this->goal_.rel_times.clear ();
- this->goal_.goal_conds.clear ();
- this->goal_.start_window = std::make_pair (0, 0);
-
- // Clear plan.
- this->plan_.causal_links.clear ();
- this->plan_.connections.clear ();
- this->plan_.sched_links.clear ();
- this->plan_.task_insts.clear ();
- this->plan_.threat_links.clear ();
-
- this->add_task_cmd_ = new SA_AddTaskCmd (this);
- this->assoc_impl_cmd_ = new SA_AssocTaskImplCmd (this);
- this->resolve_threat_cmd_ = new SA_ResolveCLThreatCmd (this);
- this->resolve_sched_cmd_ = new SA_ResolveSchedOrderCmd (this);
- this->adj_min_times_cmd_ = new SA_AdjustMinTimesCmd (this);
- this->adj_max_times_cmd_ = new SA_AdjustMaxTimesCmd (this);
-
- PrecedenceSet temp;
- this->precedence_graph_.insert(std::make_pair(BEFORE,temp));
- this->precedence_graph_.insert(std::make_pair(AFTER,temp));
- this->precedence_graph_.insert(std::make_pair(SIMUL,temp));
- this->precedence_graph_.insert(std::make_pair(UNRANKED,temp));
-
- ////////////////////TEMPORARY///////////TEMPORARY/////////////////
-///For SPACE
-//this->durations.insert(std::make_pair(1,2));
-//this->durations.insert(std::make_pair(2,5));
-//this->durations.insert(std::make_pair(3,2));
-//this->durations.insert(std::make_pair(4,10));
-//this->durations.insert(std::make_pair(5,1));
-//this->durations.insert(std::make_pair(6,4));
-//
-//this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(22,28)));
-//this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(24,30)));
-//this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(17,23)));
-//this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(22,28)));
-//this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(15,21)));
-//this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(17,23)));
-//this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(5,19)));
-//this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(15,21)));
-//this->init_start.insert(std::make_pair(5,(TimeWindow)std::make_pair(0,18)));
-//this->init_end.insert(std::make_pair(5,(TimeWindow)std::make_pair(1,19)));
-//this->init_start.insert(std::make_pair(6,(TimeWindow)std::make_pair(0,9)));
-//this->init_end.insert(std::make_pair(6,(TimeWindow)std::make_pair(4,13)));
-///For sched_test1
-//this->durations.insert(std::make_pair(1,10));
-//this->durations.insert(std::make_pair(2,2));
-//this->durations.insert(std::make_pair(3,8));
-//this->durations.insert(std::make_pair(4,8));
-//this->durations.insert(std::make_pair(5,10));
-//this->durations.insert(std::make_pair(7,15));
-//this->durations.insert(std::make_pair(6,10));
-//
-//this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(10,30)));
-//this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(20,40)));
-//this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(8,28)));
-//this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(10,30)));
-//this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(0,20)));
-//this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(8,28)));
-//this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(0,20)));
-//this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(8,28)));
-//this->init_start.insert(std::make_pair(5,(TimeWindow)std::make_pair(0,20)));
-//this->init_end.insert(std::make_pair(5,(TimeWindow)std::make_pair(10,30)));
-//this->init_start.insert(std::make_pair(7,(TimeWindow)std::make_pair(10,NULL_TIME)));
-//this->init_end.insert(std::make_pair(7,(TimeWindow)std::make_pair(25,NULL_TIME)));
-//this->init_start.insert(std::make_pair(6,(TimeWindow)std::make_pair(25,NULL_TIME)));
-//this->init_end.insert(std::make_pair(6,(TimeWindow)std::make_pair(35,NULL_TIME)));
-//this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(10,NULL_TIME)));
-//this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(20,NULL_TIME)));
-//this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(8,NULL_TIME)));
-//this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(10,NULL_TIME)));
-//this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(0,NULL_TIME)));
-//this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(8,NULL_TIME)));
-//this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(0,NULL_TIME)));
-//this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(8,NULL_TIME)));
-//this->init_start.insert(std::make_pair(5,(TimeWindow)std::make_pair(0,NULL_TIME)));
-//this->init_end.insert(std::make_pair(5,(TimeWindow)std::make_pair(10,NULL_TIME)));
-
-/////For sched_test4
-//this->durations.insert(std::make_pair(1,10));
-//this->durations.insert(std::make_pair(2,5));
-//this->durations.insert(std::make_pair(3,5));
-//this->durations.insert(std::make_pair(4,5));
-//
-//this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-
-/////For sched_test5
-//this->durations.insert(std::make_pair(1,0));
-//this->durations.insert(std::make_pair(2,0));
-//this->durations.insert(std::make_pair(3,0));
-//this->durations.insert(std::make_pair(4,10));
-//
-//this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-//this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-
-///For sched_main_test
-//this->durations.insert(std::make_pair(1,0));
-//this->durations.insert(std::make_pair(2,0));
-//this->durations.insert(std::make_pair(3,0));
-//this->durations.insert(std::make_pair(4,0));
-//this->durations.insert(std::make_pair(5,0));
-//this->durations.insert(std::make_pair(6,0));
-//this->durations.insert(std::make_pair(7,0));
-//this->durations.insert(std::make_pair(8,0));
-//this->durations.insert(std::make_pair(9,1));
-//this->durations.insert(std::make_pair(10,0));
-//this->durations.insert(std::make_pair(11,0));
-//this->durations.insert(std::make_pair(12,0));
-//this->durations.insert(std::make_pair(13,0));
-//this->durations.insert(std::make_pair(14,0));
-//this->durations.insert(std::make_pair(15,0));
-//this->durations.insert(std::make_pair(16,0));
-//this->durations.insert(std::make_pair(17,0));
-
-this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(5,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(5,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(6,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(6,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(7,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(7,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(8,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(8,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(9,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(9,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(10,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(10,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(11,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(11,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(12,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(12,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(13,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(13,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(14,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(14,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(15,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(15,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(16,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(16,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(18,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(18,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(19,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(19,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(20,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(20,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(21,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(21,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(22,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(22,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(23,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(23,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(24,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(24,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(25,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(25,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(26,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(26,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(27,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(27,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(28,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(28,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(29,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(29,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(30,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(30,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
+ this->task_insts_.clear ();
+ this->task_impls_.clear ();
+ this->causal_links_.clear ();
+ this->reused_insts_.clear();
+ this->sched_links_.clear();
+
+ // Clear goal.
+ this->goal_.goal_id = "NULL";
+ this->goal_.name = "NULL";
+ this->goal_.abs_times.clear ();
+ this->goal_.rel_times.clear ();
+ this->goal_.goal_conds.clear ();
+ this->goal_.start_window = std::make_pair (0, 0);
+
+ // Clear plan.
+ this->plan_.causal_links.clear ();
+ this->plan_.connections.clear ();
+ this->plan_.sched_links.clear ();
+ this->plan_.task_insts.clear ();
+ this->plan_.threat_links.clear ();
+
+ this->add_task_cmd_ = new SA_AddTaskCmd (this);
+ this->assoc_impl_cmd_ = new SA_AssocTaskImplCmd (this);
+ this->resolve_threat_cmd_ = new SA_ResolveCLThreatCmd (this);
+ this->resolve_sched_cmd_ = new SA_ResolveSchedOrderCmd (this);
+ this->adj_min_times_cmd_ = new SA_AdjustMinTimesCmd (this);
+ this->adj_max_times_cmd_ = new SA_AdjustMaxTimesCmd (this);
+
+ PrecedenceSet temp;
+ this->precedence_graph_.insert(std::make_pair(BEFORE,temp));
+ this->precedence_graph_.insert(std::make_pair(AFTER,temp));
+ this->precedence_graph_.insert(std::make_pair(SIMUL,temp));
+ this->precedence_graph_.insert(std::make_pair(UNRANKED,temp));
+
+ this->init_start.insert(std::make_pair(-6, (TimeWindow)std::make_pair(NULL_TIME, NULL_TIME)));
+ this->init_end.insert(std::make_pair(-6, (TimeWindow)std::make_pair(NULL_TIME, NULL_TIME)));
+
+ for(int i = 0; i < 2; i++){
+ this->init_start.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
+ this->init_end.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
+ }
+
+ this->no_condition.id = -4;
+ this->no_link.cond.id = -4;
+ this->no_link.first = -4;
+ this->no_link.second = -4;
+
+ this->task_impls_.insert(std::pair<TaskInstID, TaskImplID>(INIT_TASK_INST_ID, INIT_TASK_IMPL_ID));
+ this->task_insts_.insert(std::pair<TaskInstID, TaskID>(INIT_TASK_INST_ID, INIT_TASK_ID));
+
};
// Destructor.
SA_WorkingPlan::~SA_WorkingPlan (void)
{
- // Nothing to do.
+ // Nothing to do.
};
//Reset Plan.
void SA_WorkingPlan::reset_plan ()
{
-
+
next_inst_id_ =1;
this->task_insts_.clear ();
this->task_impls_.clear ();
- this->causal_links_.clear ();
- this->reused_insts_.clear();
- this->sched_links_.clear();
-
- // Clear goal.
- this->goal_.goal_id = "NULL";
- this->goal_.name = "NULL";
- this->goal_.abs_times.clear ();
- this->goal_.rel_times.clear ();
- this->goal_.goal_conds.clear ();
- this->goal_.start_window = std::make_pair (0, 0);
-
- // Clear plan.
- this->plan_.causal_links.clear ();
- this->plan_.connections.clear ();
- this->plan_.sched_links.clear ();
- this->plan_.task_insts.clear ();
- this->plan_.threat_links.clear ();
-
- this->precedence_graph_.clear();
-
- this->init_start.clear();
- this->init_end.clear();
-
- PrecedenceSet temp;
- this->precedence_graph_.insert(std::make_pair(BEFORE,temp));
- this->precedence_graph_.insert(std::make_pair(AFTER,temp));
- this->precedence_graph_.insert(std::make_pair(SIMUL,temp));
- this->precedence_graph_.insert(std::make_pair(UNRANKED,temp));
-
-
-
-this->init_start.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(1,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(2,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(3,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(4,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(5,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(5,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(6,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(6,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(7,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(7,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(8,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(8,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(9,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(9,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(10,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(10,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(11,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(11,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(12,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(12,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(13,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(13,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(14,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(14,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(15,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(15,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(16,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(16,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(17,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(18,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(18,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(19,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(19,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(20,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(20,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(21,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(21,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(22,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(22,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(23,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(23,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(24,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(24,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(25,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(25,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(26,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(26,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(27,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(27,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(28,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(28,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(29,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(29,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(30,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(30,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(31,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_start.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-this->init_end.insert(std::make_pair(32,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
-
-
+ this->causal_links_.clear ();
+ this->reused_insts_.clear();
+ this->sched_links_.clear();
+
+ // Clear goal.
+ this->goal_.goal_id = "NULL";
+ this->goal_.name = "NULL";
+ this->goal_.abs_times.clear ();
+ this->goal_.rel_times.clear ();
+ this->goal_.goal_conds.clear ();
+ this->goal_.start_window = std::make_pair (0, 0);
+
+ // Clear plan.
+ this->plan_.causal_links.clear ();
+ this->plan_.connections.clear ();
+ this->plan_.sched_links.clear ();
+ this->plan_.task_insts.clear ();
+ this->plan_.threat_links.clear ();
+
+ this->precedence_graph_.clear();
+
+ this->init_start.clear();
+ this->init_end.clear();
+
+ PrecedenceSet temp;
+ this->precedence_graph_.insert(std::make_pair(BEFORE,temp));
+ this->precedence_graph_.insert(std::make_pair(AFTER,temp));
+ this->precedence_graph_.insert(std::make_pair(SIMUL,temp));
+ this->precedence_graph_.insert(std::make_pair(UNRANKED,temp));
}
// Set goal.
void SA_WorkingPlan::set_goal (const SA_POP::Goal &goal)
{
- this->goal_ = goal;
+ this->goal_ = goal;
};
// Set command prototypes to use.
void SA_WorkingPlan::set_commands (AddOpenThreatsCmd *add_threats_cmd)
{
- if (add_threats_cmd == 0)
- return;
+ if (add_threats_cmd == 0)
+ return;
- this->add_threats_cmd_ = add_threats_cmd;
- this->has_cmds_ = true;
+ this->add_threats_cmd_ = add_threats_cmd;
+ this->has_cmds_ = true;
};
// Helper function to create next instance id.
TaskInstID SA_WorkingPlan::get_next_inst_id (void)
{
- TaskInstID inst_id = this->next_inst_id_;
- this->next_inst_id_++;
- return inst_id;
+ TaskInstID inst_id = this->next_inst_id_;
+ this->next_inst_id_++;
+ return inst_id;
};
// Get current plan.
const Plan& SA_WorkingPlan::get_plan (void)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // Should track whether plan has changed rather than regenerating every time.
-
- // Clear plan.
- this->plan_.causal_links.clear ();
- this->plan_.connections.clear ();
- this->plan_.sched_links.clear ();
- this->plan_.task_insts.clear ();
- this->plan_.threat_links.clear ();
-
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // (Need absolute windows from goal)
- // Set time windows.
- this->plan_.start_window = std::make_pair (0, 0);
- this->plan_.end_window = std::make_pair (0, 0);
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // (Need goal structure to set plan ID & name)
- // Set plan ID and name from goal.
- this->plan_.plan_id = "1";
- this->plan_.name = this->plan_.plan_id;
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-
- // Add task instances to plan.
- for (SA_WorkingPlan::InstToTaskMap::iterator iter =
- this->task_insts_.begin ();
- iter != this->task_insts_.end (); iter++)
- {
- // Creat task instance and set instance and task IDs from task instance map.
- PlanTaskInst inst;
- inst.inst_id = iter->first;
- inst.task_id = iter->second;
-
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // (Need to add separate Type to task nodes instead of using name.)
- // Set instance type.
- inst.type_id = this->planner_->get_task_name (inst.task_id);
- // Give instance a name.
- inst.name = "TaskInst";
- inst.name += to_string (inst.inst_id);
- inst.name += "_";
- inst.name += inst.type_id;
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-
- // Set start and end windows for this instance.
- SA_WorkingPlan::InstToWinMap::iterator win_iter;
- win_iter = this->start_window_map_.find (inst.inst_id);
- if (win_iter != this->start_window_map_.end ())
- inst.start_window = win_iter->second;
- else
- throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find start window for task instance.";
- win_iter = this->end_window_map_.find (inst.inst_id);
- if (win_iter != this->end_window_map_.end ())
- inst.end_window = win_iter->second;
- else
- throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find end window for task instance.";
-
- // Set suggested implementation for this instance.
- InstToImplMap::iterator impl_iter;
- impl_iter = this->task_impls_.find (inst.inst_id);
- if (impl_iter != this->task_impls_.end ())
- inst.suggested_impl = impl_iter->second;
- else
- throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find implementation from task instance.";
-
- // Add instance to plan.
- this->plan_.task_insts.insert (inst);
- }
-
- // Add scheduling links.
- for (SA_WorkingPlan::SchedulingLinks::iterator sched_iter =
- this->sched_links_.begin ();
- sched_iter != this->sched_links_.end (); sched_iter++)
- {
- this->plan_.sched_links.insert (std::make_pair (
- sched_iter->first, sched_iter->second));
- }
-
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- // (Need to include threat links.)
- // Add threat links.
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
-
-
- // Add plan data connections and causal links.
- for (SA_WorkingPlan::CondToCLinksMap::iterator cl_iter =
- this->causal_links_.begin ();
- cl_iter != this->causal_links_.end (); cl_iter++)
- {
- // If this is the placeholder goal task instance, don't add connection.
- if (cl_iter->second.second == SA_POP::GOAL_TASK_INST_ID)
- continue;
-
- // If this condition is a data condition, add data connection to plan.
- if (cl_iter->first.kind == SA_POP::DATA) {
- PlanConnection plan_conn;
-
- // Set condition.
- plan_conn.cond = cl_iter->first.id;
-
- // Set task instances.
- plan_conn.first_task_inst = cl_iter->second.first;
- plan_conn.second_task_inst = cl_iter->second.second;
-
- // Get task ids from instances.
- SA_WorkingPlan::InstToTaskMap::iterator inst_task_iter;
-
- inst_task_iter = this->task_insts_.find (cl_iter->second.first);
- if (inst_task_iter == this->task_insts_.end ())
- throw "SA_POP::SA_WorkingPlan::get_plan (): couldn't find task id for task instance to get port for plan connection.";
- TaskID first_task = inst_task_iter->second;
-
- inst_task_iter = this->task_insts_.find (cl_iter->second.second);
- if (inst_task_iter == this->task_insts_.end ())
- throw "SA_POP::SA_WorkingPlan::get_plan (): couldn't find task id for task instance to get port for plan connection.";
- TaskID second_task = inst_task_iter->second;
-
- // Get ports.
- LinkPorts ports = this->planner_->get_clink_ports
- (first_task, cl_iter->first.id, second_task);
- plan_conn.first_port = ports.first;
- plan_conn.second_port = ports.second;
-
- this->plan_.connections.insert (plan_conn);
- } else { // This is a non-data condition so add causal link to plan.
- this->plan_.causal_links.insert (cl_iter->second);
- }
- }
-
- return this->plan_;
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // Should track whether plan has changed rather than regenerating every time.
+
+ // Clear plan.
+ this->plan_.causal_links.clear ();
+ this->plan_.connections.clear ();
+ this->plan_.sched_links.clear ();
+ this->plan_.task_insts.clear ();
+ this->plan_.threat_links.clear ();
+
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // (Need absolute windows from goal)
+ // Set time windows.
+ this->plan_.start_window = std::make_pair (0, 0);
+ this->plan_.end_window = std::make_pair (0, 0);
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // (Need goal structure to set plan ID & name)
+ // Set plan ID and name from goal.
+ this->plan_.plan_id = "1";
+ this->plan_.name = this->plan_.plan_id;
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+ // Add task instances to plan.
+ for (InstToTaskMap::iterator iter =
+ this->task_insts_.begin ();
+ iter != this->task_insts_.end (); iter++)
+ {
+ // Creat task instance and set instance and task IDs from task instance map.
+ PlanTaskInst inst;
+ inst.inst_id = iter->first;
+ inst.task_id = iter->second;
+
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+ // (Need to add separate Type to task nodes instead of using name.)
+ // Set instance type.
+ inst.type_id = this->planner_->get_task_name (inst.task_id);
+ // Give instance a name.
+ inst.name = "TaskInst";
+ inst.name += to_string (inst.inst_id);
+ inst.name += "_";
+ inst.name += inst.type_id;
+ //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+ // Set start and end windows for this instance.
+ SA_WorkingPlan::InstToWinMap::iterator win_iter;
+ win_iter = this->start_window_map_.find (inst.inst_id);
+ if (win_iter != this->start_window_map_.end ())
+ inst.start_window = win_iter->second;
+ else
+ throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find start window for task instance.";
+ win_iter = this->end_window_map_.find (inst.inst_id);
+ if (win_iter != this->end_window_map_.end ())
+ inst.end_window = win_iter->second;
+ else
+ throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find end window for task instance.";
+
+ // Set suggested implementation for this instance.
+ InstToImplMap::iterator impl_iter;
+ impl_iter = this->task_impls_.find (inst.inst_id);
+ if (impl_iter != this->task_impls_.end ())
+ inst.suggested_impl = impl_iter->second;
+ else
+ throw "SA_POP::SA_WorkingPlan::get_plan (): Unable to find implementation from task instance.";
+
+ // Add instance to plan.
+ this->plan_.task_insts.insert (inst);
+ }
+
+ // Add scheduling links.
+ for (SA_WorkingPlan::SchedulingLinks::iterator sched_iter =
+ this->sched_links_.begin ();
+ sched_iter != this->sched_links_.end (); sched_iter++)
+ {
+ this->plan_.sched_links.insert (std::make_pair (
+ sched_iter->first, sched_iter->second));
+ }
+
+ // Add plan data connections and causal links.
+ for (SA_WorkingPlan::CondToCLinksMap::iterator cl_iter =
+ this->causal_links_.begin ();
+ cl_iter != this->causal_links_.end (); cl_iter++)
+ {
+ // If this is the placeholder goal task instance, don't add connection.
+ if (cl_iter->second.second == SA_POP::GOAL_TASK_INST_ID)
+ continue;
+
+ // If this condition is a data condition, add data connection to plan.
+ if (cl_iter->first.kind == SA_POP::DATA) {
+ PlanConnection plan_conn;
+
+ // Set condition.
+ plan_conn.cond = cl_iter->first.id;
+
+ // Set task instances.
+ plan_conn.first_task_inst = cl_iter->second.first;
+ plan_conn.second_task_inst = cl_iter->second.second;
+
+ // Get task ids from instances.
+ InstToTaskMap::iterator inst_task_iter;
+
+ inst_task_iter = this->task_insts_.find (cl_iter->second.first);
+ if (inst_task_iter == this->task_insts_.end ())
+ throw "SA_POP::SA_WorkingPlan::get_plan (): couldn't find task id for task instance to get port for plan connection.";
+ TaskID first_task = inst_task_iter->second;
+
+ inst_task_iter = this->task_insts_.find (cl_iter->second.second);
+ if (inst_task_iter == this->task_insts_.end ())
+ throw "SA_POP::SA_WorkingPlan::get_plan (): couldn't find task id for task instance to get port for plan connection.";
+ TaskID second_task = inst_task_iter->second;
+
+ // Get ports.
+ LinkPorts ports = this->planner_->get_clink_ports
+ (first_task, cl_iter->first.id, second_task);
+ plan_conn.first_port = ports.first;
+ plan_conn.second_port = ports.second;
+
+ this->plan_.connections.insert (plan_conn);
+ } else { // This is a non-data condition so add causal link to plan.
+ this->plan_.causal_links.insert (cl_iter->second);
+ }
+ }
+
+ return this->plan_;
};
// Get set of task instances for a precedence relation to a task instance.
const TaskInstSet *SA_WorkingPlan::get_prec_set (TaskInstID task_inst, PrecedenceRelation prec_rel)
{
- PrecedenceGraph::iterator piter = this->precedence_graph_.find(prec_rel);
- PrecedenceSet::iterator titer = piter->second.find(task_inst);
- return &(titer->second);
+ PrecedenceGraph::iterator piter = this->precedence_graph_.find(prec_rel);
+ PrecedenceSet::iterator titer = piter->second.find(task_inst);
+ return &(titer->second);
};
// Get task id of a task instance.
TaskID SA_WorkingPlan::get_task_from_inst (TaskInstID inst_id)
{
- SA_WorkingPlan::InstToTaskMap::iterator iter =
- this->task_insts_.find (inst_id);
- if (iter == this->task_insts_.end ())
- throw "SA_POP::SA_WorkingPlan::get_task_from_inst (): requested instance id does not exist.";
+ if(inst_id == INIT_TASK_INST_ID){
+ return INIT_TASK_ID;
+ }
+
+ InstToTaskMap::iterator iter =
+ this->task_insts_.find (inst_id);
+ if (iter == this->task_insts_.end ())
+ throw "SA_POP::SA_WorkingPlan::get_task_from_inst (): requested instance id does not exist.";
- return iter->second;
+ return iter->second;
};
/// Get task implementation id of a task instance.
TaskImplID SA_WorkingPlan::get_task_impl_from_inst(TaskInstID inst_id)
{
+ if(!inst_has_impl(inst_id)) return NULL_TASK_IMPL_ID;
return this->task_impls_.find(inst_id)->second;
}
+bool SA_WorkingPlan::inst_has_impl(TaskInstID inst_id){
+
+ return !(task_impls_.find(inst_id) == task_impls_.end());
+}
+
+//Go through and find all conflicting tasks
+void SA_WorkingPlan::generate_all_threats(void)
+{
+ threat_set.clear();
+
+ std::ostringstream debug_text;
+ debug_text << "SA_WorkingPlan::generate_all_threats: All Causal Links: " << std::endl;
+
+
+
+ for(CondToCLinksMap::iterator nit = causal_links_.begin(); nit != causal_links_.end(); nit++){
+
+ CausalLink causal_threatened = (*nit).second;
+ TaskID threatened_task = this->task_insts_.find(causal_threatened.first)->second;
+ if(causal_threatened.second != -1)
+ debug_text << " Task ("<<threatened_task<<") " << "Inst ("<<causal_threatened.first<<") -(" << causal_threatened.cond.id << ")-> Task ("<<this->task_insts_.find(causal_threatened.second)->second<< ") Inst ("<< causal_threatened.second << ")" << std::endl;
+
+ }
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+
+ debug_text << "SA_WorkingPlan::generate_all_threats: All Tasks Instances: " << std::endl;
+
+ for(InstToTaskMap::iterator iterator = this->task_insts_.begin(); iterator != this->task_insts_.end(); iterator++){
+ TaskInstID threat_possibility = iterator->first;
+ TaskID threat_possibility_taskid = iterator->second;
+
+ if(iterator->first >= 858){
+ bool here = true;
+ }
+
+ debug_text <<" Task (" <<threat_possibility_taskid << ")"<< ": Inst (" <<iterator->first << ")" << std::endl;
+ }
+ debug_text<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_MINIMAL, debug_text.str ());
+ debug_text.str("");
+
+ debug_text << "SA_WorkingPlan::generate_all_threats: All Causal Threats: " << std::endl;
+
+ //Iterate through task instances
+ for(InstToTaskMap::iterator iterator = this->task_insts_.begin(); iterator != this->task_insts_.end(); iterator++){
+ TaskInstID threat_possibility = iterator->first;
+ TaskID threat_possibility_taskid = iterator->second;
+
+ if(threat_possibility_taskid == INIT_TASK_ID){
+ continue;
+ }
+
+ CondSet set = this->planner_->get_effects(threat_possibility_taskid);
+
+ //Iterate through the effects of each task instance
+ for(CondSet::iterator arr = set.begin(); arr != set.end(); arr++){
+
+ Condition condition = (*arr);
+
+ std::pair<
+ CondToCLinksMap::iterator,
+ CondToCLinksMap::iterator
+ > ret = this->causal_links_.equal_range(condition);
+
+ //Iterates through causal links
+ for(CondToCLinksMap::iterator nit = ret.first; nit != ret.second; nit++){
+
+ CausalLink causal_threatened = (*nit).second;
+ TaskID threatened_task = this->task_insts_.find(causal_threatened.first)->second;
+
+ SANet::LinkWeight threat_effect = this->planner_->get_link(threat_possibility_taskid, condition.id);
+
+ SANet::LinkWeight causal_effect;
+ if(threatened_task == INIT_TASK_ID){
+ causal_effect = 2*(this->planner_->get_cond_val(causal_threatened.cond.id)-.5);
+ }else{
+ causal_effect = this->planner_->get_link(threatened_task, causal_threatened.cond.id);
+ }
+
+ if((threat_effect > 0 && causal_effect < 0 )|| (threat_effect < 0 && causal_effect > 0)){
+
+ if(causal_threatened.first != threat_possibility && causal_threatened.second != threat_possibility)
+ {
+ bool a = false;
+ bool b = false;
+ PrecedenceSet::iterator after_thr_it = (&this->precedence_graph_.find(AFTER)->second)->find(threat_possibility);
+ PrecedenceSet::iterator before_thr_it= (&this->precedence_graph_.find(BEFORE)->second)->find(threat_possibility);
+
+ TaskInstSet after_threat = after_thr_it->second;
+ TaskInstSet before_threat = before_thr_it->second;
+
+ a = after_threat.find(causal_threatened.first) != after_threat.end();
+ b = before_threat.find(causal_threatened.second) != before_threat.end();
+
+ if(!(a || b))
+ {
+ CLThreat new_threat;
+ new_threat.clink = causal_threatened;
+ new_threat.threat = threat_possibility;
+
+
+
+ std::pair<CLThreatSet::iterator, bool> asdf = threat_set.insert(new_threat);
+
+
+
+ TaskID threatened_task1 = this->task_insts_.find(causal_threatened.first)->second;
+ if(causal_threatened.second != SA_POP::GOAL_TASK_INST_ID)
+ {
+ TaskID threatened_task2 = this->task_insts_.find(causal_threatened.second)->second;
+ debug_text <<" Causal link from Task ("<< threatened_task1 <<") Inst ("<< causal_threatened.first <<") to Task ("<< threatened_task2 <<") Inst ("<< causal_threatened.second <<") using condition "<<causal_threatened.cond.id<<" threatened by Task ("<< threat_possibility_taskid <<") Inst ("<<threat_possibility<<")" << std::endl;
+
+ }
+ else
+ {
+ debug_text <<" Causal link from Task ("<< threatened_task1 <<") Inst ("<< causal_threatened.first <<") to Task ( GOAL_TASK )Inst (GOAL_TASK_INST) using condition "<<causal_threatened.cond.id<<" threatened by Task ("<< threat_possibility_taskid <<") Inst ("<<threat_possibility<<")" << std::endl;
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ print_precedence_graph("SA_WorkingPlan::generate_all_threats");
+
+}
+
+void SA_WorkingPlan::print_precedence_graph(std::string source){
+
+ std::ostringstream debug_text;
+
+ PrecedenceSet* new_befores = &this->precedence_graph_.find(BEFORE)->second;
+ PrecedenceSet* new_afters = &this->precedence_graph_.find(AFTER)->second;
+ PrecedenceSet* new_simuls = &this->precedence_graph_.find(SIMUL)->second;
+ PrecedenceSet* new_unrankeds = &this->precedence_graph_.find(UNRANKED)->second;
+
+ debug_text << source<<": Precendence Sets: BEFORE: " << std::endl;
+ for(PrecedenceSet::iterator it = new_befores->begin(); it != new_befores->end(); it++){
+ debug_text<<" TaskInst ID "<<it->first<<" : ";
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ debug_text<<" "<<*jt;
+ }
+ debug_text<<std::endl;
+ }
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ debug_text << source<<": Precendence Sets: AFTER: " << std::endl;
+ for(PrecedenceSet::iterator it = new_afters->begin(); it != new_afters->end(); it++){
+ debug_text<<" TaskInst ID "<<it->first<<" : ";
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ debug_text<<" "<<*jt;
+ }
+ debug_text<<std::endl;
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+
+ debug_text << source<<": Precendence Sets: SIMUL: " << std::endl;
+ for(PrecedenceSet::iterator it = new_simuls->begin(); it != new_simuls->end(); it++){
+ debug_text<<" TaskInst ID "<<it->first<<" : ";
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ debug_text<<" "<<*jt;
+ }
+ debug_text<<std::endl;
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ debug_text << source<<": Precendence Sets: UNRANKED: " << std::endl;
+ for(PrecedenceSet::iterator it = new_unrankeds->begin(); it != new_unrankeds->end(); it++){
+ debug_text<<" TaskInst ID "<<it->first<<" : ";
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ debug_text<<" "<<*jt;
+ }
+ debug_text<<std::endl;
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+}
+
+
// Get all current causal link threats.
CLThreatSet SA_WorkingPlan::get_all_threats (void)
-{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
- CLThreatSet temp;
- temp.clear ();
- return temp;
+{
+ return threat_set;
};
//Get all the causal and data links TO the task instance
CLSet SA_WorkingPlan::get_before(TaskInstID task_inst)
{
- CLSet ret;
- for(CondToCLinksMap::iterator iter = this->causal_links_.begin();iter!=this->causal_links_.end();iter++)
- if(iter->second.second == task_inst) ret.insert(iter->second);
- return ret;
+ CLSet ret;
+ for(CondToCLinksMap::iterator iter = this->causal_links_.begin();iter!=this->causal_links_.end();iter++)
+ if(iter->second.second == task_inst) ret.insert(iter->second);
+ return ret;
}
//Get all the causal and data links FROM the task instance
CLSet SA_WorkingPlan::get_after(TaskInstID task_inst)
{
- CLSet ret;
- for(CondToCLinksMap::iterator iter = this->causal_links_.begin();iter!=this->causal_links_.end();iter++)
- if(iter->second.second != GOAL_TASK_INST_ID && iter->second.second != NULL_TASK_INST_ID && iter->second.first == task_inst) ret.insert(iter->second);
- return ret;
+ CLSet ret;
+ for(CondToCLinksMap::iterator iter = this->causal_links_.begin();iter!=this->causal_links_.end();iter++)
+ if(iter->second.second != GOAL_TASK_INST_ID && iter->second.second != NULL_TASK_INST_ID && iter->second.first == task_inst) ret.insert(iter->second);
+ return ret;
}
/// Get the Causal and Scheduling orderings to this task instance
TaskInstSet SA_WorkingPlan::before_orderings (TaskInstID inst_id)
{
- CLSet before_links = this->get_before(inst_id);
- TaskInstSet ret;
- for(CLSet::iterator iter=before_links.begin();iter!=before_links.end();iter++)
- {
- if(iter->cond.kind!=DATA) ret.insert(iter->first);
- }
- for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
- if(iter->second==inst_id) ret.insert(iter->first);
- return ret;
+ CLSet before_links = this->get_before(inst_id);
+ TaskInstSet ret;
+ for(CLSet::iterator iter=before_links.begin();iter!=before_links.end();iter++)
+ {
+ if(iter->cond.kind!=DATA) ret.insert(iter->first);
+ }
+ for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
+ if(iter->second==inst_id) ret.insert(iter->first);
+ return ret;
}
/// Get the Causal and Scheduling orderings from this task instance
TaskInstSet SA_WorkingPlan::after_orderings (TaskInstID inst_id)
{
- CLSet after_links = this->get_after(inst_id);
- TaskInstSet ret;
- for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
- if(iter->cond.kind!=DATA) ret.insert(iter->second);
- for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
- if(iter->first==inst_id) ret.insert(iter->second);
- return ret;
+ CLSet after_links = this->get_after(inst_id);
+ TaskInstSet ret;
+ for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
+ if(iter->cond.kind!=DATA) ret.insert(iter->second);
+ for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
+ if(iter->first==inst_id) ret.insert(iter->second);
+ return ret;
}
/// Get a PlanCommand prototype for adding a task to the plan.
AddTaskCmd *SA_WorkingPlan::get_AddTaskCmd (void)
{
- return static_cast<AddTaskCmd *> (this->add_task_cmd_->clone ());
+ return static_cast<AddTaskCmd *> (this->add_task_cmd_->clone ());
};
// Get a PlanCommand prototype for associating an implementation with a
// task instance in the plan.
AssocTaskImplCmd *SA_WorkingPlan::get_AssocTaskImplCmd (void)
{
- return static_cast<AssocTaskImplCmd *> (this->assoc_impl_cmd_->clone ());
+ return static_cast<AssocTaskImplCmd *> (this->assoc_impl_cmd_->clone ());
};
// Get a PlanCommand prototype for resolving a causal link threat in the
// plan (with promotion or demotion).
ResolveCLThreatCmd *SA_WorkingPlan::get_ResolveCLThreatCmd (void)
{
- return static_cast<ResolveCLThreatCmd *> (this->resolve_threat_cmd_->clone ());
+ return static_cast<ResolveCLThreatCmd *> (this->resolve_threat_cmd_->clone ());
};
// Get a PlanCommand prototype for resolving a scheduling conflict (i.e.
@@ -616,121 +584,351 @@ ResolveCLThreatCmd *SA_WorkingPlan::get_ResolveCLThreatCmd (void)
// between two task instances in the plan.
ResolveSchedOrderCmd *SA_WorkingPlan::get_ResolveSchedOrderCmd (void)
{
- return static_cast<ResolveSchedOrderCmd *> (this->resolve_sched_cmd_->clone ());
+ return static_cast<ResolveSchedOrderCmd *> (this->resolve_sched_cmd_->clone ());
};
// Get a PlanCommand prototype for adjusting the minimum times of a
// task instance in the plan.
AdjustMinTimesCmd *SA_WorkingPlan::get_AdjustMinTimesCmd (void)
{
- return static_cast<AdjustMinTimesCmd *> (this->adj_min_times_cmd_->clone ());
+ return static_cast<AdjustMinTimesCmd *> (this->adj_min_times_cmd_->clone ());
};
// Get a PlanCommand prototype for adjusting the maximum times of a
// task instance in the plan.
AdjustMaxTimesCmd *SA_WorkingPlan::get_AdjustMaxTimesCmd (void)
{
- return static_cast<AdjustMaxTimesCmd *> (this->adj_max_times_cmd_->clone ());
+ return static_cast<AdjustMaxTimesCmd *> (this->adj_max_times_cmd_->clone ());
};
void SA_WorkingPlan::execute (SA_AddTaskCmd *cmd)
{
- // Get task ID, condition, and instance ID.
- TaskID task = cmd->tasks_.front ();
- Condition cond = cmd->cond_;
- TaskInstID task_inst;
- if(cmd->last_task_ != task)
- {
- // The task instance is reused.
- for(InstToTaskMap::iterator iter = this->task_insts_.begin(); iter!=this->task_insts_.end();iter++)
- if(iter->second==cmd->tasks_.front())
- cmd->used_task_insts_.insert(iter->first);
- }
- if(cmd->used_task_insts_.empty())
- {
- task_inst = this->get_next_inst_id ();
- // Add task instance.
- this->task_insts_.insert (std::make_pair (task_inst, task));
- // Remove task from command and update last task and instance.
- cmd->tasks_.pop_front ();
- }
- else
- {
- // Reuse the task instance
- task_inst = *cmd->used_task_insts_.begin();
+
+ TaskChoice task_choice = cmd->tasks_.front();
+ TaskID task = task_choice.task_id;
+ TaskInstID task_inst;
+ Condition cond = cmd->cond_;
+
+ cmd->last_task_choice_ = task_choice;
+
+
+
+ if(task_choice.choice == REUSE_INST){
+
+ task_inst = task_choice.task_inst_id;
this->reused_insts_.insert(task_inst);
+ cmd->tasks_.pop_front();
}
- // Create causal links for each task instance depending on the condition.
- for (TaskInstSet::iterator inst_iter = cmd->task_insts_.begin ();
- inst_iter != cmd->task_insts_.end (); inst_iter++)
- {
- CausalLink clink;
- clink.cond = cond;
- clink.first = task_inst;
- clink.second = *inst_iter;
- CondToCLinksMap::iterator links_iter;
- for (links_iter = this->causal_links_.lower_bound (cond);links_iter != this->causal_links_.upper_bound (cond);links_iter++)
- if(links_iter->second == clink)
- break;
- if(links_iter==this->causal_links_.upper_bound(cond))
- {
- this->causal_links_.insert (std::make_pair (cond, clink));
- cmd->added_links_.insert(clink);
- }
- }
+ else if(task_choice.choice == NEW_INST){
+
+ // if(task == INIT_TASK_ID && this->planner_->init_added)
+ // {
+ // throw "Reached SA_WorkingPlan::execute (SA_AddTaskCmd *cmd) for Special Initial Action after it was already existing instance tried";
+ // }
+
+ if(task == INIT_TASK_ID){
+ // this->planner_->init_added = true;
+ bool asdf_problem = true;
+ }
+
+ task_inst = this->get_next_inst_id ();
+ // Add task instance.
+ this->task_insts_.insert (std::make_pair (task_inst, task));
+ // Remove this task from tasks still to try.
+ cmd->tasks_.pop_front ();
+ }
+
+
+
+ std::ostringstream debug_text;
+ debug_text << "SA_WorkingPlan::execute (SA_AddTaskCmd *cmd): Adding task (" << task << ") instance (" << task_inst << ") for condition (" << cond.id << ").";
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+
+ // Create causal links for each task instance depending on the condition.
+ for (TaskInstSet::iterator inst_iter = cmd->task_insts_.begin ();
+ inst_iter != cmd->task_insts_.end (); inst_iter++)
+ {
+ CausalLink clink;
+ clink.cond = cond;
+ clink.first = task_inst;
+ clink.second = *inst_iter;
+ CondToCLinksMap::iterator links_iter;
+
+ // Check whether this causal link already exists in working plan.
+ for (links_iter = this->causal_links_.lower_bound (cond);links_iter != this->causal_links_.upper_bound (cond);links_iter++)
+ if(links_iter->second == clink)
+ break;
+ // If causal link not found in working plan, add it to causal links
+ if(links_iter==this->causal_links_.upper_bound(cond))
+ {
+ std::ostringstream debug_text2;
+ debug_text2 << "SA_WorkingPlan::execute (SA_AddTaskCmd *cmd): Adding causal link (" << clink.first << " -" << clink.cond.id << "-> " << clink.second << ")";
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text2.str ());
+
+ this->causal_links_.insert (std::make_pair (cond, clink));
+ this->causal_links_by_first.insert (std::make_pair (clink.first, clink));
+ this->causal_links_by_second.insert (std::make_pair (clink.second, clink));
+
+ cmd->added_links_.insert(clink);
+ }
+ }
+
+ // Set this task and task instance as last used by command.
cmd->last_task_ = task;
cmd->last_task_inst_ = task_inst;
};
+//Check to see if a condition is suspended
+bool SA_WorkingPlan::condition_in_suspended(Condition condition, TaskInstID required_by){
+
+ std::pair<Condition, TaskInstID> condition_pair(condition, required_by);
+
+ return (this->suspended_conditions.find(condition_pair) != this->suspended_conditions.end());
+}
+
+//Helps with checking if a condition needs to be suspended
+CausalLink SA_WorkingPlan::clink_on_path(Condition condition, TaskInstID required_by){
+ std::set<TaskInstID> expanded;
+ expanded.clear();
+
+ return clink_on_path_aux(condition, required_by, expanded);
+}
+
+CausalLink SA_WorkingPlan::clink_on_path_aux(Condition condition, TaskInstID required_by,
+ std::set<TaskInstID> & expanded){
+
+ expanded.insert(required_by);
+
+ if(required_by == -1){
+ return this->no_link;
+ }
+
+ for(TaskToCLinksMap::iterator it = causal_links_by_first.lower_bound(required_by);
+ it != causal_links_by_first.upper_bound(required_by); it++){
+
+ if(expanded.find(it->second.second) != expanded.end()){
+ continue;
+ }
+
+ if(it->second.cond == condition){
+ return it->second;
+ }
+
+ CausalLink to_return = clink_on_path_aux(condition, it->second.second, expanded);
+
+ if(to_return != no_link){
+ return to_return;
+ }
+ }
+
+ return no_link;
+}
+
+//When a task is added, unsuspend tasks on that path
+void SA_WorkingPlan::unsuspend_listeners(CausalLink link, TaskInstID exception){
+
+ for(TaskToCLinksMap::iterator it = this->causal_links_by_first.lower_bound(link.second);
+ it != this->causal_links_by_first.upper_bound(link.second); it++){
+
+ unsuspend_listeners_aux(it->second, exception);
+ }
+}
+
+//Auxillery for unsuspending
+void SA_WorkingPlan::unsuspend_listeners_aux(CausalLink link, TaskInstID exception){
+
+ for(SuspendedConditionListenerMap::iterator it = this->suspended_listener_map.lower_bound(link);
+ it != this->suspended_listener_map.upper_bound(link);){
+
+ SuspendedConditionListenerMap::iterator prev_it = it++;
+
+ if(exception != prev_it->second.second){
+ this->suspended_conditions.erase(prev_it->second);
+ suspended_listener_map.erase(prev_it);
+ }
+ }
+
+
+
+ for(TaskToCLinksMap::iterator it = this->causal_links_by_first.lower_bound(link.second);
+ it != this->causal_links_by_first.upper_bound(link.second); it++){
+ unsuspend_listeners_aux(it->second, exception);
+ }
+}
+
+//Suspend a condition
+void SA_WorkingPlan::suspend_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by){
+
+ std::pair<Condition, TaskInstID> require_set (cond, required_by);
+ std::pair<CausalLink, std::pair<Condition, TaskInstID>> to_insert (suspended_by, require_set);
+
+ this->suspended_listener_map.insert(to_insert);
+ this->suspended_conditions.insert(require_set);
+}
+
+//Note that a condition should be removed from the suspend map
+void SA_WorkingPlan::resume_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by){
+ std::pair<Condition, TaskInstID> require_set (cond, required_by);
+ std::pair<CausalLink, std::pair<Condition, TaskInstID>> to_insert (suspended_by, require_set);
+
+ std::multimap<CausalLink, std::pair<Condition, TaskInstID>> ::iterator it;
+
+ for(it = suspended_listener_map.lower_bound(suspended_by);
+ it != suspended_listener_map.upper_bound(suspended_by); it++){
+ if(it->second == require_set){
+ break;
+ }
+ }
+
+ suspended_listener_map.erase(it);
+
+ this->suspended_conditions.erase(require_set);
+}
+
void SA_WorkingPlan::undo (SA_AddTaskCmd *cmd)
{
- if(cmd->used_task_insts_.empty())
- {
- // Remove task instance.
- this->task_insts_.erase (this->task_insts_.find(cmd->last_task_inst_));
- }
- else {
- // Remove the task instance from the set of reusable task instances
- cmd->used_task_insts_.erase(cmd->used_task_insts_.begin());
- this->reused_insts_.erase(this->reused_insts_.find(cmd->last_task_inst_));
- }
- // Remove causal links.
- for (SA_WorkingPlan::CondToCLinksMap::iterator cl_iter =
- this->causal_links_.lower_bound (cmd->cond_);
- cl_iter != this->causal_links_.upper_bound (cmd->cond_);)
- {
- SA_WorkingPlan::CondToCLinksMap::iterator prev_iter = cl_iter;
- cl_iter++;
- if (cmd->task_insts_.find (prev_iter->second.second) != cmd->task_insts_.end ())
- {
- for(CLSet::iterator iter = cmd->added_links_.begin();iter!=cmd->added_links_.end();iter++)
- {
- if(prev_iter->second == *iter)
- {
- this->causal_links_.erase (prev_iter);
- cmd->added_links_.erase(iter);
- break;
- }
- }
- }
- }
+
+
+ if(cmd->last_task_choice_.choice == NEW_INST){
+ this->task_insts_.erase (this->task_insts_.find(cmd->last_task_inst_));
+ }else{
+ this->reused_insts_.erase(this->reused_insts_.find(cmd->last_task_inst_));
+ }
+
+
+ for (SA_WorkingPlan::CondToCLinksMap::iterator cl_iter = this->causal_links_.lower_bound (cmd->cond_);
+ cl_iter != this->causal_links_.upper_bound (cmd->cond_);)
+ {
+ SA_WorkingPlan::CondToCLinksMap::iterator prev_iter = cl_iter;
+ cl_iter++;
+ if (cmd->task_insts_.find (prev_iter->second.second) != cmd->task_insts_.end ())
+ {
+ for(CLSet::iterator iter = cmd->added_links_.begin();iter!=cmd->added_links_.end();iter++)
+ {
+ if(prev_iter->second == *iter)
+ {
+
+ CausalLink clink = prev_iter->second;
+
+ this->causal_links_.erase (prev_iter);
+
+ break;
+ }
+ }
+ }
+ }
+
+ for (SA_WorkingPlan::TaskToCLinksMap::iterator cl_iter = this->causal_links_by_first.lower_bound (cmd->last_task_choice_.task_inst_id);
+ cl_iter != this->causal_links_by_first.upper_bound (cmd->last_task_choice_.task_inst_id);)
+ {
+ SA_WorkingPlan::TaskToCLinksMap::iterator prev_iter = cl_iter;
+ cl_iter++;
+ if (cmd->task_insts_.find (prev_iter->second.second) != cmd->task_insts_.end ())
+ {
+ for(CLSet::iterator iter = cmd->added_links_.begin();iter!=cmd->added_links_.end();iter++)
+ {
+ if(prev_iter->second == *iter)
+ {
+
+ CausalLink clink = prev_iter->second;
+
+ this->causal_links_by_first.erase (prev_iter);
+
+ break;
+ }
+ }
+ }
+ }
+
+ TaskInstID to_find = *(cmd->get_satisfied_tasks().begin());
+
+ for (SA_WorkingPlan::TaskToCLinksMap::iterator cl_iter = this->causal_links_by_second.lower_bound (to_find);
+ cl_iter != this->causal_links_by_second.upper_bound (to_find);)
+ {
+ SA_WorkingPlan::TaskToCLinksMap::iterator prev_iter = cl_iter;
+ cl_iter++;
+ if (cmd->task_insts_.find (prev_iter->second.second) != cmd->task_insts_.end ())
+ {
+ for(CLSet::iterator iter = cmd->added_links_.begin();iter!=cmd->added_links_.end();iter++)
+ {
+ if(prev_iter->second == *iter)
+ {
+
+ CausalLink clink = prev_iter->second;
+
+ this->causal_links_by_second.erase (prev_iter);
+ cmd->added_links_.erase(iter);
+ break;
+ }
+ }
+ }
+ }
};
+bool SA_WorkingPlan::is_null_link(CausalLink link){
+ return link == no_link;
+}
+
+bool SA_WorkingPlan::is_null_condition(Condition cond){
+ return cond == no_condition;
+}
+
+Condition SA_WorkingPlan::get_no_condition(){
+ return no_condition;
+}
+
// Execute a command to associate an implementation with a
// task instance in the plan.
bool SA_WorkingPlan::execute (SA_AssocTaskImplCmd *cmd)
{
- // Associate task instance with first implementation in list from command.
- if(this->reused_insts_.find(cmd->task_inst_)==this->reused_insts_.end())
- {
- this->task_impls_.insert (std::make_pair(cmd->task_inst_, cmd->impls_.front ()));
- this->durations.insert(std::make_pair(cmd->task_inst_, this->planner_->get_impl(cmd->impls_.front())->get_duration()));
- }
- // Update last implementation to this one and remove it from command.
- cmd->last_impl_ = cmd->impls_.front ();
- cmd->impls_.pop_front ();
+
+
+ // Associate task instance with first implementation in list from command.
+ if(this->reused_insts_.find(cmd->task_inst_)==this->reused_insts_.end())
+ {
+ this->task_impls_.insert (std::make_pair(cmd->task_inst_, cmd->impls_.front ()));
+ this->durations.insert(std::make_pair(cmd->task_inst_, this->planner_->get_impl(cmd->impls_.front())->get_duration()));
+
+
+ }
+
+ if(cmd->task_inst_ == INIT_TASK_INST_ID){
+ this->durations.insert(std::make_pair(cmd->task_inst_, 1));
+ }
+
+ // Update last implementation to this one and remove it from command.
+ cmd->last_impl_ = cmd->impls_.front ();
+ cmd->impls_.pop_front ();
// Update the precedence graph
- return this->init_prec_insert(cmd->task_inst_,cmd);
+
+ PrecedenceSet* befores = &this->precedence_graph_.find(BEFORE)->second;
+
+ PrecedenceSet::iterator find_inst = befores->find(cmd->task_inst_);
+ if(find_inst != befores->end()){
+ TaskInstSet before_task = find_inst->second;
+
+ for(TaskInstSet::iterator it = cmd->satisfied_insts.begin(); it != cmd->satisfied_insts.end(); it++){
+ if(before_task.find(*it) != before_task.end()){
+ return false;
+ }
+ }
+ }
+
+ cmd->got_to_scheduling = true;
+
+
+ cmd->saved_listener_map = suspended_listener_map;
+ cmd->saved_suspended_set = suspended_conditions;
+
+ for(CLSet::iterator it = cmd->added_links.begin(); it != cmd->added_links.end(); it++){
+ unsuspend_listeners(*it, it->first);
+ }
+
+ bool toReturn = this->init_prec_insert(cmd->task_inst_,cmd);
+
+ return toReturn;
+
};
// Undo a command to associate an implementation with a
@@ -738,30 +936,216 @@ bool SA_WorkingPlan::execute (SA_AssocTaskImplCmd *cmd)
void SA_WorkingPlan::undo (SA_AssocTaskImplCmd *cmd)
{
// Undo the time window adjustments and the precedence graph updations.
- this->undo(&cmd->max_adj_cmd);
- this->undo(&cmd->min_adj_cmd);
- this->prec_erase(cmd->task_inst_,cmd);
- cmd->causal_insertions.clear();
- cmd->simul_insertions.clear();
- if(this->reused_insts_.find(cmd->task_inst_)==this->reused_insts_.end())
- {
- this->durations.erase(this->durations.find(cmd->task_inst_));
- this->task_impls_.erase (cmd->task_inst_);
- }
+ PrecedenceSet* befores = &this->precedence_graph_.find(BEFORE)->second;
+ PrecedenceSet* afters = &this->precedence_graph_.find(AFTER)->second;
+ PrecedenceSet* simuls = &this->precedence_graph_.find(SIMUL)->second;
+ PrecedenceSet* unrankeds = &this->precedence_graph_.find(UNRANKED)->second;
+
+
+ if(cmd->got_to_scheduling){
+ suspended_listener_map = cmd->saved_listener_map;
+ suspended_conditions = cmd->saved_suspended_set;
+
+ this->undo(&cmd->max_adj_cmd);
+ this->undo(&cmd->min_adj_cmd);
+ this->prec_erase(cmd->task_inst_,cmd);
+ cmd->causal_insertions.clear();
+ cmd->simul_insertions.clear();
+
+
+ }
+
+ if(this->reused_insts_.find(cmd->task_inst_)==this->reused_insts_.end())
+ {
+ this->durations.erase(this->durations.find(cmd->task_inst_));
+ this->task_impls_.erase (cmd->task_inst_);
+ }
};
+PrecedenceGraph SA_WorkingPlan::get_precedence_graph(){
+ return this->precedence_graph_;
+}
+
// Execute a command to resolve a causal link threat in the
// plan (with promotion or demotion).
-void SA_WorkingPlan::execute (SA_ResolveCLThreatCmd *)
+bool SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+
+ std::ostringstream debug_text;
+
+
+ TaskInstID first_task_inst = cmd->first;
+ TaskInstID second_task_inst = cmd->second;
+ Condition condition = cmd->condition;
+
+
+ if(cmd->second == INIT_TASK_INST_ID){
+
+ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Cannot schedule before initial task"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ return false;
+ }
+
+ if(cmd->first == -1){
+
+ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Cannot push threat to after goal"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ if(cmd->second == 12){
+ bool a = true;
+ }
+
+ return false;
+ }
+
+ PrecedenceSet* befores = &this->precedence_graph_.find(BEFORE)->second;
+ PrecedenceSet* afters = &this->precedence_graph_.find(AFTER)->second;
+ PrecedenceSet* simuls = &this->precedence_graph_.find(SIMUL)->second;
+ PrecedenceSet* unrankeds = &this->precedence_graph_.find(UNRANKED)->second;
+
+
+ TaskInstSet *before_A = &befores->find(cmd->first)->second;
+ TaskInstSet *after_A = &afters->find(cmd->first)->second;
+ TaskInstSet *simul_A = &simuls->find(cmd->first)->second;
+ TaskInstSet *unranked_A = &unrankeds->find(cmd->first)->second;
+
+ TaskInstSet *before_B = &befores->find(cmd->second)->second;
+ TaskInstSet *after_B = &afters->find(cmd->second)->second;
+ TaskInstSet *simul_B = &simuls->find(cmd->second)->second;
+ TaskInstSet *unranked_B = &unrankeds->find(cmd->second)->second;
+
+
+ if(before_B->find(cmd->first) != before_B->end()){
+ //Don't need to resolve
+
+ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Threat has already been resolved: "<<cmd->first<<" is before "<<cmd->second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ return true;
+ }
+
+ if(after_B->find(cmd->first) != after_B->end()){
+ //impossible?
+ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Cannot schedule task inst"<<cmd->first<<" before task inst"<<cmd->second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ return false;
+
+ }
+
+ cmd->got_to_change_precedences = true;
+
+ cmd->befores = *befores;
+ cmd->afters = *afters;
+ cmd->simuls = *simuls;
+ cmd->unrankeds = *unrankeds;
+
+
+ TaskInstSet tmp;
+
+ before_B->insert(cmd->first);
+ unranked_B->erase(cmd->first);
+
+ for(TaskInstSet::iterator it = before_A->begin(); it != before_A->end(); it++){
+
+ before_B->insert(*it);
+ unranked_B->erase(*it);
+
+ afters->find(*it)->second.insert(cmd->second);
+ unrankeds->find(*it)->second.erase(cmd->second);
+
+
+ for(TaskInstSet::iterator it2 = after_B->begin(); it2 != after_B->end(); it2++){
+ befores->find(*it2)->second.insert(*it);
+ unrankeds->find(*it2)->second.erase(*it);
+
+ afters->find(*it)->second.insert(*it2);
+ unrankeds->find(*it)->second.erase(*it2);
+ }
+ }
+
+ after_A->insert(cmd->second);
+ unranked_A->erase(cmd->second);
+
+ for(TaskInstSet::iterator it = after_B->begin(); it != after_B->end(); it++){
+
+ after_A->insert(*it);
+ unranked_A->erase(*it);
+
+ befores->find(*it)->second.insert(cmd->first);
+ unrankeds->find(*it)->second.erase(cmd->first);
+
+ }
+
+
+ debug_text << "SA_WorkingPlan::execute (SA_ResolveCLThreatCmd * cmd): Now scheduling task "<<cmd->first<<" before "<<cmd->second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ return true;
};
// Undo a command to resolve a causal link threat in the
// plan (with promotion or demotion).
-void SA_WorkingPlan::undo (SA_ResolveCLThreatCmd *)
+void SA_WorkingPlan::undo (SA_ResolveCLThreatCmd * cmd)
{
- //****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP****TEMP
+
+ std::ostringstream debug_text;
+
+ debug_text << "SA_WorkingPlan::undo (SA_ResolveCLThreatCmd * cmd): Undoing scheduling task "<<cmd->first<<" before "<<cmd->second<<std::endl;
+ if(!cmd->got_to_change_precedences){
+ debug_text <<" no changes to the precedence graph to undo"<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ if(cmd->got_to_change_precedences){
+
+
+ PrecedenceSet* new_befores = &this->precedence_graph_.find(BEFORE)->second;
+ PrecedenceSet* new_afters = &this->precedence_graph_.find(AFTER)->second;
+ PrecedenceSet* new_simuls = &this->precedence_graph_.find(SIMUL)->second;
+ PrecedenceSet* new_unrankeds = &this->precedence_graph_.find(UNRANKED)->second;
+
+ for(PrecedenceSet::iterator it = cmd->befores.begin(); it != cmd->befores.end(); it++){
+ new_befores->find(it->first)->second.clear();
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ new_befores->find(it->first)->second.insert(*jt);
+ }
+ }
+
+ for(PrecedenceSet::iterator it = cmd->afters.begin(); it != cmd->afters.end(); it++){
+ new_afters->find(it->first)->second.clear();
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ new_afters->find(it->first)->second.insert(*jt);
+ }
+ }
+
+ for(PrecedenceSet::iterator it = cmd->simuls.begin(); it != cmd->simuls.end(); it++){
+ new_simuls->find(it->first)->second.clear();
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ new_simuls->find(it->first)->second.insert(*jt);
+ }
+ }
+
+ for(PrecedenceSet::iterator it = cmd->unrankeds.begin(); it != cmd->unrankeds.end(); it++){
+ new_unrankeds->find(it->first)->second.clear();
+ for(TaskInstSet::iterator jt = it->second.begin(); jt != it->second.end(); jt++){
+ new_unrankeds->find(it->first)->second.insert(*jt);
+ }
+ }
+
+ }
};
// Execute a command to resolve a scheduling conflict (i.e.
@@ -769,7 +1153,13 @@ void SA_WorkingPlan::undo (SA_ResolveCLThreatCmd *)
// between two task instances in the plan.
bool SA_WorkingPlan::execute (SA_ResolveSchedOrderCmd *cmd)
{
- std::cout<<"Scheduling "<<cmd->first<<" before "<<cmd->second<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"Scheduling "<<cmd->first<<" before "<<cmd->second<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
TaskInstID first_task_inst = cmd->first;
TaskInstID second_task_inst = cmd->second;
TimeWindow first_start,second_start;
@@ -778,7 +1168,7 @@ bool SA_WorkingPlan::execute (SA_ResolveSchedOrderCmd *cmd)
first_end = this->get_end_window(first_task_inst);
second_start = this->get_start_window(second_task_inst);
second_end = this->get_end_window(second_task_inst);
-
+
if(second_start.second!= NULL_TIME && (first_end.second==NULL_TIME || second_start.second<first_end.second))
{
// There is a need to adjust the max times
@@ -797,17 +1187,17 @@ bool SA_WorkingPlan::execute (SA_ResolveSchedOrderCmd *cmd)
return false;
}
else cmd->adj_min_times_cmd_=NULL;
-
+
PrecedenceSet *before = &this->precedence_graph_.find(BEFORE)->second;
PrecedenceSet *after = &this->precedence_graph_.find(AFTER)->second;
PrecedenceSet *simul = &this->precedence_graph_.find(SIMUL)->second;
PrecedenceSet *unranked = &this->precedence_graph_.find(UNRANKED)->second;
-
+
before->find(second_task_inst)->second.insert(first_task_inst);
after->find(first_task_inst)->second.insert(second_task_inst);
unranked->find(first_task_inst)->second.erase(unranked->find(first_task_inst)->second.find(second_task_inst));
unranked->find(second_task_inst)->second.erase(unranked->find(second_task_inst)->second.find(first_task_inst));
-
+
TaskInstSet after_second = this->after_orderings(second_task_inst);
for(TaskInstSet::iterator iter=simul->find(second_task_inst)->second.begin();iter!=simul->find(second_task_inst)->second.end();iter++)
after_second.insert(*iter);
@@ -846,16 +1236,16 @@ bool SA_WorkingPlan::execute (SA_ResolveSchedOrderCmd *cmd)
// between two task instances in the plan.
void SA_WorkingPlan::undo (SA_ResolveSchedOrderCmd *cmd)
{
- for(std::list<SA_ResolveSchedOrderCmd*>::reverse_iterator iter=cmd->cmds_.rbegin();iter!=cmd->cmds_.rend();iter++)
+ for(std::list<SA_ResolveSchedOrderCmd*>::reverse_iterator iter=cmd->cmds_.rbegin();iter!=cmd->cmds_.rend();iter++)
this->undo(*iter);
-
+
TaskInstID first_task_inst = cmd->first;
TaskInstID second_task_inst = cmd->second;
PrecedenceSet *before = &this->precedence_graph_.find(BEFORE)->second;
PrecedenceSet *after = &this->precedence_graph_.find(AFTER)->second;
PrecedenceSet *unranked = &this->precedence_graph_.find(UNRANKED)->second;
-
+
before->find(second_task_inst)->second.erase(before->find(second_task_inst)->second.find(first_task_inst));
after->find(first_task_inst)->second.erase(after->find(first_task_inst)->second.find(second_task_inst));
unranked->find(first_task_inst)->second.insert(second_task_inst);
@@ -870,242 +1260,285 @@ void SA_WorkingPlan::undo (SA_ResolveSchedOrderCmd *cmd)
// task instance in the plan.
bool SA_WorkingPlan::execute (SA_AdjustMinTimesCmd *cmd)
{
- std::cout<<"adjusting min time for "<<cmd->task_inst_<<std::endl;
+ std::ostringstream debug_text;
+ debug_text<<"adjusting min time for "<<cmd->task_inst_<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
TimeWindow *start_win = &this->start_window_map_.find(cmd->task_inst_)->second;
- TimeWindow *end_win = &this->end_window_map_.find(cmd->task_inst_)->second;
- // If this adjustment violated and time constraints, return false.
- if(start_win->second!=NULL_TIME &&(cmd->new_end_min==NULL_TIME || cmd->new_end_min>end_win->second || cmd->new_start_min>start_win->second))
- return false;
- // Set the new time window
- start_win->first = cmd->new_start_min;
- end_win->first = cmd->new_end_min;
-
- TimeWindow ts = this->get_start_window(cmd->task_inst_);
- TimeWindow es = this->get_end_window(cmd->task_inst_);
- CLSet after_links = this->get_after(cmd->task_inst_);
- if(after_links.empty()) std::cout<<"after links is empty"<<std::endl;
- TaskInstSet causal,sched,data;
- for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
- { if(iter->cond.kind!=DATA) causal.insert(iter->second);
- else data.insert(iter->second);
- }
- for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
- if(iter->first==cmd->task_inst_) sched.insert(iter->second);
-
- // Propagate this time window change to all the task instances ordered after this task instance
- for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
- {
- TimeWindow temp_start = this->get_start_window(*iter);
- TimeWindow temp_end = this->get_end_window(*iter);
- if(end_win->first>temp_start.first)
- {
- std::cout<<"adjusting time for causal "<<*iter<<std::endl;
- SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
- TimeValue dur = this->durations.find(*iter)->second;
- if(dur!=0) temp->set_times(*iter,end_win->first,end_win->first+this->durations.find(*iter)->second);
- else temp->set_times(*iter,end_win->first,temp_end.first);
- cmd->min_adjust_cmds.push_back(temp);
- }
- }
- if(sched.empty()) std::cout<<"sched is empty"<<std::endl;
- for(TaskInstSet::iterator iter=sched.begin();iter!=sched.end();iter++)
- {
- TimeWindow temp_start = this->get_start_window(*iter);
- TimeWindow temp_end = this->get_end_window(*iter);
- if(end_win->first>temp_start.first)
- {
- SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
- TimeValue dur = this->durations.find(*iter)->second;
- if(dur!=0) temp->set_times(*iter,end_win->first,end_win->first+this->durations.find(*iter)->second);
- else temp->set_times(*iter,end_win->first,temp_end.first);
- cmd->min_adjust_cmds.push_back(temp);
- }
- }
+ TimeWindow *end_win = &this->end_window_map_.find(cmd->task_inst_)->second;
+ // If this adjustment violated and time constraints, return false.
+ if(start_win->second!=NULL_TIME &&(cmd->new_end_min==NULL_TIME || cmd->new_end_min>end_win->second || cmd->new_start_min>start_win->second))
+ return false;
+ // Set the new time window
+ start_win->first = cmd->new_start_min;
+ end_win->first = cmd->new_end_min;
+
+ TimeWindow ts = this->get_start_window(cmd->task_inst_);
+ TimeWindow es = this->get_end_window(cmd->task_inst_);
+ CLSet after_links = this->get_after(cmd->task_inst_);
+ if(after_links.empty()) debug_text<<"after links is empty"<<std::endl;
+ TaskInstSet causal,sched,data;
+ for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
+ { if(iter->cond.kind!=DATA) causal.insert(iter->second);
+ else data.insert(iter->second);
+ }
+ for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
+ if(iter->first==cmd->task_inst_) sched.insert(iter->second);
+
+
+ // Propagate this time window change to all the task instances ordered after this task instance
+ for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
+ {
+ TimeWindow temp_start = this->get_start_window(*iter);
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(end_win->first>temp_start.first)
+ {
+ debug_text<<"adjusting time for causal "<<*iter<<std::endl;
+ SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
+ TimeValue dur = this->durations.find(*iter)->second;
+ if(dur!=0) temp->set_times(*iter,end_win->first,end_win->first+this->durations.find(*iter)->second);
+ else temp->set_times(*iter,end_win->first,temp_end.first);
+ cmd->min_adjust_cmds.push_back(temp);
+ }
+ }
+
+ if(sched.empty()) debug_text<<"sched is empty"<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ for(TaskInstSet::iterator iter=sched.begin();iter!=sched.end();iter++)
+ {
+ TimeWindow temp_start = this->get_start_window(*iter);
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(end_win->first>temp_start.first)
+ {
+ SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
+ TimeValue dur = this->durations.find(*iter)->second;
+ if(dur!=0)
+ temp->set_times(*iter,end_win->first,end_win->first+this->durations.find(*iter)->second);
+ else
+ temp->set_times(*iter,end_win->first,temp_end.first);
+ cmd->min_adjust_cmds.push_back(temp);
+
+ }
+ }
+
+
// Do the same change for the task instances simultaneous to this one
- for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
- {
- TimeWindow temp_start = this->get_start_window(*iter);
- if(start_win->first>temp_start.first)
- {
- std::cout<<"adjusting time for data "<<*iter<<std::endl;
- SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
- temp->set_times(*iter,start_win->first,end_win->first);
- cmd->min_adjust_cmds.push_back(temp);
- }
- }
-
- for(SA_AdjustMinTimesCmd::MinTimesAdjustList::iterator iter=cmd->min_adjust_cmds.begin();iter!=cmd->min_adjust_cmds.end();iter++)
- {
- if(!this->execute(*iter)) return false;
- }
- std::cout<<"the task inst is "<<cmd->task_inst_<<std::endl;
- // Check to see whether any task instance should be removed from the unranked set due to this time window change
- TaskInstSet *unranked = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
- for(TaskInstSet::iterator iter=unranked->begin();iter!=unranked->end();iter++)
- {
- TimeWindow temp_end = this->get_end_window(*iter);
- if(temp_end.second!=NULL_TIME && temp_end.second<start_win->first)
- {
- this->precedence_graph_.find(BEFORE)->second.find(cmd->task_inst_)->second.insert(*iter);
- this->precedence_graph_.find(AFTER)->second.find(*iter)->second.insert(cmd->task_inst_);
- this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.erase(this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.find(*iter));
- cmd->ranked.insert(*iter);
- }
- }
- for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
- {
- unranked->erase(unranked->find(*iter));
- }
- std::cout<<"min times of "<<cmd->task_inst_<<" : "<<cmd->new_start_min<<" "<<cmd->new_end_min<<std::endl;
- return true;
+ for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
+ {
+ TimeWindow temp_start = this->get_start_window(*iter);
+ if(start_win->first>temp_start.first)
+ {
+ debug_text<<"adjusting time for data "<<*iter<<std::endl;
+ SA_AdjustMinTimesCmd* temp = static_cast<SA_AdjustMinTimesCmd *> (this->get_AdjustMinTimesCmd());
+ temp->set_times(*iter,start_win->first,end_win->first);
+ cmd->min_adjust_cmds.push_back(temp);
+ }
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ for(SA_AdjustMinTimesCmd::MinTimesAdjustList::iterator iter=cmd->min_adjust_cmds.begin();iter!=cmd->min_adjust_cmds.end();iter++)
+ {
+ if(!this->execute(*iter)) return false;
+ }
+
+ debug_text<<"the task inst is "<<cmd->task_inst_<<std::endl;
+ // Check to see whether any task instance should be removed from the unranked set due to this time window change
+ TaskInstSet *unranked = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
+ for(TaskInstSet::iterator iter=unranked->begin();iter!=unranked->end();iter++)
+ {
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(temp_end.second!=NULL_TIME && temp_end.second<start_win->first)
+ {
+ this->precedence_graph_.find(BEFORE)->second.find(cmd->task_inst_)->second.insert(*iter);
+ this->precedence_graph_.find(AFTER)->second.find(*iter)->second.insert(cmd->task_inst_);
+ this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.erase(this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.find(*iter));
+ cmd->ranked.insert(*iter);
+ }
+ }
+ for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
+ {
+ unranked->erase(unranked->find(*iter));
+ }
+ debug_text<<"min times of "<<cmd->task_inst_<<" : "<<cmd->new_start_min<<" "<<cmd->new_end_min<<std::endl;
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ return true;
};
// Undo a command to adjust the minimum times of a
// task instance in the plan.
void SA_WorkingPlan::undo (SA_AdjustMinTimesCmd *cmd)
{
- TimeWindow *start_win = &this->get_start_window(cmd->task_inst_);
- TimeWindow *end_win = &this->get_end_window(cmd->task_inst_);
-
- if(start_win->first==cmd->old_start_min && end_win->first==cmd->old_end_min) return;
- // Undo all the removal of the tasks from the unranked set
- TaskInstSet *unranked1 = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
- TaskInstSet *before = &this->precedence_graph_.find(BEFORE)->second.find(cmd->task_inst_)->second;
- for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
- {
- TaskInstSet *unranked2 = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
- TaskInstSet *after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
- unranked1->insert(*iter);
- unranked2->insert(cmd->task_inst_);
- before->erase(before->find(*iter));
- after->erase(after->find(cmd->task_inst_));
- }
-
- // Undo all the time window changes caused by this command
- for(SA_AdjustMinTimesCmd::MinTimesAdjustList::reverse_iterator iter=cmd->min_adjust_cmds.rbegin();iter!=cmd->min_adjust_cmds.rend();iter++)
- {
- this->undo(*iter);
- }
+ TimeWindow *start_win = &this->get_start_window(cmd->task_inst_);
+ TimeWindow *end_win = &this->get_end_window(cmd->task_inst_);
+
+ if(start_win->first==cmd->old_start_min && end_win->first==cmd->old_end_min) return;
+ // Undo all the removal of the tasks from the unranked set
+ TaskInstSet *unranked1 = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
+ TaskInstSet *before = &this->precedence_graph_.find(BEFORE)->second.find(cmd->task_inst_)->second;
+ for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
+ {
+ TaskInstSet *unranked2 = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
+ TaskInstSet *after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
+ unranked1->insert(*iter);
+ unranked2->insert(cmd->task_inst_);
+ before->erase(before->find(*iter));
+ after->erase(after->find(cmd->task_inst_));
+ }
+
+ // Undo all the time window changes caused by this command
+ for(SA_AdjustMinTimesCmd::MinTimesAdjustList::reverse_iterator iter=cmd->min_adjust_cmds.rbegin();iter!=cmd->min_adjust_cmds.rend();iter++)
+ {
+ this->undo(*iter);
+ }
// Reset the time window to the old one
- start_win->first=cmd->old_start_min;
- end_win->first=cmd->old_end_min;
-
- return;
+ start_win->first=cmd->old_start_min;
+ end_win->first=cmd->old_end_min;
+
+ return;
};
// Execute a command to adjust the maximum times of a
// task instance in the plan.
bool SA_WorkingPlan::execute (SA_AdjustMaxTimesCmd *cmd)
{
- std::cout<<"adjusting max time for "<<cmd->task_inst_<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"adjusting max time for "<<cmd->task_inst_<<std::endl;
TimeWindow *start_win = &this->start_window_map_.find(cmd->task_inst_)->second;
- TimeWindow *end_win = &this->end_window_map_.find(cmd->task_inst_)->second;
- std::cout<<"for "<<cmd->task_inst_<<" "<<cmd->new_end_max<<" "<<end_win->first<<" "<<cmd->new_start_max<<" "<<start_win->first<<std::endl;
- // If this adjustment violated and time constraints, return false.
- if((end_win->first==NULL_TIME && cmd->new_end_max!= NULL_TIME) || cmd->new_end_max<end_win->first || cmd->new_start_max<start_win->first) return false;
- // Set the new time window
- start_win->second = cmd->new_start_max;
- end_win->second = cmd->new_end_max;
- CLSet before_links = this->get_before(cmd->task_inst_);
- TaskInstSet causal,sched,data;
- for(CLSet::iterator iter=before_links.begin();iter!=before_links.end();iter++)
- { if(iter->cond.kind!=DATA) causal.insert(iter->first);
- else data.insert(iter->first);
- }
- for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
- if(iter->second==cmd->task_inst_) sched.insert(iter->first);
-
- // Propagate this time window change to all the task instances ordered before this task instance
- for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
- {
- TimeWindow temp_end = this->get_end_window(*iter);
- if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && start_win->second<temp_end.second))
- {
- SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
- temp->set_times(*iter,start_win->second-this->durations.find(*iter)->second,start_win->second);
- cmd->max_adjust_cmds.push_back(temp);
- }
- }
-
- for(TaskInstSet::iterator iter=sched.begin();iter!=sched.end();iter++)
- {
- TimeWindow temp_end = this->get_end_window(*iter);
- if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && start_win->second<temp_end.second))
- {
- SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
- temp->set_times(*iter,start_win->second-this->durations.find(*iter)->second,start_win->second);
- cmd->max_adjust_cmds.push_back(temp);
- }
- }
+ TimeWindow *end_win = &this->end_window_map_.find(cmd->task_inst_)->second;
+ debug_text<<"for "<<cmd->task_inst_<<" "<<cmd->new_end_max<<" "<<end_win->first<<" "<<cmd->new_start_max<<" "<<start_win->first<<std::endl;
+ // If this adjustment violated and time constraints, return false.
+ if((end_win->first==NULL_TIME && cmd->new_end_max!= NULL_TIME) || cmd->new_end_max<end_win->first || cmd->new_start_max<start_win->first) return false;
+ // Set the new time window
+ start_win->second = cmd->new_start_max;
+ end_win->second = cmd->new_end_max;
+ CLSet before_links = this->get_before(cmd->task_inst_);
+ TaskInstSet causal,sched,data;
+ for(CLSet::iterator iter=before_links.begin();iter!=before_links.end();iter++)
+ { if(iter->cond.kind!=DATA) causal.insert(iter->first);
+ else data.insert(iter->first);
+ }
+ for(SchedulingLinks::iterator iter=sched_links_.begin();iter!=sched_links_.end();iter++)
+ if(iter->second==cmd->task_inst_) sched.insert(iter->first);
+
+ // Propagate this time window change to all the task instances ordered before this task instance
+ for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
+ {
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && start_win->second<temp_end.second))
+ {
+ SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
+ temp->set_times(*iter,start_win->second-this->durations.find(*iter)->second,start_win->second);
+ cmd->max_adjust_cmds.push_back(temp);
+ }
+ }
+
+ if(sched.empty()) debug_text<<"msched is empty ("<<cmd->task_inst_<<")"<<std::endl;
+ else
+ debug_text<<"mnot sched is empty ("<<cmd->task_inst_<<")"<<std::endl;
+
+ for(TaskInstSet::iterator iter=sched.begin();iter!=sched.end();iter++)
+ {
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && start_win->second<temp_end.second))
+ {
+ SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
+ temp->set_times(*iter,start_win->second-this->durations.find(*iter)->second,start_win->second);
+ cmd->max_adjust_cmds.push_back(temp);
+ }
+ }
+
+
// Do the same change for the task instances simultaneous to this one
- for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
- {
- TimeWindow temp_end = this->get_end_window(*iter);
- if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && end_win->second<temp_end.second))
- {
- SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
- temp->set_times(*iter,start_win->second,end_win->second);
- cmd->max_adjust_cmds.push_back(temp);
- }
- }
- for(SA_AdjustMaxTimesCmd::MaxTimesAdjustList::iterator iter=cmd->max_adjust_cmds.begin();iter!=cmd->max_adjust_cmds.end();iter++)
- {
- if(!this->execute(*iter)) return false;
- }
- // Check to see whether any task instance should be removed from the unranked set due to this time window change
- TaskInstSet *unranked = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
- for(TaskInstSet::iterator iter=unranked->begin();iter!=unranked->end();iter++)
- {
- TimeWindow temp_start = this->get_start_window(*iter);
- if(temp_start.first>end_win->second)
- {
- this->precedence_graph_.find(AFTER)->second.find(cmd->task_inst_)->second.insert(*iter);
- this->precedence_graph_.find(BEFORE)->second.find(*iter)->second.insert(cmd->task_inst_);
- this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.erase(this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.find(*iter));
- cmd->ranked.insert(*iter);
- }
- }
- for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
- {
- unranked->erase(unranked->find(*iter));
- }
- std::cout<<"max times for "<<cmd->task_inst_<<" : "<<cmd->new_start_max<<" "<<cmd->new_end_max<<std::endl;
- return true;
+ for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
+ {
+ TimeWindow temp_end = this->get_end_window(*iter);
+ if(temp_end.second==NULL_TIME || (temp_end.second!=NULL_TIME && end_win->second<temp_end.second))
+ {
+ SA_AdjustMaxTimesCmd* temp = static_cast<SA_AdjustMaxTimesCmd *> (this->get_AdjustMaxTimesCmd());
+ temp->set_times(*iter,start_win->second,end_win->second);
+ cmd->max_adjust_cmds.push_back(temp);
+ }
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+
+ for(SA_AdjustMaxTimesCmd::MaxTimesAdjustList::iterator iter=cmd->max_adjust_cmds.begin();iter!=cmd->max_adjust_cmds.end();iter++)
+ {
+ if(!this->execute(*iter)) return false;
+ }
+ // Check to see whether any task instance should be removed from the unranked set due to this time window change
+ TaskInstSet *unranked = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
+ for(TaskInstSet::iterator iter=unranked->begin();iter!=unranked->end();iter++)
+ {
+ TimeWindow temp_start = this->get_start_window(*iter);
+ if(temp_start.first>end_win->second)
+ {
+ this->precedence_graph_.find(AFTER)->second.find(cmd->task_inst_)->second.insert(*iter);
+ this->precedence_graph_.find(BEFORE)->second.find(*iter)->second.insert(cmd->task_inst_);
+ this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.erase(this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.find(*iter));
+ cmd->ranked.insert(*iter);
+ }
+ }
+ for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
+ {
+ unranked->erase(unranked->find(*iter));
+ }
+ debug_text<<"max times for "<<cmd->task_inst_<<" : "<<cmd->new_start_max<<" "<<cmd->new_end_max<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ return true;
};
// Undo a command to adjust the maximum times of a
// task instance in the plan.
void SA_WorkingPlan::undo (SA_AdjustMaxTimesCmd *cmd)
{
- std::cout<<"task inst is "<<cmd->task_inst_<<std::endl;
- TimeWindow *start_win = &this->get_start_window(cmd->task_inst_);
- TimeWindow *end_win = &this->get_end_window(cmd->task_inst_);
- if(start_win->second==cmd->old_start_max && end_win->second==cmd->old_end_max) return;
- // Undo all the removal of the tasks from the unranked set
- TaskInstSet *unranked1 = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
- TaskInstSet *after = &this->precedence_graph_.find(AFTER)->second.find(cmd->task_inst_)->second;
- for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
- {
- TaskInstSet *unranked2 = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
- TaskInstSet *before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
- unranked1->insert(*iter);
- unranked2->insert(cmd->task_inst_);
- after->erase(after->find(*iter));
- before->erase(before->find(cmd->task_inst_));
- }
-
- // Undo all the time window changes caused by this command
- for(SA_AdjustMaxTimesCmd::MaxTimesAdjustList::reverse_iterator iter=cmd->max_adjust_cmds.rbegin();iter!=cmd->max_adjust_cmds.rend();iter++)
- {
- this->undo(*iter);
- }
-
+ std::ostringstream debug_text;
+ debug_text<<"task inst is "<<cmd->task_inst_<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ TimeWindow *start_win = &this->get_start_window(cmd->task_inst_);
+ TimeWindow *end_win = &this->get_end_window(cmd->task_inst_);
+ if(start_win->second==cmd->old_start_max && end_win->second==cmd->old_end_max) return;
+ // Undo all the removal of the tasks from the unranked set
+ TaskInstSet *unranked1 = &this->precedence_graph_.find(UNRANKED)->second.find(cmd->task_inst_)->second;
+ TaskInstSet *after = &this->precedence_graph_.find(AFTER)->second.find(cmd->task_inst_)->second;
+ for(TaskInstSet::iterator iter=cmd->ranked.begin();iter!=cmd->ranked.end();iter++)
+ {
+ TaskInstSet *unranked2 = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
+ TaskInstSet *before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
+ unranked1->insert(*iter);
+ unranked2->insert(cmd->task_inst_);
+ after->erase(after->find(*iter));
+ before->erase(before->find(cmd->task_inst_));
+ }
+
+ // Undo all the time window changes caused by this command
+ for(SA_AdjustMaxTimesCmd::MaxTimesAdjustList::reverse_iterator iter=cmd->max_adjust_cmds.rbegin();iter!=cmd->max_adjust_cmds.rend();iter++)
+ {
+ this->undo(*iter);
+ }
+
// Reset the time window to the old one
- start_win->second=cmd->old_start_max;
- end_win->second=cmd->old_end_max;
-
- return;
+ start_win->second=cmd->old_start_max;
+ end_win->second=cmd->old_end_max;
+
+ return;
};
// Get the start window of the task instance. If one doesn't exist, then assign it one.
TimeWindow SA_WorkingPlan::get_start_window(TaskInstID task_inst)
@@ -1153,18 +1586,23 @@ TimeWindow SA_WorkingPlan::get_end_window(TaskInstID task_inst)
this->start_window_map_.insert(std::make_pair(task_inst,temp_start));
this->end_window_map_.insert(std::make_pair(task_inst,temp_end));
}
- return this->end_window_map_.find(task_inst)->second;
+ return this->end_window_map_.find(task_inst)->second;
};
//Get the duration of a task instance
TimeValue SA_WorkingPlan::get_duration(TaskInstID task_inst)
{
- return this->durations.find(task_inst)->second;
+ return this->durations.find(task_inst)->second;
};
/// Adds the sched order to the sched_links_ map by putting the first task instance before the second
void SA_WorkingPlan::add_sched_link(TaskInstID first_task_inst, TaskInstID second_task_inst)
{
+ std::ostringstream debug_text;
+ debug_text<<"Adding sched link insert"<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
this->sched_links_.insert(std::make_pair(first_task_inst,second_task_inst));
}
/// Removes the sched order from the sched_links_ map
@@ -1182,336 +1620,403 @@ void SA_WorkingPlan::remove_sched_link(TaskInstID first_task_inst, TaskInstID se
// Update the precedence graph by inserting the task instance.
bool SA_WorkingPlan::init_prec_insert(TaskInstID task_inst, SA_AssocTaskImplCmd *cmd)
{
- TaskInstSet temp;
- this->precedence_graph_.find(BEFORE)->second.insert(std::make_pair(task_inst,temp));
- this->precedence_graph_.find(AFTER)->second.insert(std::make_pair(task_inst,temp));
- this->precedence_graph_.find(UNRANKED)->second.insert(std::make_pair(task_inst,temp));
- this->precedence_graph_.find(SIMUL)->second.insert(std::make_pair(task_inst,temp));
-
- TimeWindow win_start = this->init_start.find(task_inst)->second;
- TimeWindow win_end = this->init_end.find(task_inst)->second;
- TimeWindow start_win = this->get_start_window(task_inst);
- TimeWindow end_win = this->get_end_window(task_inst);
- std::cout<<"for "<<task_inst<<win_start.first<<" "<<win_start.second<<" "<<win_end.first<<" "<<win_end.second<<std::endl;
- std::cout<<"for "<<task_inst<<start_win.first<<" "<<start_win.second<<" "<<end_win.first<<" "<<end_win.second<<std::endl;
- if(win_start.first!=NULL_TIME)
- {
- // An initial time constraint is set on the minimum times
- if(win_start.second!=NULL_TIME)
- {
- // An initial time constraint is set on the maximum times
- cmd->min_adj_cmd.set_times(task_inst,win_start.first,win_end.first);
- cmd->max_adj_cmd.set_times(task_inst,win_start.second,win_end.second);
- if(!this->execute(&cmd->min_adj_cmd))
- {
- this->undo(&cmd->min_adj_cmd);
- return false;
- }
- if(!this->execute(&cmd->max_adj_cmd))
- {
- this->undo(&cmd->max_adj_cmd);
- this->undo(&cmd->min_adj_cmd);
- return false;
- }
- }
- else
- {
- // No initial time constraint is set on the maximum times
- cmd->min_adj_cmd.set_times(task_inst,win_start.first,win_end.first);
- if(!this->execute(&cmd->min_adj_cmd))
- {
- this->undo(&cmd->min_adj_cmd);
- return false;
- }
- }
- }
- else
- {
- // No initial time constraint is set on the minimum times
- if(win_start.second!=NULL_TIME)
- {
- // An initial time constraint is set on the maximum times
- cmd->max_adj_cmd.set_times(task_inst,win_start.second,win_end.second);
- if(!this->execute(&cmd->max_adj_cmd))
- {
- this->undo(&cmd->min_adj_cmd);
- return false;
- }
- }
- else
- {
- // No initial time constraint.
- cmd->min_adj_cmd.set_times(task_inst,start_win.first,end_win.first);
- cmd->max_adj_cmd.set_times(task_inst,start_win.second,end_win.second);
- std::cout<<"for "<<task_inst<<" "<<start_win.first<<" "<<start_win.second<<" "<<end_win.first<<" "<<end_win.second<<std::endl;
- if(!this->execute(&cmd->min_adj_cmd))
- {
- this->undo(&cmd->min_adj_cmd);
- return false;
- }
- //if(!this->execute(&cmd->max_adj_cmd))
- //{
- // this->undo(&cmd->max_adj_cmd);
- // this->undo(&cmd->min_adj_cmd);
- // return false;
- //}
- }
- }
- start_win = this->get_start_window(task_inst);
- end_win = this->get_end_window(task_inst);
- TaskInstSet *before,*after,*simul,*unranked;
- before = &this->precedence_graph_.find(BEFORE)->second.find(task_inst)->second;
- after = &this->precedence_graph_.find(AFTER)->second.find(task_inst)->second;
- unranked = &this->precedence_graph_.find(UNRANKED)->second.find(task_inst)->second;
- simul = &this->precedence_graph_.find(SIMUL)->second.find(task_inst)->second;
- // If this task instance is not reused, insert all the task instances in it unranked set.
- if(unranked->empty())
- {
- for(PrecedenceSet::iterator iter=this->precedence_graph_.find(BEFORE)->second.begin();iter!=this->precedence_graph_.find(BEFORE)->second.end();iter++)
- {
- if(iter->first!=task_inst)
- {
- std::cout<<"inserting "<<iter->first<<" in unranked of "<<task_inst<<std::endl;
- unranked->insert(iter->first);
- }
- }
- if(unranked->empty()) return true;
- }
- CLSet after_links = this->get_after(task_inst);
-
- TaskInstSet causal,data;
- for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
- {
- if(iter->second==GOAL_TASK_INST_ID || iter->second==NULL_TASK_INST_ID) continue;
- if(iter->cond.kind!=DATA) causal.insert(iter->second);
- else data.insert(iter->second);
- }
-
- for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
- {
- TaskInstSet *iter_after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
- TaskInstSet *iter_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
- TaskInstSet *iter_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
- TaskInstSet *iter_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter)->second;
- if(after->find(*iter)!=after->end()) continue;
- std::cout<<"inserting "<<*iter<<" in after set of "<<task_inst<<std::endl;
- TaskInstSet temp = *before;
- temp.insert(task_inst);
- for(TaskInstSet::iterator iter2=simul->begin();iter2!=simul->end();iter2++)
- temp.insert(*iter2);
- for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
- {
- TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
- iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
- iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
- iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
- iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
- for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
- {
- std::cout<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
- TaskInstSet *iter1_before,*iter1_unranked;
- iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
- iter1_before->insert(*iter2);
- iter2_after->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
- {
- std::cout<<*iter1<<" is siml to "<<*iter<<" so it is after "<<*iter2<<std::endl;
- TaskInstSet *iter1_before,*iter1_unranked;
- iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
- iter1_before->insert(*iter2);
- iter2_after->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- if(iter_before->find(*iter2)!=iter_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter));
- iter_before->insert(*iter2);
- iter2_after->insert(*iter);
- if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
- }
- }
- for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
- {
- TaskInstSet *iter_after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
- TaskInstSet *iter_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
- TaskInstSet *iter_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
- TaskInstSet *iter_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter)->second;
- if(simul->find(*iter)!=simul->end()) continue;
- std::cout<<"inserting "<<*iter<<" in simul set of "<<task_inst<<std::endl;
- TaskInstSet temp = *before;
- for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
- {
- std::cout<<"iter2 is "<<*iter2<<std::endl;
- TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
- iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
- iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
- iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
- iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
- for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
- {
- std::cout<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
- TaskInstSet *iter1_before,*iter1_unranked;
- iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
- iter1_before->insert(*iter2);
- iter2_after->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
- {
- std::cout<<*iter1<<" is simul to "<<*iter<<" so it is after "<<*iter2<<std::endl;
- TaskInstSet *iter1_before,*iter1_unranked;
- iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
- iter1_before->insert(*iter2);
- iter2_after->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- if(iter_before->find(*iter2)!=iter_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter));
- iter_before->insert(*iter2);
- iter2_after->insert(*iter);
- if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
- }
- temp = *simul;
- temp.insert(task_inst);
- for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
- {
- TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
- iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
- iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
- iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
- iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
- for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
- {
- std::cout<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
- TaskInstSet *iter1_before,*iter1_unranked;
- iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
- iter1_before->insert(*iter2);
- iter2_after->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
- {
- std::cout<<*iter1<<" is simul "<<*iter<<" so it is simul "<<*iter2<<std::endl;
- TaskInstSet *iter1_simul,*iter1_unranked;
- iter1_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_simul->find(*iter2)!=iter1_simul->end()) continue;
- else
+
+ if(cmd->get_id().step == 12 && cmd->get_id().decision_pt== 2 && cmd->get_id().seq_num == 1 && task_inst == 3)
+ bool yep = true;
+
+ TaskInstSet temp;
+ this->precedence_graph_.find(BEFORE)->second.insert(std::make_pair(task_inst,temp));
+ this->precedence_graph_.find(AFTER)->second.insert(std::make_pair(task_inst,temp));
+ this->precedence_graph_.find(UNRANKED)->second.insert(std::make_pair(task_inst,temp));
+ this->precedence_graph_.find(SIMUL)->second.insert(std::make_pair(task_inst,temp));
+
+
+ if(init_start.size()-1 <= task_inst){
+ for(int i = init_start.size()-1; i < 100+task_inst; i++){
+ this->init_start.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
+ this->init_end.insert(std::make_pair(i,(TimeWindow)std::make_pair(NULL_TIME,NULL_TIME)));
+ }
+ }
+
+ TimeWindow win_start = this->init_start.find(task_inst)->second;
+ TimeWindow win_end = this->init_end.find(task_inst)->second;
+ TimeWindow start_win = this->get_start_window(task_inst);
+ TimeWindow end_win = this->get_end_window(task_inst);
+
+
+ std::ostringstream debug_text;
+ debug_text<<"for "<<task_inst<<win_start.first<<" "<<win_start.second<<" "<<win_end.first<<" "<<win_end.second<<std::endl;
+ debug_text<<"for "<<task_inst<<start_win.first<<" "<<start_win.second<<" "<<end_win.first<<" "<<end_win.second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ if(win_start.first!=NULL_TIME)
+ {
+ // An initial time constraint is set on the minimum times
+ if(win_start.second!=NULL_TIME)
+ {
+ // An initial time constraint is set on the maximum times
+ cmd->min_adj_cmd.set_times(task_inst,win_start.first,win_end.first);
+ cmd->max_adj_cmd.set_times(task_inst,win_start.second,win_end.second);
+ if(!this->execute(&cmd->min_adj_cmd))
+ {
+ this->undo(&cmd->min_adj_cmd);
+ return false;
+ }
+ if(!this->execute(&cmd->max_adj_cmd))
+ {
+ this->undo(&cmd->max_adj_cmd);
+ this->undo(&cmd->min_adj_cmd);
+ return false;
+ }
+ }
+ else
+ {
+ // No initial time constraint is set on the maximum times
+ cmd->min_adj_cmd.set_times(task_inst,win_start.first,win_end.first);
+ if(!this->execute(&cmd->min_adj_cmd))
+ {
+ this->undo(&cmd->min_adj_cmd);
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // No initial time constraint is set on the minimum times
+ if(win_start.second!=NULL_TIME)
+ {
+ // An initial time constraint is set on the maximum times
+ cmd->max_adj_cmd.set_times(task_inst,win_start.second,win_end.second);
+ if(!this->execute(&cmd->max_adj_cmd))
+ {
+ this->undo(&cmd->min_adj_cmd);
+ return false;
+ }
+ }
+ else
+ {
+ // No initial time constraint.
+ cmd->min_adj_cmd.set_times(task_inst,start_win.first,end_win.first);
+ cmd->max_adj_cmd.set_times(task_inst,start_win.second,end_win.second);
+
+ std::ostringstream debug_text;
+ debug_text<<"for "<<task_inst<<" "<<start_win.first<<" "<<start_win.second<<" "<<end_win.first<<" "<<end_win.second<<std::endl;
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+
+ if(!this->execute(&cmd->min_adj_cmd))
+ {
+ this->undo(&cmd->min_adj_cmd);
+ return false;
+ }
+ }
+ }
+ start_win = this->get_start_window(task_inst);
+ end_win = this->get_end_window(task_inst);
+ TaskInstSet *before,*after,*simul,*unranked;
+ before = &this->precedence_graph_.find(BEFORE)->second.find(task_inst)->second;
+ after = &this->precedence_graph_.find(AFTER)->second.find(task_inst)->second;
+ unranked = &this->precedence_graph_.find(UNRANKED)->second.find(task_inst)->second;
+ simul = &this->precedence_graph_.find(SIMUL)->second.find(task_inst)->second;
+ // If this task instance is not reused, insert all the task instances in it unranked set.
+ if(unranked->empty() && (this->reused_insts_.find(task_inst)== this->reused_insts_.end()))
+ {
+ std::ostringstream debug_text;
+
+ for(PrecedenceSet::iterator iter=this->precedence_graph_.find(BEFORE)->second.begin();iter!=this->precedence_graph_.find(BEFORE)->second.end();iter++)
+ {
+ if(iter->first!=task_inst)
+ {
+ debug_text<<"inserting "<<iter->first<<" in unranked of "<<task_inst<<std::endl;
+ unranked->insert(iter->first);
+ }
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ if(unranked->empty()) return true;
+ }
+ CLSet after_links = this->get_after(task_inst);
+
+ TaskInstSet causal,data;
+ for(CLSet::iterator iter=after_links.begin();iter!=after_links.end();iter++)
+ {
+ if(iter->second==GOAL_TASK_INST_ID || iter->second==NULL_TASK_INST_ID) continue;
+ if(iter->cond.kind!=DATA) causal.insert(iter->second);
+ else data.insert(iter->second);
+ }
+
+ for(TaskInstSet::iterator iter=causal.begin();iter!=causal.end();iter++)
+ {
+ TaskInstSet *iter_after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
+ TaskInstSet *iter_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
+ TaskInstSet *iter_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
+ TaskInstSet *iter_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter)->second;
+ if(after->find(*iter)!=after->end()) continue;
+
+
+ std::ostringstream debug_text;
+ debug_text<<"inserting "<<*iter<<" in after set of "<<task_inst<<std::endl;
+ TaskInstSet temp = *before;
+ temp.insert(task_inst);
+ for(TaskInstSet::iterator iter2=simul->begin();iter2!=simul->end();iter2++)
+ temp.insert(*iter2);
+ for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
+ {
+ TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
+ iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
+ iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
+ iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
+ iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
+ for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
+ {
+ debug_text<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
+ TaskInstSet *iter1_before,*iter1_unranked;
+ iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
+ iter1_before->insert(*iter2);
+ iter2_after->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+ for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
{
- cmd->simul_insertions.insert(std::make_pair(*iter2,*iter1));
+ debug_text<<*iter1<<" is siml to "<<*iter<<" so it is after "<<*iter2<<std::endl;
+ TaskInstSet *iter1_before,*iter1_unranked;
+ iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
+ iter1_before->insert(*iter2);
+ iter2_after->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
}
- iter1_simul->insert(*iter2);
- iter2_simul->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- for(TaskInstSet::iterator iter1=iter_before->begin();iter1!=iter_before->end();iter1++)
- {
- std::cout<<*iter1<<" is before "<<*iter<<" so it is before "<<*iter2<<std::endl;
- TaskInstSet *iter1_after,*iter1_unranked;
- iter1_after = &this->precedence_graph_.find(AFTER)->second.find(*iter1)->second;
- iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
- if(iter1_after->find(*iter2)!=iter1_after->end()) continue;
- else cmd->causal_insertions.insert(std::make_pair(*iter1,*iter2));
- iter1_after->insert(*iter2);
- iter2_before->insert(*iter1);
- if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
- }
- if(iter_simul->find(*iter2)!=iter_simul->end()) continue;
- else cmd->simul_insertions.insert(std::make_pair(*iter2,*iter));
- iter2_simul->insert(*iter);
- iter_simul->insert(*iter2);
- if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
- if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
- }
- }
- std::cout<<"for "<<task_inst<<" start window: "<<start_win.first<<"-"<<start_win.second<<" and end window "<<end_win.first<<"-"<<end_win.second<<std::endl;
- for(TaskInstSet::iterator iter = unranked->begin();iter!=unranked->end();iter++)
- {
- TimeWindow temp_start = this->get_start_window(*iter);
- TimeWindow temp_end = this->get_end_window(*iter);
- std::cout<<"checking "<<*iter<<" in all with start window: "<<temp_start.first<<"-"<<temp_start.second<<" and end window "<<temp_end.first<<"-"<<temp_end.second<<std::endl;
- if(end_win.second!=NULL_TIME && temp_start.first>end_win.second)
- {
- after->insert(*iter);
- this->precedence_graph_.find(BEFORE)->second.find(*iter)->second.insert(task_inst);
- }
- else if(temp_end.second!=NULL_TIME && temp_end.second<start_win.first)
- {
- before->insert(*iter);
- this->precedence_graph_.find(AFTER)->second.find(*iter)->second.insert(task_inst);
- }
- else
- {
- this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.insert(task_inst);
- }
- }
+ if(iter_before->find(*iter2)!=iter_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter));
+ iter_before->insert(*iter2);
+ iter2_after->insert(*iter);
+ if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ }
+ for(TaskInstSet::iterator iter=data.begin();iter!=data.end();iter++)
+ {
+ std::ostringstream debug_text;
+
+ TaskInstSet *iter_after = &this->precedence_graph_.find(AFTER)->second.find(*iter)->second;
+ TaskInstSet *iter_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter)->second;
+ TaskInstSet *iter_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second;
+ TaskInstSet *iter_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter)->second;
+ if(simul->find(*iter)!=simul->end()) continue;
+ debug_text<<"inserting "<<*iter<<" in simul set of "<<task_inst<<std::endl;
+ TaskInstSet temp = *before;
+ for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
+ {
+ debug_text<<"iter2 is "<<*iter2<<std::endl;
+ TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
+ iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
+ iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
+ iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
+ iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
+ for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
+ {
+ debug_text<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
+ TaskInstSet *iter1_before,*iter1_unranked;
+ iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
+ iter1_before->insert(*iter2);
+ iter2_after->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+ for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
+ {
+ debug_text<<*iter1<<" is simul to "<<*iter<<" so it is after "<<*iter2<<std::endl;
+ TaskInstSet *iter1_before,*iter1_unranked;
+ iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
+ iter1_before->insert(*iter2);
+ iter2_after->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+ if(iter_before->find(*iter2)!=iter_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter));
+ iter_before->insert(*iter2);
+ iter2_after->insert(*iter);
+ if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+ }
+
+
+ temp = *simul;
+ temp.insert(task_inst);
+ for(TaskInstSet::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
+ {
+ std::ostringstream debug_text;
+
+ TaskInstSet *iter2_before,*iter2_after,*iter2_simul,*iter2_unranked;
+ iter2_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter2)->second;
+ iter2_after = &this->precedence_graph_.find(AFTER)->second.find(*iter2)->second;
+ iter2_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter2)->second;
+ iter2_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter2)->second;
+ for(TaskInstSet::iterator iter1=iter_after->begin();iter1!=iter_after->end();iter1++)
+ {
+ debug_text<<*iter1<<" is after "<<*iter<<" so it is after "<<*iter2<<std::endl;
+ TaskInstSet *iter1_before,*iter1_unranked;
+ iter1_before = &this->precedence_graph_.find(BEFORE)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_before->find(*iter2)!=iter1_before->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter2,*iter1));
+ iter1_before->insert(*iter2);
+ iter2_after->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+ for(TaskInstSet::iterator iter1=iter_simul->begin();iter1!=iter_simul->end();iter1++)
+ {
+ debug_text<<*iter1<<" is simul "<<*iter<<" so it is simul "<<*iter2<<std::endl;
+ TaskInstSet *iter1_simul,*iter1_unranked;
+ iter1_simul = &this->precedence_graph_.find(SIMUL)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_simul->find(*iter2)!=iter1_simul->end()) continue;
+ else
+ {
+ cmd->simul_insertions.insert(std::make_pair(*iter2,*iter1));
+ }
+ iter1_simul->insert(*iter2);
+ iter2_simul->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+ for(TaskInstSet::iterator iter1=iter_before->begin();iter1!=iter_before->end();iter1++)
+ {
+ debug_text<<*iter1<<" is before "<<*iter<<" so it is before "<<*iter2<<std::endl;
+ TaskInstSet *iter1_after,*iter1_unranked;
+ iter1_after = &this->precedence_graph_.find(AFTER)->second.find(*iter1)->second;
+ iter1_unranked = &this->precedence_graph_.find(UNRANKED)->second.find(*iter1)->second;
+ if(iter1_after->find(*iter2)!=iter1_after->end()) continue;
+ else cmd->causal_insertions.insert(std::make_pair(*iter1,*iter2));
+ iter1_after->insert(*iter2);
+ iter2_before->insert(*iter1);
+ if(iter1_unranked->find(*iter2)!=iter1_unranked->end()) iter1_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter1)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter1));
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
+ if(iter_simul->find(*iter2)!=iter_simul->end()) continue;
+ else cmd->simul_insertions.insert(std::make_pair(*iter2,*iter));
+ iter2_simul->insert(*iter);
+ iter_simul->insert(*iter2);
+ if(iter_unranked->find(*iter2)!=iter_unranked->end()) iter_unranked->erase(*iter2);
+ if(iter2_unranked->find(*iter)!=iter2_unranked->end()) iter2_unranked->erase(iter2_unranked->find(*iter));
+ }
+ }
+
+
+ debug_text<<"for "<<task_inst<<" start window: "<<start_win.first<<"-"<<start_win.second<<" and end window "<<end_win.first<<"-"<<end_win.second<<std::endl;
+
+
+ for(TaskInstSet::iterator iter = unranked->begin();iter!=unranked->end();iter++)
+ {
+ TimeWindow temp_start = this->get_start_window(*iter);
+ TimeWindow temp_end = this->get_end_window(*iter);
+ debug_text<<"checking "<<*iter<<" in all with start window: "<<temp_start.first<<"-"<<temp_start.second<<" and end window "<<temp_end.first<<"-"<<temp_end.second<<std::endl;
+ if(end_win.second!=NULL_TIME && temp_start.first>end_win.second)
+ {
+ after->insert(*iter);
+ this->precedence_graph_.find(BEFORE)->second.find(*iter)->second.insert(task_inst);
+ }
+ else if(temp_end.second!=NULL_TIME && temp_end.second<start_win.first)
+ {
+ before->insert(*iter);
+ this->precedence_graph_.find(AFTER)->second.find(*iter)->second.insert(task_inst);
+ }
+ else
+ {
+ this->precedence_graph_.find(UNRANKED)->second.find(*iter)->second.insert(task_inst);
+ }
+
+
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
this->print_prec();
- for(InstToWinMap::iterator iter=this->start_window_map_.begin();iter!=this->start_window_map_.end();iter++)
- {
- std::cout<<"The start window for "<<iter->first<<" is "<<iter->second.first<<" - "<<iter->second.second<<std::endl;
- }
- for(InstToWinMap::iterator iter=this->end_window_map_.begin();iter!=this->end_window_map_.end();iter++)
- {
- std::cout<<"The end window for "<<iter->first<<" is "<<iter->second.first<<" - "<<iter->second.second<<std::endl;
- }
- return true;
+
+ for(InstToWinMap::iterator iter=this->start_window_map_.begin();iter!=this->start_window_map_.end();iter++)
+ {
+ debug_text<<"The start window for "<<iter->first<<" is "<<iter->second.first<<" - "<<iter->second.second<<std::endl;
+ }
+ for(InstToWinMap::iterator iter=this->end_window_map_.begin();iter!=this->end_window_map_.end();iter++)
+ {
+ debug_text<<"The end window for "<<iter->first<<" is "<<iter->second.first<<" - "<<iter->second.second<<std::endl;
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_NORMAL, debug_text.str ());
+ debug_text.str("");
+
+ return true;
};
// Print the precedence graph
void SA_WorkingPlan::print_prec()
{
- std::cout<<"BEFORE : "<<BEFORE<<", AFTER : "<<AFTER<<", SIMUL : "<<SIMUL<<", UNRANKED : "<<UNRANKED<<std::endl;
+ std::ostringstream debug_text;
+
+ debug_text<<"BEFORE : "<<BEFORE<<", AFTER : "<<AFTER<<", SIMUL : "<<SIMUL<<", UNRANKED : "<<UNRANKED<<std::endl;
for(PrecedenceGraph::iterator iter1 = this->precedence_graph_.begin(); iter1 != this->precedence_graph_.end(); iter1++)
{
- std::cout<<"The precedence set "<<iter1->first<<": "<<std::endl;
+ debug_text<<"The precedence set "<<iter1->first<<": "<<std::endl;
for(PrecedenceSet::iterator iter2 = iter1->second.begin(); iter2 != iter1->second.end(); iter2++)
{
- std::cout<<"The task inst set of "<<iter2->first<<" is ";
+ debug_text<<"The task inst set of "<<iter2->first<<" is ";
for(TaskInstSet::iterator iter3 = iter2->second.begin(); iter3 != iter2->second.end(); iter3++)
{
- std::cout<<*iter3<<",";
+ debug_text<<*iter3<<",";
}
- std::cout<<std::endl;
+ debug_text<<std::endl;
}
}
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
};
// Undo all the updation to the precedence graph due to the chosen task instance
void SA_WorkingPlan::prec_erase(TaskInstID task_inst, SA_AssocTaskImplCmd *cmd)
{
-PrecedenceSet *before = &this->precedence_graph_.find(BEFORE)->second;
-PrecedenceSet *simul = &this->precedence_graph_.find(SIMUL)->second;
-PrecedenceSet *after = &this->precedence_graph_.find(AFTER)->second;
-PrecedenceSet *unranked = &this->precedence_graph_.find(UNRANKED)->second;
+ PrecedenceSet *before = &this->precedence_graph_.find(BEFORE)->second;
+ PrecedenceSet *simul = &this->precedence_graph_.find(SIMUL)->second;
+ PrecedenceSet *after = &this->precedence_graph_.find(AFTER)->second;
+ PrecedenceSet *unranked = &this->precedence_graph_.find(UNRANKED)->second;
+
+ std::ostringstream debug_text;
+
for(std::set< std::pair<TaskInstID,TaskInstID> >::iterator iter = cmd->causal_insertions.begin();iter!=cmd->causal_insertions.end();iter++)
{
// iter->second has been inserted in the after set of iter->first
- std::cout<<"removing "<<iter->second<<" from after of "<<iter->first<<std::endl;
+ debug_text<<"removing "<<iter->second<<" from after of "<<iter->first<<std::endl;
before->find(iter->second)->second.erase(iter->first);
after->find(iter->first)->second.erase(iter->second);
unranked->find(iter->first)->second.insert(iter->second);
@@ -1520,34 +2025,29 @@ PrecedenceSet *unranked = &this->precedence_graph_.find(UNRANKED)->second;
for(std::set< std::pair<TaskInstID,TaskInstID> >::iterator iter = cmd->simul_insertions.begin();iter!=cmd->simul_insertions.end();iter++)
{
// iter->second has been inserted in the simul set of iter->first
- std::cout<<"removing "<<iter->second<<" from simul of "<<iter->first<<std::endl;
+ debug_text<<"removing "<<iter->second<<" from simul of "<<iter->first<<std::endl;
simul->find(iter->second)->second.erase(iter->first);
simul->find(iter->first)->second.erase(iter->second);
unranked->find(iter->first)->second.insert(iter->second);
unranked->find(iter->second)->second.insert(iter->first);
}
- //if(before->find(task_inst)->second.empty() && after->find(task_inst)->second.empty() && simul->find(task_inst)->second.empty())
- //{
- // CondToCLinksMap::iterator iter;
- // for(iter = this->causal_links_.begin();iter!=this->causal_links_.end();iter++)
- // if(iter->second.second == GOAL_TASK_INST_ID && iter->second.first == task_inst) break;
- // if(iter==this->causal_links_.end() || cmd->impls_.size()!=0)
- // {
- std::cout<<this->reused_insts_.size()<<std::endl;
+
+ debug_text<<this->reused_insts_.size()<<std::endl;
if(this->reused_insts_.find(task_inst)==this->reused_insts_.end())
{
- before->erase(before->find(task_inst));
- after->erase(after->find(task_inst));
- simul->erase(simul->find(task_inst));
- unranked->erase(unranked->find(task_inst));
- this->start_window_map_.erase(this->start_window_map_.find(task_inst));
- this->end_window_map_.erase(this->end_window_map_.find(task_inst));
- for(PrecedenceSet::iterator iter1 = unranked->begin();iter1!=unranked->end();iter1++)
- iter1->second.erase(task_inst);
- }
-// }
- //std::cout<<"after erasing the precedence graph is "<<std::endl;
- //this->print_prec();
+ before->erase(before->find(task_inst));
+ after->erase(after->find(task_inst));
+ simul->erase(simul->find(task_inst));
+ unranked->erase(unranked->find(task_inst));
+ this->start_window_map_.erase(this->start_window_map_.find(task_inst));
+ this->end_window_map_.erase(this->end_window_map_.find(task_inst));
+ for(PrecedenceSet::iterator iter1 = unranked->begin();iter1!=unranked->end();iter1++)
+ iter1->second.erase(task_inst);
+ }
+
+ SA_POP_DEBUG_STR (SA_POP_DEBUG_VERBOSE, debug_text.str ());
+ debug_text.str("");
+
};
/// Get all the task instances
TaskInstSet SA_WorkingPlan::get_all_insts()
@@ -1557,18 +2057,19 @@ TaskInstSet SA_WorkingPlan::get_all_insts()
{
all.insert(iter->first);
}
- return all;
+ return all;
}
/// Check if the instance id already exists and is being reused.
bool SA_WorkingPlan::inst_exists (TaskInstID task_inst)
{
- if(this->task_impls_.find(task_inst)!=this->task_impls_.end()) return true;
- else return false;
+
+ if(this->task_impls_.find(task_inst)!=this->task_impls_.end()) return true;
+ else return false;
}
/// Get task implementation for a task instance.
TaskImplID SA_WorkingPlan::get_impl_id (TaskInstID task_inst)
{
- return this->task_impls_.find(task_inst)->second;
+ return this->task_impls_.find(task_inst)->second;
}
diff --git a/SA_POP/SA_WorkingPlan.h b/SA_POP/SA_WorkingPlan.h
index 468bc451cb7..a5b0a6c20bd 100644
--- a/SA_POP/SA_WorkingPlan.h
+++ b/SA_POP/SA_WorkingPlan.h
@@ -20,7 +20,8 @@
#include "WorkingPlan.h"
#include "PlanCommands.h"
#include "SA_PlanCommands.h"
-
+#include <stack>
+#include <map>
namespace SA_POP {
@@ -262,7 +263,7 @@ namespace SA_POP {
/**
* @param cmd Command object.
*/
- virtual void execute (SA_ResolveCLThreatCmd *cmd);
+ virtual bool execute (SA_ResolveCLThreatCmd *cmd);
/// Undo a command to resolve a causal link threat in the
/// plan (with promotion or demotion).
@@ -327,18 +328,52 @@ namespace SA_POP {
*/
virtual void reset_plan ();
+
+ virtual void generate_all_threats(void);
+
+
+ virtual InstToTaskMap get_task_insts(void){return task_insts_;};
+
+ virtual bool inst_has_impl(TaskInstID inst_id);
+
+ void print_precedence_graph(std::string source);
+
+ bool condition_in_suspended(Condition condition, TaskInstID required_by_);
+
+ CausalLink clink_on_path(Condition condition, TaskInstID required_by);
+
+ CausalLink clink_on_path_aux(Condition condition, TaskInstID required_by,
+ std::set<TaskInstID> & expanded);
+
+ void unsuspend_listeners(CausalLink link, TaskInstID exception);
+ void unsuspend_listeners_aux(CausalLink link, TaskInstID exception);
+
+ void suspend_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by);
+
+ void resume_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by);
+
+ bool is_null_condition(Condition cond);
+
+ bool is_null_link(CausalLink link);
+
+ Condition get_no_condition();
+
+ PrecedenceGraph get_precedence_graph();
+
protected:
// ************************************************************************
// State information.
// ************************************************************************
+ CLThreatSet threat_set;
+
/// Flag for whether command prototypes have been set.
bool has_cmds_;
/// Task instance ID to use for next instance created.
TaskInstID next_inst_id_;
- typedef std::map <TaskInstID, TaskID> InstToTaskMap;
+
/// Task instances in plan (mapping to task id).
InstToTaskMap task_insts_;
@@ -348,9 +383,16 @@ namespace SA_POP {
// Type of a map from conditions to causal links.
typedef std::multimap <Condition, CausalLink> CondToCLinksMap;
+ typedef std::multimap <TaskInstID, CausalLink> TaskToCLinksMap;
+
/// Causal links in plan (mapping from conditions to all causal links
/// containing that condition).
CondToCLinksMap causal_links_;
+ TaskToCLinksMap causal_links_by_first;
+ TaskToCLinksMap causal_links_by_second;
+
+ SuspendedConditionListenerMap suspended_listener_map;
+ SuspendedConditionSet suspended_conditions;
/// Current plan (generated upon request).
Plan plan_;
@@ -358,13 +400,9 @@ namespace SA_POP {
/// Helper function to create next instance id.
virtual TaskInstID get_next_inst_id (void);
- /// Type of particular Task Implementation mapped to a Task Implementation Set.
- /// This is a particular Precedence set. Like Before, After etc.
- typedef std::map <TaskInstID, TaskInstSet> PrecedenceSet;
- /// Type of a Precedence Relation mapped to a Precedence Set.
- /// This gives the whole Precedence Graph
- typedef std::map <PrecedenceRelation, PrecedenceSet> PrecedenceGraph;
+ Condition no_condition;
+ CausalLink no_link;
/// PrecedenceGraph
PrecedenceGraph precedence_graph_;
@@ -395,6 +433,18 @@ namespace SA_POP {
// The set of reused task instances
std::multiset<TaskInstID> reused_insts_;
+
+ SchedulingLinks ordering_links;
+ //useful for doing the loop detection algorithm
+ SchedulingLinks reverse_ordering_links;
+ // SA_AssocTaskImplCmd* associate_cmd;
+
+ /*
+ bool is_cycle_in_ordering(void);
+ void dfs_aux(TaskInstID current, std::stack<TaskInstID>& s, std::map<TaskInstID, bool>& visited, std::map<TaskInstID, bool>& unvisited);
+ bool dfs_aux2(TaskInstID current, std::map<TaskInstID, bool>& visited);
+ */
+
/// Insert initially task by task in the precedence graph
/**
* @param task_inst The task instance to insert into the precedence graph
diff --git a/SA_POP/TaskMapFileIn.cpp b/SA_POP/TaskMapFileIn.cpp
index 964d84aeb50..85879795aee 100644
--- a/SA_POP/TaskMapFileIn.cpp
+++ b/SA_POP/TaskMapFileIn.cpp
@@ -102,6 +102,16 @@ void TaskMapFileIn::build_task_map (std::string filename, Builder *builder)
builder->add_task_impl (impl);
}
+ // ImplParamSet init_params;
+ // ImplParam init_param;
+ // init_param.id = "test_param1";
+ // init_param.kind = "test_kind1";
+ // init_param.value = "test_param_value1";
+ // init_params.insert (init_param);
+
+ // TaskImpl* initimpl = new TaskImpl ("initact_impl", init_params);
+ // builder->add_task_impl (initimpl);
+
// Get resources.
for (SA_POP::XML::TaskMap::resource_iterator res_iter =
xml_tm.begin_resource ();
@@ -133,6 +143,8 @@ void TaskMapFileIn::build_task_map (std::string filename, Builder *builder)
resource.capacity = capacity;
builder->add_resource (resource);
+
+// builder->assoc_impl_with_resource ("initact_impl", resourceID, 1);
}
// Get task to implementation associations.
@@ -155,6 +167,8 @@ void TaskMapFileIn::build_task_map (std::string filename, Builder *builder)
builder->assoc_task_with_impl (taskID, implID, duration);
}
+ // builder->assoc_task_with_impl (INIT_TASK_ID, "initact_impl", 1);
+
// Get task implementation to resource associations.
for (SA_POP::XML::TaskMap::implToResource_iterator iassocr_iter =
xml_tm.begin_implToResource ();
diff --git a/SA_POP/WorkingPlan.h b/SA_POP/WorkingPlan.h
index 3866bffc185..31f19c14a27 100644
--- a/SA_POP/WorkingPlan.h
+++ b/SA_POP/WorkingPlan.h
@@ -194,6 +194,10 @@ namespace SA_POP {
*/
virtual AdjustMaxTimesCmd *get_AdjustMaxTimesCmd (void) = 0;
+ virtual void generate_all_threats(void) = 0;
+
+ virtual InstToTaskMap get_task_insts(void) = 0;
+
protected:
/// Pointer to Planner object.
SA_POP::Planner *planner_;
diff --git a/SA_POP/docs/schema/Task_Map.xsd b/SA_POP/docs/schema/Task_Map.xsd
index 2138f082d48..adadec001bf 100644
--- a/SA_POP/docs/schema/Task_Map.xsd
+++ b/SA_POP/docs/schema/Task_Map.xsd
@@ -67,7 +67,7 @@
<xs:sequence>
<xs:element name="taskID" type="SA-POP:TaskID" />
<xs:element name="implID" type="SA-POP:TaskImplID" />
- <xs:element name="duration" type="SA-POP:TimeValue" default="-1" />
+ <xs:element name="duration" type="SA-POP:TimeValue" default="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ImplToResource">
diff --git a/SA_POP/C2W/c2w.san.xml b/SA_POP/examples/C2W/c2w.san.xml
index ec9adb232e9..ec9adb232e9 100644
--- a/SA_POP/C2W/c2w.san.xml
+++ b/SA_POP/examples/C2W/c2w.san.xml
diff --git a/SA_POP/C2W/c2w.tm.xml b/SA_POP/examples/C2W/c2w.tm.xml
index bc623b05950..bc623b05950 100644
--- a/SA_POP/C2W/c2w.tm.xml
+++ b/SA_POP/examples/C2W/c2w.tm.xml
diff --git a/SA_POP/examples/Simple/simple.tm.xml b/SA_POP/examples/Simple/simple.tm.xml
index ee8981a516a..1c6193a8e9b 100644
--- a/SA_POP/examples/Simple/simple.tm.xml
+++ b/SA_POP/examples/Simple/simple.tm.xml
@@ -67,12 +67,12 @@
<taskToImpl>
<taskID>2220</taskID>
<implID>2220_A0_1</implID>
- <duration>-1</duration>
+ <duration>1</duration>
</taskToImpl>
<taskToImpl>
<taskID>2221</taskID>
<implID>2221_A1_1</implID>
- <duration>-1</duration>
+ <duration>2</duration>
</taskToImpl>
<taskToImpl>
<taskID>2221</taskID>
@@ -82,7 +82,7 @@
<taskToImpl>
<taskID>2222</taskID>
<implID>2222_A2_1</implID>
- <duration>-1</duration>
+ <duration>1</duration>
</taskToImpl>
<implToResource>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/README b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/README
new file mode 100644
index 00000000000..9aa8624b45b
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/README
@@ -0,0 +1,123 @@
+PDDL to SANet translator
+
+Ben Podgursky
+benjamin.t.podgursky@vanderbilt.edu
+
+DESCRIPTION
+
+ This package holds the java program which is able to automatically translate PDDL problems
+ into Spreading Activation networks, doing limited optimization and pruning in the process.
+ It takes as an input a PDDL domain file, PDDL problem file, and arguments dictating the form
+ of the conversion.
+
+ It is capable of translating the following PDDL requirements:
+
+ strips
+ typing
+ equality
+ negative preconditions
+ disjunctive preconditions
+ conditional effects
+ probabilistic--limited
+
+INSTALLATION/RUNNING
+
+ Install ant (http://ant.apache.org/)
+ Make sure that ant's bin is in your path
+ Navigate to PDDLtoSANetTranslator\PDDLParser
+
+ To run the translator, enter:
+
+ ant clean build -Dargs="<domain file> <problem file> <want init action>
+ <condition checking depth> <output file name>" PDDLtoSAN
+
+ The arguments:
+ <domain file> the name of the pddl domain file
+ <problem file> the name of the pddl problem file
+ <want init action> whether to include an initial action in the output xml
+ file. The initial action has no preconditions and effect links to all
+ conditions equivalent to their initial states
+ <condition checking depth> number of conditions to check against a condition. eg,
+ if it is set to 3, it will check if any 3 conditions are together effected by the
+ same tasks as any one other task.
+ <output file name> the 3 produced files are given this as their suffix. Eg, for name
+ "test" it would generate "test-san.xml", "test-tm.xml", "test-goals.xml" for the
+ spreading activation network, task map, and goal files respectively.
+
+ For example, to run the ferry example included:
+
+ ant clean build -Dargs="ferry.pddl pb1ferry.pddl false 3 ferry" PDDLtoSAN
+
+TRANSLATION STRATEGIES
+
+ strips-- strips syntax is translated using a naive propositional expansion of all actions
+ and predicates, using all of the objects specified in the problem file
+
+ typing-- propositionalizes actions and conditions using only objects of the proper types
+ for each action/condition
+
+ equality/inequality-- makes sure that equality and inequality constraints are respected in
+ action definitions. preserves transitivity and reversibility
+
+ negative preconditions-- spreading activation networks can easily handle negative preconditions;
+ the true probability of the precondition link from the condition to the action is 0, and the
+ false probability is positive
+
+ disjunctive preconditions-- these are handled by first putting the action's preconditions in disjunctive normal
+ form, where the disjunction is the outermost function, and then splitting each clause into a separate
+ action. Eg, if an action A has preconditions condA || condB, it is split into two actions, A[0] with
+ precondition condA and A[1] with precondition condB. The effects of each action are identical to those
+ of the original action
+
+ conditional effects-- actions conditional effects are resolved by splitting the action into two actions, the
+ first where the condition's preconditions are asserted true in the preconditions, and the second where
+ they are asserted false.
+
+ probabilisitic effects-- by the nature of spreading activation networks, probabilistic effects can have
+ at most one term, and this term can have at most one condition asserted to a value (linking
+ effects together would be counter to the structure of a bayesian network, where effects are assumed to
+ be independent, and would generate incorrect plans.)
+
+OPTIMIZATIONS:
+
+ The above actions will produce a spreading activation network, but a massive one. The following optimizations
+ cut down the size of the network, while still preserving optimal paths:
+
+ Elimination and propagation of impossible conditions
+ Conditions falling in two categories should not need to exist in a network; conditions initially true
+ which have no effect links setting them false, and conditions initially false which are never set true;
+ collectively, these represent the conditions which never change value. Remove all of these condition nodes
+ from the network.
+ Then for each of these conditions, investigate its precondition links. If a task requires the condition in
+ the state it is always in, remove the precondition link, as it is trivial to satisfy anyway. If the action
+ needs the condition to be opposite its value, remove that task from the network, because it will never be able
+ to execute. This may cause other conditions to never change; continue in this manner until nothing can be
+ removed
+
+ Pruning of irrelevant tasks and conditions
+
+ All the conditions and tasks in the network are now likely attainable, but depending on the domain, most
+ be irrelevant to the problem at hand. We find only the relevant tasks by essentially doing a depth first search
+ from the goal conditions specified in the problem description. Start by finding all tasks which satisfy the
+ goal conditions. The find all tasks which satisfy the preconditions to these tasks, and continue until all
+ relevant tasks and conditions have been added. Now the network consists only of tasks and conditions which
+ are on a causal path to a goal.
+
+ Elimiation of regressive tasks
+
+ Often there are tasks which are intuitively bad to a human which do not get eliminated in the above steps
+ because they are on a valid path to the goal, albeit not the most efficient path.
+ One type of useless task is one which leaves the environment in a state which was necessarily true one
+ step before it was executed. We have to be careful though; we have to make sure that bringing the environment
+ into a state where this task can be executed did not allow another part of the plan to execute, and that the
+ task under scrutiny does not "reset" the environment to do something else useful; for example, a ferry sailing
+ repeatedly back and forth across a river.
+
+ Removal of aggregate conditions
+
+ Aggregate conditions are especially bad for causal link planners, but are common in strips problems, as
+ they have no negative preconditions. For example, in the ferry problem included, (empty-ferry) is equivalent
+ to (not (on c1 the-ferry)) && (not (on c2 the-ferry)). Replacing the former with the latter makes it easier
+ for the planner to choose the correct tasks to satisfy the preconditions. This translator looks for
+ situations where this can be done. A parameter passed in determines the depth of checking that should be done
+ here. \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/build.xml b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/build.xml
new file mode 100644
index 00000000000..a08b93a50e1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/build.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- WARNING: Eclipse auto-generated file.
+ Any modifications will be overwritten.
+ To include a user specific buildfile here, simply create one in the same
+ directory with the processing instruction <?eclipse.ant.import?>
+ as the first entry and export the buildfile again. -->
+<project basedir="." default="build" name="PDDLParser">
+ <property environment="env"/>
+ <property name="debuglevel" value="source,lines,vars"/>
+ <property name="target" value="1.6"/>
+ <property name="source" value="1.6"/>
+ <path id="PDDLParser.classpath">
+ <pathelement location="bin"/>
+ <pathelement location="commons-collections-3.2.1.jar"/>
+ </path>
+ <target name="init">
+ <mkdir dir="bin"/>
+ <copy includeemptydirs="false" todir="bin">
+ <fileset dir="src">
+ <exclude name="**/*.launch"/>
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+ </target>
+ <target name="clean">
+ <delete dir="bin"/>
+ </target>
+ <target depends="clean" name="cleanall"/>
+ <target depends="build-subprojects,build-project" name="build"/>
+ <target name="build-subprojects"/>
+ <target depends="init" name="build-project">
+ <echo message="${ant.project.name}: ${ant.file}"/>
+ <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
+ <src path="src"/>
+ <classpath refid="PDDLParser.classpath"/>
+ </javac>
+ </target>
+
+ <target name="PDDLtoSAN">
+ <java classname="PDDLtoSAN" failonerror="true" fork="yes">
+ <classpath refid="PDDLParser.classpath"/>
+ <arg line="${args}" />
+ </java>
+ </target>
+
+ <target name="jar">
+ <mkdir dir=""/>
+ <jar destfile="HelloWorld.jar" basedir="bin/">
+ <zipfileset src="commons-collections-3.2.1.jar" />
+ <manifest>
+ <attribute name="Main-Class" value="PDDLtoSAN"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-jar">
+ <java jar="HelloWorld.jar" fork="true">
+ <arg line="${args}" />
+ </java>
+ </target>
+
+
+</project>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jar b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jar
new file mode 100644
index 00000000000..c35fa1fee14
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/commons-collections-3.2.1.jar
Binary files differ
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl
new file mode 100644
index 00000000000..f104753e7aa
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-example.pddl
@@ -0,0 +1,36 @@
+(define (domain ferry)
+ (:requirements :strips :equality :typing)
+
+ (:types auto place ferry)
+ (:predicates (at-ferry ?f - ferry ?l - place)
+ (at ?x - auto
+ ?y - place)
+ (empty-ferry ?f - ferry)
+ (on ?x - auto
+ ?f - ferry)
+ (can-sail ?f - ferry
+ ?x - place
+ ?y - place
+ )
+ (can-debark-at ?x - place)
+ (can-board-at ?x - place)
+ )
+
+ (:action board
+ :parameters (?f - ferry ?x - auto ?y - place)
+ :precondition (and (at ?x ?y)(at-ferry ?f ?y)(empty-ferry ?f)(can-board-at ?y))
+ :effect
+ (and (on ?x ?f)
+ (not (at ?x ?y))
+ (not (empty-ferry ?f))))
+ (:action sail
+ :parameters (?f - ferry ?x ?y - place)
+ :precondition (and (at-ferry ?f ?x) (not (= ?x ?y)) (can-sail ?f ?x ?y))
+ :effect (and (at-ferry ?f ?y)
+ (not (at-ferry ?f ?x))))
+ (:action debark
+ :parameters (?f - ferry ?x - auto ?y - place)
+ :precondition (and (on ?x ?f)(at-ferry ?f ?y) (can-debark-at ?y))
+ :effect (and (not (on ?x ?f))
+ (at ?x ?y)
+ (empty-ferry ?f)))) \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl
new file mode 100644
index 00000000000..a4470e77c0a
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/ferry-problem-example.pddl
@@ -0,0 +1,31 @@
+(define (problem ferry1)
+ (:domain ferry)
+ (:requirements :strips :equality :typing)
+ (:objects a b c - place
+ c1 c2 - auto
+ f1 f2 - ferry)
+ (:init
+ (at c1 a)
+ (at c2 a)
+
+ (at-ferry f1 a)
+ (empty-ferry f1)
+ (can-sail f1 b c)
+ (can-sail f1 c b)
+ (can-sail f1 a b)
+ (can-sail f1 b a)
+
+ (at-ferry f2 b)
+ (empty-ferry f2)
+ (can-sail f2 b c)
+ (can-sail f2 c b)
+
+ (can-debark-at b)
+ (can-debark-at c)
+
+ (can-board-at a)
+ (can-board-at b)
+
+ )
+ (:goal (and (at c1 c) (at c2 c)))
+) \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb1travel.pddl b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb1travel.pddl
new file mode 100644
index 00000000000..f7404c7435a
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb1travel.pddl
@@ -0,0 +1,34 @@
+(define (problem pb1)
+ (:domain travel)
+ (:requirements :strips :equality)
+ (:objects a b c d e f g jack bulldozer)
+
+ (:init (at jack a)
+ (at bulldozer e)
+ (vehicle bulldozer)
+ (mobile jack)
+ (person jack)
+ (road a b)
+ (road b a)
+ (road a e)
+ (road e a)
+ (road e b)
+ (road b e)
+ (road a c)
+ (road c a)
+ (road c b)
+ (road b c)
+ (bridge b d)
+ (bridge d b)
+ (bridge c f)
+ (bridge f c)
+ (road d f)
+ (road f d)
+ (road f g)
+ (road g f)
+ (road d g)
+ (road g d))
+
+ (:goal (and (at bulldozer g) (at jack a)))
+
+) \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb2travel.pddl b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb2travel.pddl
new file mode 100644
index 00000000000..d6f3378da12
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/pb2travel.pddl
@@ -0,0 +1,45 @@
+(define (problem pb2)
+ (:domain travel)
+ (:requirements :strips :equality)
+ (:objects a b c d e f g h i j k l m n jack bulldozer)
+ (:init (at jack a)
+ (at bulldozer e)
+ (vehicle bulldozer)
+ (mobile jack)
+ (person jack)
+ (road a b)
+ (road b a)
+ (road a c)
+ (road c a)
+ (road c d)
+ (road d c)
+ (road d e)
+ (road e d)
+ (road e j)
+ (road j e)
+ (road d f)
+ (road f d)
+ (road f j)
+ (road j f)
+ (road f k)
+ (road k f)
+ (road j h)
+ (road h j)
+ (road h k)
+ (road k h)
+ (bridge k l)
+ (bridge l k)
+ (bridge k n)
+ (bridge n k)
+ (road l m)
+ (road m l)
+ (road m n)
+ (road n m)
+ (road m g)
+ (road g m)
+ (road n g)
+ (road g n))
+
+ (:goal (AND (at bulldozer g)))
+
+ ) \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java
new file mode 100644
index 00000000000..341b4162ac9
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/PDDLtoSAN.java
@@ -0,0 +1,177 @@
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Scanner;
+
+import Translator.PDDL_Translator;
+import Translator.StatisticsCompilation;
+import Translator.StatisticsReport;
+
+import pddl4j.Domain;
+import pddl4j.ErrorManager;
+import pddl4j.PDDLObject;
+import pddl4j.Parser;
+import pddl4j.Problem;
+import pddl4j.RequireKey;
+import pddl4j.Source;
+import pddl4j.ErrorManager.Message;
+
+public class PDDLtoSAN {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+
+// if(args.length != 5){
+// System.out.println("Wrong number of arguments: "+args.length);
+// System.exit(0);
+// }
+//
+// String domain_path = args[0];
+// String problem_path = args[1];
+// boolean include_init = new Boolean(args[2]);
+// int cond_combine = new Integer(args[3]);
+// String output_name = args[4];
+
+// String domain_path = "TPP-domain.pddl";
+// String problem_path = "tpp-p08.pddl";
+// boolean include_init = false;
+// int cond_combine = 2;
+// String output_name = "ferry-orig-pruned";
+
+ Properties options = new Properties();
+ options.put("source", Source.V3_0);
+ options.put(RequireKey.STRIPS, true);
+ options.put(RequireKey.TYPING, true);
+ options.put(RequireKey.EQUALITY, true);
+ options.put(RequireKey.NEGATIVE_PRECONDITIONS, true);
+ options.put(RequireKey.DISJUNCTIVE_PRECONDITIONS, true);
+ options.put(RequireKey.CONDITIONAL_EFFECTS, true);
+
+ Map<String, List<String>> domains_to_problems = read_input_file(args[0]);
+
+ // List<StatisticsReport> info_sets = new LinkedList<StatisticsReport>();
+
+ StatisticsCompilation all_stat_compl = new StatisticsCompilation();
+
+ for(String domain_path: domains_to_problems.keySet()){
+
+ StatisticsCompilation stat_compl = new StatisticsCompilation();
+
+ Domain domain = null;
+ File domain_file = new File(domain_path);
+ Parser parser = new Parser(options);
+
+ try {
+ domain = parser.parse(domain_file);
+ } catch (FileNotFoundException e) {
+ System.out.println("Error: domain file "+domain_file+" not found");
+ System.exit(0);
+ }
+
+ for(String problem_path: domains_to_problems.get(domain_path)){
+ File problem_file = new File(problem_path);
+ Problem problem = null;
+ Parser problem_parser = new Parser(options);
+
+ try {
+ problem = problem_parser.parse(problem_file);
+ } catch (FileNotFoundException e) {
+ System.out.println("Error: problem file "+problem_file+" not found");
+ System.exit(0);
+ }
+
+ PDDLObject obj = problem_parser.link(domain, problem);
+ ErrorManager mgr = parser.getErrorManager();
+
+ if (mgr.contains(Message.ERROR)) {
+ mgr.print(Message.ALL);
+ mgr.clear();
+ System.exit(0);
+ }
+ else {
+ mgr.print(Message.WARNING);
+ mgr.clear();
+
+ System.out.println();
+ System.out.println("Translating: "+ problem_file+ " " + domain_file);
+ System.out.println();
+
+ PDDL_Translator n = new PDDL_Translator(obj, 1, false);
+
+ System.out.println("Done translating");
+ System.out.println(" SAN number of conditions: "+ n.getConditonNodeCount());
+ System.out.println(" SAN number of actions: " + n.getActionNodeCount());
+
+ stat_compl.all_reports.add(n.getStatReport());
+ all_stat_compl.all_reports.add(n.getStatReport());
+
+ // n.printSAN();
+ // n.write_SAN_to_xml(domain.getDomainName()+"_"+problem.getProblemName()+"-san.xml");
+ // n.write_TM_to_xml(domain.getDomainName()+"_"+problem.getProblemName()+"-tm.xml");
+ // n.write_goals_to_file(domain.getDomainName()+"_"+problem.getProblemName()+"-goals");
+ }
+ }
+
+ try {
+ FileWriter fileout = new FileWriter(new File(domain_path+args[1]));
+ fileout.write(stat_compl.toString());
+ fileout.close();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ FileWriter fileout;
+ try {
+ fileout = new FileWriter(new File(args[1]));
+ fileout.write(all_stat_compl.toString());
+ fileout.close();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ // System.out.println(stat_compl.toString());
+ }
+
+ public static Map<String, List<String>> read_input_file(String filename){
+ //TODO make this work properly
+ Map<String, List<String>> to_ret = new LinkedHashMap<String, List<String>>();
+ Scanner scan = null;
+ try {
+ scan = new Scanner(new FileReader(new File(filename)));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ while(scan.hasNext()){
+ String domain_name = scan.next();
+
+ String next = scan.next();
+ List<String> problems = new LinkedList<String>();
+
+ while(!next.equals("END")){
+ problems.add(next);
+ next = scan.next();
+ }
+ to_ret.put(domain_name, problems);
+ }
+
+ return to_ret;
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java
new file mode 100644
index 00000000000..17c82e39fab
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/ActionData.java
@@ -0,0 +1,304 @@
+package Translator;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.action.Action;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+public class ActionData{
+
+ private Action a;
+ private Substitution s;
+ private List<Variable> free_parameters;
+ private List<Variable> all_params;
+ EqualityConstraintManager manager;
+ private Map<Type, List<Constant> > type_list;
+
+ public ActionData(Action p_a, Map<Type, List<Constant> > p_type_list){
+
+ a = p_a;
+ s = new Substitution();
+ free_parameters = new LinkedList<Variable>();
+ all_params = new LinkedList<Variable>();
+ manager = new EqualityConstraintManager();
+ type_list = p_type_list;
+ }
+
+ /**
+ * To save room when recursing, only copies certain data
+ * @param copy
+ */
+ public ActionData(ActionData copy){
+
+ a = copy.a;
+ s =copy.s.clone();
+ free_parameters = new LinkedList<Variable>(copy.free_parameters);
+ all_params = copy.all_params;
+ manager = new EqualityConstraintManager(copy.manager);
+ type_list = copy.type_list;
+ }
+
+ public void add_free_variable(Variable v){
+ free_parameters.add(v);
+ all_params.add(v);
+ manager.add_variable(v);
+ }
+
+ /**
+ * done first
+ * @param v
+ * @param not
+ */
+ public void fix_variable_not_equal_variable(Variable v, Variable not){
+
+ manager.assign_inequal_var_var(v, not);
+ }
+
+ /**
+ * Second
+ * @param v
+ * @param to
+ */
+ public void fix_variable_to_variable(Variable v, Variable to){
+
+ manager.assign_equal_var_var(v, to);
+ }
+
+ /**
+ * third
+ * @param v
+ * @param not
+ */
+ public void fix_variable_not_equal_constant(Variable v, Constant not){
+
+ manager.assign_inequal_var_const(v, not);
+ }
+
+
+ /**
+ * note--only call this when reading in the preconditions. Not while
+ * enumerating!
+ * @param v
+ * @param to
+ */
+ public void fix_variable_to_constant(Variable v, Constant to){
+
+ s.bind(v, to);
+ manager.assign_equal_var_const(v, to);
+ }
+
+ public void temp_fix_variable_to_constant(Variable v, Constant to){
+
+ s.bind(v, to);
+ free_parameters.remove(v);
+ manager.temp_assign_equal_var_const(v, to);
+
+ }
+
+ public boolean has_free_variable(){
+ return !free_parameters.isEmpty();
+ }
+
+ public Variable get_first_free_variable(){
+ return free_parameters.get(0);
+ }
+
+ public List<String> get_all_substituted_parameters(){
+
+ List<String> params = new LinkedList<String>();
+ for(Term t: a.getParameters()){
+ params.add(s.getBinding((Variable)t).toString());
+ }
+
+ return params;
+ }
+
+ public List<Constant> get_possible_values(Variable v){
+
+ if(manager.variable_to_constraint.get(v).fixed_to == null)
+ return manager.variable_to_constraint.get(v).possible_constant_values;
+ else{
+
+ List<Constant> possible = new LinkedList<Constant>();
+ possible.add(manager.variable_to_constraint.get(v).fixed_to);
+ return possible;
+ }
+ }
+
+ public String get_action_name(){
+
+ String action_name = a.getName();
+
+ for(Variable v: all_params){
+ action_name+=(" "+s.getBinding(v).toString());
+ }
+
+ return action_name;
+ }
+
+ public Exp get_precondition_expression(){
+ return a.getPrecondition().apply(s);
+ }
+
+ public Exp get_effect_expression(){
+ return a.getEffect().apply(s);
+ }
+
+ class EqualityConstraintManager{
+
+ Map<Variable, VariableConstraint> variable_to_constraint = new LinkedHashMap<Variable, VariableConstraint>();
+
+ public EqualityConstraintManager(EqualityConstraintManager copy){
+
+
+
+ for(VariableConstraint constr: copy.variable_to_constraint.values()){
+
+
+ VariableConstraint new_entry = new VariableConstraint(constr);
+ for(Variable v: new_entry.equal_variables){
+ variable_to_constraint.put(v, new_entry);
+ }
+ }
+
+ }
+
+ public EqualityConstraintManager(){
+
+ }
+
+ public void add_variable(Variable v){
+ variable_to_constraint.put(v, new VariableConstraint(v));
+ }
+
+ public void assign_equal_var_var(Variable a, Variable b){
+
+ VariableConstraint b_const = variable_to_constraint.get(b);
+ VariableConstraint a_const = variable_to_constraint.get(a);
+
+ for(Variable v: b_const.inequality_variable_constraints){
+ if(a_const.equal_variables.contains(v)){
+ a_const.possible_constant_values.clear();
+ }
+ }
+
+ List<Variable> new_equal_variables = new LinkedList<Variable>(a_const.equal_variables);
+ for(Variable v: b_const.equal_variables){
+ variable_to_constraint.put(v, a_const);
+ new_equal_variables.add(v);
+ }
+
+ a_const.equal_variables = new_equal_variables;
+ a_const.possible_constant_values.retainAll(b_const.possible_constant_values);
+ a_const.inequality_variable_constraints.addAll(b_const.inequality_variable_constraints);
+ }
+
+ public void assign_inequal_var_var(Variable a, Variable b){
+
+ VariableConstraint b_const = variable_to_constraint.get(b);
+ VariableConstraint a_const = variable_to_constraint.get(a);
+
+ a_const.inequality_variable_constraints.add(b);
+ b_const.inequality_variable_constraints.add(a);
+
+ if(a.equals(b)){
+ a_const.possible_constant_values.clear();
+ }
+ }
+
+ public void assign_inequal_var_const(Variable a, Constant b){
+ variable_to_constraint.get(a).possible_constant_values.remove(b);
+ }
+
+ public void assign_equal_var_const(Variable a, Constant b){
+
+ VariableConstraint a_const = variable_to_constraint.get(a);
+
+ if(a_const.possible_constant_values.contains(b)){
+
+ a_const.possible_constant_values.clear();
+ a_const.possible_constant_values.add(b);
+
+ for(Variable v: a_const.inequality_variable_constraints){
+ variable_to_constraint.get(v).possible_constant_values.remove(b);
+ }
+ }else{
+ a_const.possible_constant_values.clear();
+ }
+ }
+
+ public void temp_assign_equal_var_const(Variable a, Constant b){
+
+ VariableConstraint a_const = variable_to_constraint.get(a);
+
+ if(a_const.fixed_to != null){
+
+ for(Variable v: a_const.inequality_variable_constraints){
+
+ VariableConstraint v_const = variable_to_constraint.get(v);
+ if(v_const.denied_by.contains(a)){
+ v_const.possible_constant_values.add(a_const.fixed_to);
+ }
+ }
+ }
+
+ a_const.fixed_to = b;
+
+ for(Variable v: a_const.inequality_variable_constraints){
+
+ VariableConstraint v_const = variable_to_constraint.get(v);
+
+ if(v_const.possible_constant_values.contains(b)){
+ v_const.denied_by.add(a);
+ v_const.possible_constant_values.remove(b);
+ }
+ }
+ }
+
+ class VariableConstraint{
+
+ public VariableConstraint(VariableConstraint copy){
+ equal_variables = copy.equal_variables;
+ inequality_variable_constraints = copy.inequality_variable_constraints;
+ possible_constant_values = new LinkedList<Constant>(copy.possible_constant_values);
+ denied_by = new LinkedList<Variable>(copy.denied_by);
+ fixed_to = copy.fixed_to;
+ }
+
+ public VariableConstraint(Variable v){
+ equal_variables.add(v);
+
+ possible_constant_values = new LinkedList<Constant>();
+
+ Iterator<Type> type_it = v.getTypeSet().iterator();
+
+ while(type_it.hasNext()){
+ Type typ = type_it.next();
+ if(type_list.get(typ) != null){
+ possible_constant_values.addAll(type_list.get(typ));
+ }
+ }
+
+ denied_by = new LinkedList<Variable>();
+ fixed_to = null;
+ }
+
+ public List<Variable> equal_variables = new LinkedList<Variable>();
+ public List<Variable> inequality_variable_constraints = new LinkedList<Variable>();
+ public List<Constant> possible_constant_values;
+ public List<Variable> denied_by;
+
+ public Constant fixed_to;
+ }
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java
new file mode 100644
index 00000000000..5fd7e8a9099
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/PDDL_Translator.java
@@ -0,0 +1,2741 @@
+package Translator;
+
+import java.io.FileWriter;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import Translator.SAN_Data.CondNode;
+import Translator.SAN_Data.EffectLink;
+import Translator.SAN_Data.PrecondLink;
+import Translator.SAN_Data.TaskNode;
+import Translator.TM_Data.ImplToResource;
+import Translator.TM_Data.Resource;
+import Translator.TM_Data.TaskImpl;
+import Translator.TM_Data.TaskToImpl;
+
+import pddl4j.PDDLObject;
+import pddl4j.exp.AndExp;
+import pddl4j.exp.AtomicFormula;
+import pddl4j.exp.Exp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.InitEl;
+import pddl4j.exp.NotExp;
+import pddl4j.exp.OrExp;
+import pddl4j.exp.ProbExp;
+import pddl4j.exp.WhenExp;
+import pddl4j.exp.action.Action;
+import pddl4j.exp.action.ActionDef;
+import pddl4j.exp.fcomp.EqualComp;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+import org.apache.commons.collections.MultiMap;
+import org.apache.commons.collections.map.MultiValueMap;
+import org.w3c.dom.*;
+
+import javax.xml.parsers.*;
+
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import javax.xml.transform.stream.*;
+
+
+public class PDDL_Translator {
+
+ StatisticsReport stat_report;
+
+ Map<String, CondNode> condition_nodes = new LinkedHashMap<String, CondNode>();
+ Map<String, TaskNode> task_nodes= new LinkedHashMap<String, TaskNode>();
+
+ List<PrecondLink> precondition_links = new LinkedList<PrecondLink>();
+ List<EffectLink> effect_links = new LinkedList<EffectLink>();
+
+ Map<Type, List<Constant> > typeset_to_constant= new LinkedHashMap<Type, List<Constant> >();
+ Map<String, Boolean> goal_states = new LinkedHashMap<String, Boolean>();
+
+ Map<String, TaskImpl> task_impls = new LinkedHashMap<String, TaskImpl>();
+ Map<String, Resource> resources = new LinkedHashMap<String, Resource>();
+
+ List<TaskToImpl> task_to_impl_links = new LinkedList<TaskToImpl>();
+ List<ImplToResource> impl_to_resource_links = new LinkedList<ImplToResource>();
+
+ Map<TaskNode, List<String> > task_to_resources = new LinkedHashMap<TaskNode, List<String> >();
+
+ boolean init_act_visible;
+
+ /**
+ *
+ * @param pddl_object
+ *
+ * The object the parser uses to extract the SAN and TM
+ *
+ * @param use_initial_action
+ *
+ * Include an initial action, with effects to all conditions, in the SAN
+ */
+ public PDDL_Translator(PDDLObject pddl_object, int condition_combine_levels, boolean use_initial_action){
+
+ stat_report = new StatisticsReport(pddl_object.getDomainName(), pddl_object.getProblemName());
+
+ long start_time = new Date().getTime();
+
+ init_act_visible = use_initial_action;
+
+ List<Action> action_list;
+ List<ActionData> action_data;
+
+ //Even if we don't use init act, we can't give SA-POP an action named 20.
+ TaskNode init_act = new TaskNode("initact");
+
+ //First, maps constants to their types; second, creates a resource for every constant
+ record_constants(pddl_object);
+
+ //Read in the goals and remember what they are.
+ get_goals(pddl_object);
+
+ //Creates conditions for every proposition, sets them all false at first
+ enumerate_propositions_default(pddl_object);
+
+ //Now replace the ones that were asserted true in the problem
+ set_initial_propositions(pddl_object);
+
+ //Get all the initial actions
+ action_list = get_all_actions(pddl_object);
+
+ //Splices when constructs out of the effects and turns them into multiple actions
+ action_list = remove_conditionals(action_list);
+
+ //Turns the preconditions to disjunctive normal form and splits the terms into multiple
+ //actions
+ action_list = remove_precondition_disjunctions(action_list);
+
+ //Not sure if this step is necessary, but goes through and normalizes stuff, mainly to get
+ //rid of double nested not clauses.
+ action_list = convert_preconditions_to_prenex(action_list);
+
+ //Go through and look at the equality/inequality constraints remaining.
+ action_data = parse_equality_constraints(action_list);
+
+
+
+ //Make sure that there aren't untranslatable probabilities encoded
+ if(!are_probabilistics_translatable(action_list)){
+ System.out.println("Probabilistics this complex cannot currently be translated to a SANet");
+ System.exit(0);
+ }
+
+ //Propositionalize all actions
+ enumerate_actions(action_data);
+
+
+
+ //Add the initial action in as an anchor--otherwise it would seem that none
+ //of the conditions can come true
+ setup_initial_action(init_act);
+
+ calculateNetworkStatistics("before_impossibility_removal");
+
+ System.out.println("Before optimizing: "+ this.task_nodes.size()+" tasks "+ this.condition_nodes.size()+" conditions");
+ System.out.println("Elapsed: "+ (new Date().getTime()-start_time));
+
+ boolean keep_looping;
+ do {
+
+ //Propagate up through all impossible tasks and get rid of ones that can never
+ //come true
+ keep_looping = eliminate_impossible_tasks();
+
+ //Basically cut down through the tasks and conditions and only take the relevant
+ //ones
+ // keep_looping = eliminate_irreleevant_tasks_and_conditions()||keep_looping;
+ //Get rid of tasks that take plan backwards and where getting there
+ //helps nothing else
+ //////////// keep_looping = eliminate_dominated_tasks()||keep_looping;
+ } while(keep_looping);
+
+ //Go through and look to see if any conditions can be replaced by a set of other
+ //conditions
+ //TODO maybe try something like a kmap here?
+
+
+ calculateNetworkStatistics("before_cond_combining");
+
+ // combine_conditions(condition_combine_levels);
+
+ // calculateNetworkStatistics("after_cond_combining");
+
+ System.out.println("End elapsed: "+ (new Date().getTime()-start_time));
+
+ //Give preconditions links the proper probabilities
+ set_probabilities();
+
+ //Make task impls for every task
+ record_task_impls();
+ }
+
+ private void calculateNetworkStatistics(String label){
+
+ System.out.println();
+ System.out.println("Network stats at: "+label);
+ System.out.println(" Number of conditions: "+this.condition_nodes.size());
+ System.out.println(" Number of tasks: "+ this.task_nodes.size());
+ System.out.println();
+
+ int total_precond_links = 0;
+ int num_sat_links = 0;
+
+ int num_threat_links = 0;
+
+ int total_effect_links = 0;
+
+// int[] effects_per_cond = new int[condition_nodes.size()];
+// int[] preconds_per_cond = new int[condition_nodes.size()];
+// int[] effects_per_task = new int[task_nodes.size()-1];
+// int[] preconds_per_task = new int[task_nodes.size()-1];
+
+ List<Integer> effects_per_cond = new LinkedList<Integer>();
+ List<Integer> preconds_per_cond = new LinkedList<Integer>();
+ List<Integer> effects_per_task = new LinkedList<Integer>();
+ List<Integer> preconds_per_task = new LinkedList<Integer>();
+
+ List<Integer> ways_to_sat_each_precond = new LinkedList<Integer>();
+ List<Integer> threats_to_each_precond = new LinkedList<Integer>();
+
+ int count = 0;
+ for(CondNode cnd: this.condition_nodes.values()){
+
+ int num_pos_effect = 0;
+ int num_neg_effect = 0;
+
+ for(EffectLink el: cnd.getAffectedBy()){
+
+ if(el.action.getName().equals("initact")){
+ continue;
+ }
+
+ if(el.getWeight() == 1){
+ num_pos_effect++;
+ }else if(el.getWeight() == -1){
+ num_neg_effect++;
+ }
+
+ total_effect_links++;
+ }
+
+ for(PrecondLink pl: cnd.getPreconditionTo()){
+ if(pl.getRequiredState()){
+ num_sat_links+=num_pos_effect;
+ ways_to_sat_each_precond.add(num_pos_effect);
+
+ num_threat_links+=num_neg_effect;
+ threats_to_each_precond.add(num_neg_effect);
+ }else{
+ num_sat_links+=num_neg_effect;
+ ways_to_sat_each_precond.add(num_neg_effect);
+
+ num_threat_links+=num_neg_effect;
+ threats_to_each_precond.add(num_pos_effect);
+ }
+
+ total_precond_links++;
+ }
+
+ preconds_per_cond.add(cnd.getPreconditionTo().size());
+ effects_per_cond.add(cnd.getAffectedBy().size());
+
+ count++;
+ }
+
+ count = 0;
+ for(TaskNode tnd: this.task_nodes.values()){
+
+ if(tnd.getName().equals("initact")){
+ continue;
+ }
+
+ effects_per_task.add(tnd.get_negative_effect_links().size()+tnd.get_positive_effect_links().size());
+ preconds_per_task.add(tnd.get_positive_precondition_links().size()+tnd.get_negative_precondition_links().size());
+ count++;
+ }
+
+ InfoSet info_set = new InfoSet();
+
+ info_set.total_tasks = this.task_nodes.size() - 1;
+ info_set.total_conds = this.condition_nodes.size();
+ info_set.total_preconds = this.precondition_links.size();
+ info_set.total_effects = this.effect_links.size();
+
+ info_set.effects_per_cond = effects_per_cond;
+ info_set.preconds_per_cond = preconds_per_cond;
+ info_set.effects_per_act = effects_per_task;
+ info_set.preconds_per_act = preconds_per_task;
+ info_set.satisfiers_per_precond = ways_to_sat_each_precond;
+ info_set.threats_per_precond = threats_to_each_precond;
+
+ info_set.avg_effects_per_cond = total_effect_links/(double)condition_nodes.size();
+ info_set.avg_preconds_per_cond = total_precond_links/(double)condition_nodes.size();
+ info_set.avg_effects_per_act = total_effect_links/(double)task_nodes.size();
+ info_set.avg_preconds_per_act = total_effect_links/(double)task_nodes.size();
+ info_set.avg_satisfiers_per_precond = num_sat_links/(double)total_precond_links;
+ info_set.avg_threats_per_precond = num_threat_links/(double)total_precond_links;
+
+ info_set.std_dev_effects_per_cond = get_std_dev(info_set.avg_effects_per_cond, effects_per_cond);
+ info_set.std_dev_preconds_per_cond = get_std_dev(info_set.avg_preconds_per_cond, preconds_per_cond);
+ info_set.std_dev_effects_per_act = get_std_dev(info_set.avg_effects_per_act, effects_per_task);
+ info_set.std_dev_preconds_per_act = get_std_dev(info_set.avg_preconds_per_act, preconds_per_task);
+ info_set.std_dev_satisfiers_per_precond = get_std_dev(info_set.avg_satisfiers_per_precond , ways_to_sat_each_precond);
+ info_set.std_dev_threats_per_precond = get_std_dev(info_set.avg_threats_per_precond, threats_to_each_precond);
+
+ //Find the probability that an arbitrary precondition has an effect opposite it
+
+ double precond_with_negation = 0;
+ for(PrecondLink el: this.precondition_links){
+ TaskNode tnd = el.action;
+
+ List<EffectLink> all_effects = new LinkedList<EffectLink>(tnd.get_negative_effect_links());
+ all_effects.addAll(tnd.get_positive_effect_links());
+
+ for(EffectLink elk: all_effects){
+ if(elk.effect == el.precondition && el.getRequiredState() != (elk.getWeight() == 1)){
+ precond_with_negation++;
+ break;
+ }
+ }
+ }
+
+ info_set.reverse_link_prob = precond_with_negation/this.precondition_links.size();
+ // System.out.println(info_set.reverse_link_prob);
+
+ //TODO generate reverse link prob
+ //TODO generate clustering coeff
+ //TODO diameter!
+
+ // if(!label.equals("before_impossibility_removal")){
+
+ System.out.println("Generating simplified graph");
+ Map<String, SimpleNode> simple_graph = generate_simplified_graph();
+ System.out.println("Done generating simplified graph");
+
+
+ List<Double> connectednesses = new LinkedList<Double>();
+
+ for(SimpleNode sn: simple_graph.values()){
+ double connected = 0;
+
+ for(SimpleNode sn_child: sn.neigbors){
+ for(SimpleNode sn_child_check: sn.neigbors){
+ if(sn_child == sn_child_check){
+ continue;
+ }
+ if(sn_child.neigbors.contains(sn_child_check)){
+ connected++;
+ }
+ }
+ }
+ // System.out.println("Connected: "+connected);
+ // System.out.println("Neighbors: "+sn.neigbors.size());
+ // if(sn.neigbors.size() > 1)
+ connectednesses.add((connected)/(sn.neigbors.size()*(sn.neigbors.size()-1)));
+ // System.out.println((connected)/(sn.neigbors.size()*(sn.neigbors.size()-1)));
+ }
+
+ double sum = 0;
+
+ for(Double d: connectednesses){
+ sum+=d;
+ }
+ info_set.clustering_coeff = sum/connectednesses.size();
+ // }
+
+ stat_report.reports.put(label, info_set);
+ }
+
+ public StatisticsReport getStatReport(){
+ return stat_report;
+ }
+
+ private Map<String, SimpleNode> generate_simplified_graph(){
+ Map<String, SimpleNode> node_name_to_simple = new LinkedHashMap<String, SimpleNode>();
+
+ for(String tn: this.task_nodes.keySet()){
+
+ if(tn.equals("initact")){
+ continue;
+ }
+
+ node_name_to_simple.put(task_nodes.get(tn).getName(), new SimpleNode(tn));
+ }
+
+ for(TaskNode tn: this.task_nodes.values()){
+
+ if(tn.getName().equals("initact")){
+ continue;
+ }
+
+ List<EffectLink> all_effects = new LinkedList<EffectLink>(tn.get_negative_effect_links());
+ all_effects.addAll(tn.get_positive_effect_links());
+
+ for(EffectLink elk: all_effects){
+ CondNode condition = elk.effect;
+
+ //All precond from cond
+ for(PrecondLink pl: condition.getPreconditionTo()){
+ TaskNode tn2 = pl.action;
+ if(tn2 == tn || tn2.getName().equals("initact")){
+ continue;
+ }
+
+
+ SimpleNode.connect(node_name_to_simple.get(tn.getName()), node_name_to_simple.get(tn2.getName()));
+ }
+
+ //All effect from cond
+ for(EffectLink el: condition.getAffectedBy()){
+ TaskNode tn2 = el.action;
+ if(tn2 == tn || tn2.getName().equals("initact")){
+ continue;
+ }
+
+ // System.out.println(tn2.getNodeID());
+ // System.out.println(tn.getName());
+ // System.out.println(tn2.getName());
+ SimpleNode.connect(node_name_to_simple.get(tn.getName()), node_name_to_simple.get(tn2.getName()));
+ }
+ }
+
+ List<PrecondLink> all_preconds = new LinkedList<PrecondLink>(tn.get_negative_precondition_links());
+ all_preconds.addAll(tn.get_positive_precondition_links());
+
+ for(PrecondLink plk: all_preconds){
+ CondNode condition = plk.precondition;
+
+ //All precond from cond
+ for(PrecondLink pl: condition.getPreconditionTo()){
+ TaskNode tn2 = pl.action;
+ if(tn2 == tn || tn2.getName().equals("initact")){
+ continue;
+ }
+
+ SimpleNode.connect(node_name_to_simple.get(tn.getName()), node_name_to_simple.get(tn2.getName()));
+ }
+
+ //All effect from cond
+ for(EffectLink el: condition.getAffectedBy()){
+ TaskNode tn2 = el.action;
+ if(tn2 == tn || tn2.getName().equals("initact")){
+ continue;
+ }
+
+ SimpleNode.connect(node_name_to_simple.get(tn.getName()), node_name_to_simple.get(tn2.getName()));
+ }
+ }
+ }
+
+ return node_name_to_simple;
+ }
+
+ private double get_std_dev(double mean, int[] data){
+
+ double sum_squares = 0;
+ for(int i = 0; i < data.length; i++){
+ sum_squares+=Math.pow(mean-data[i], 2);
+ }
+ double avg = sum_squares/data.length;
+ return Math.sqrt(avg);
+ }
+
+ private double get_std_dev(double mean, List<Integer> data){
+ double sum_squares = 0;
+ for(Integer theint: data){
+ sum_squares+=Math.pow(mean-theint, 2);
+ }
+ double avg = sum_squares/data.size();
+ return Math.sqrt(avg);
+ }
+
+ MultiMap opp_effect_same_task;
+ MultiMap common_task;
+
+ private void combine_conditions(int max_search){
+
+ long intv1 = new Date().getTime();
+
+ opp_effect_same_task = new MultiValueMap();
+ common_task = new MultiValueMap();
+
+ for(TaskNode tn: this.task_nodes.values()){
+ for(EffectLink efln: tn.get_positive_effect_links()){
+ for(EffectLink o_efln: tn.get_negative_effect_links()){
+ opp_effect_same_task.put(efln.effect, o_efln.effect);
+ opp_effect_same_task.put(o_efln.effect, efln.effect);
+ }
+ }
+
+ for(EffectLink efln: tn.get_positive_effect_links()){
+ for(EffectLink ef2: tn.get_positive_effect_links()){
+ common_task.put(efln.effect, ef2.effect);
+ common_task.put(ef2.effect, efln.effect);
+ }
+ for(EffectLink ef2: tn.get_negative_effect_links()){
+ common_task.put(efln.effect, ef2.effect);
+ common_task.put(ef2.effect, efln.effect);
+ }
+ }
+ for(EffectLink efln: tn.get_negative_effect_links()){
+ for(EffectLink ef2: tn.get_positive_effect_links()){
+ common_task.put(efln.effect, ef2.effect);
+ common_task.put(ef2.effect, efln.effect);
+ }
+ for(EffectLink ef2: tn.get_negative_effect_links()){
+ common_task.put(efln.effect, ef2.effect);
+ common_task.put(ef2.effect, efln.effect);
+ }
+ }
+ }
+
+ for(int i = 1; i <= max_search; i++)
+ {
+ boolean found_combine = true;
+
+ while(found_combine){
+
+ found_combine = combine_conditions_aux(new LinkedList<CondNode>(), i);
+
+ if(found_combine){
+ if(!neg_combine){
+
+ for(PrecondLink lnk: replaced.getPreconditionTo()){
+ for(CondNode cnd: replacers){
+ precondition_links.add(lnk.action.attach_precondition(cnd, lnk.required_state));
+ }
+ }
+
+ if(this.goal_states.containsKey(replaced.getName())){
+ boolean value = this.goal_states.get(replaced.getName());
+ this.goal_states.remove(replaced.getName());
+ for(CondNode cnd: replacers){
+
+ this.goal_states.put(cnd.getName(), value);
+ }
+ }
+
+ destroy_condition(replaced);
+ }else{
+
+
+ for(PrecondLink lnk: replaced.getPreconditionTo()){
+
+ for(CondNode cnd: replacers){
+ precondition_links.add(lnk.action.attach_precondition(cnd, !lnk.required_state));
+ }
+ }
+
+ if(this.goal_states.containsKey(replaced.getName())){
+ boolean value = this.goal_states.get(replaced.getName());
+ this.goal_states.remove(replaced.getName());
+ for(CondNode cnd: replacers){
+
+ this.goal_states.put(cnd.getName(), !value);
+ }
+ }
+
+ destroy_condition(replaced);
+
+ }
+ }
+ }
+ }
+
+ long intv2 = new Date().getTime();
+ }
+
+
+ private boolean combine_conditions_aux(List<CondNode> fixed_cnds, int still_to_fix){
+ if(still_to_fix != 0){
+ for(CondNode cn: this.condition_nodes.values()){
+
+ boolean skip = false;
+ Object to_cast = opp_effect_same_task.get(cn);
+ if(to_cast != null)
+ {
+ Collection<Object> cln = (Collection<Object>)to_cast;
+
+ for(CondNode nd: fixed_cnds)
+ {
+ if(cln.contains(nd)){
+ skip = true;
+ break;
+ }
+ }
+ }
+ if(skip){
+ continue;
+ }
+
+ if(!fixed_cnds.contains(cn)){
+ List<CondNode> nodes = new LinkedList<CondNode>(fixed_cnds);
+ nodes.add(cn);
+
+ boolean to_return = combine_conditions_aux(nodes, still_to_fix-1);
+ if(to_return){
+ return true;
+ }
+ }
+ }
+ }else{
+ for(CondNode compare: this.condition_nodes.values()){
+
+ if(fixed_cnds.contains(compare)){
+ continue;
+ }
+
+ Object to_cast = opp_effect_same_task.get(compare);
+ if(!(to_cast == null)){
+ Collection<Object> cln = (Collection<Object>)to_cast;
+
+ if(!cln.containsAll(fixed_cnds)){
+ continue;
+ }
+ }
+
+ List<EffectLink> combined_effects = new LinkedList<EffectLink>();
+
+ for(CondNode cn: fixed_cnds){
+ combined_effects.addAll(cn.getAffectedBy());
+ }
+
+ //if all links in combined_effects are the same as links in compare.getaff
+
+ List<EffectLink> compare_effects = compare.getAffectedBy();
+
+
+ if(equivalent_sets(combined_effects, compare_effects)){
+
+ replaced = compare;
+ replacers = fixed_cnds;
+ neg_combine = false;
+ return true;
+ }
+ else if(opposite_sets(combined_effects, compare_effects)){
+
+ replaced = compare;
+ replacers = fixed_cnds;
+ neg_combine = true;
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private List<CondNode> replacers;
+ private CondNode replaced;
+ private boolean neg_combine;
+
+ private boolean equivalent_sets(List<EffectLink> set1p, List<EffectLink> set2p){
+
+ List<EffectLink> set1 = new LinkedList<EffectLink>(set1p);
+ List<EffectLink> set2 = new LinkedList<EffectLink>(set2p);
+
+ for(EffectLink ln: set1){
+
+ boolean found_equiv = false;
+ for(EffectLink chk: set2){
+ if(chk.sameSource(ln)){
+ found_equiv = true;
+ break;
+ }
+ }
+
+ if(!found_equiv){
+ return false;
+ }
+
+ }
+
+ for(EffectLink ln: set2){
+
+ boolean found_equiv = false;
+ for(EffectLink chk: set1){
+ if(chk.sameSource(ln)){
+ found_equiv = true;
+ break;
+ }
+ }
+
+ if(!found_equiv){
+ return false;
+ }
+
+ }
+
+ return true;
+ }
+
+ private boolean opposite_sets(List<EffectLink> set1p, List<EffectLink> set2p){
+
+ List<EffectLink> set1 = new LinkedList<EffectLink>(set1p);
+ List<EffectLink> set2 = new LinkedList<EffectLink>(set2p);
+
+
+ for(EffectLink ln: set1){
+
+ boolean found_equiv = false;
+ for(EffectLink chk: set2){
+ if(chk.oppositeSource(ln)){
+ found_equiv = true;
+ break;
+ }
+ }
+
+ if(!found_equiv){
+ return false;
+ }
+ }
+
+ for(EffectLink ln: set2){
+
+ boolean found_equiv = false;
+ for(EffectLink chk: set1){
+ if(chk.oppositeSource(ln)){
+ found_equiv = true;
+ break;
+ }
+ }
+
+ if(!found_equiv){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ //TODO make this work at an arbitrary depth
+ /**
+ * Returns true if tasks are eliminated
+ */
+ private boolean eliminate_dominated_tasks(){
+
+ long intv1 = new Date().getTime();
+
+ List<TaskNode> to_remove = new LinkedList<TaskNode>();
+
+ boolean keep_looking = true;
+ boolean removed_something = false;
+
+
+ //Find all "purely consumed" conditions
+
+
+ Set<CondNode> pos_only_consumed = new HashSet<CondNode>();
+ Set<CondNode> neg_only_consumed = new HashSet<CondNode>();
+
+ for(CondNode cnd: this.condition_nodes.values()){
+ //Check the positives
+
+ //If every positive precondition link has a corresponding negative
+ //effect from the same task
+
+ boolean unmatched_pos_precond = false;
+ boolean unmatched_neg_precond = false;
+
+ for(PrecondLink prl: cnd.getPreconditionTo()){
+
+ if(prl.getRequiredState()){
+ //If Positive
+
+ boolean found_neg_match = false;
+
+ for(EffectLink el: prl.action.get_negative_effect_links()){
+ if(el.effect == cnd){
+ found_neg_match = true;
+ break;
+ }
+ }
+
+ if(!found_neg_match){
+ unmatched_pos_precond = true;
+ }
+
+ }else{
+ //If negative
+
+ boolean found_pos_match = false;
+
+ for(EffectLink el: prl.action.get_positive_effect_links()){
+ if(el.effect == cnd){
+ found_pos_match = true;
+ break;
+ }
+ }
+
+ if(!found_pos_match){
+ unmatched_neg_precond = true;
+ }
+ }
+ }
+
+ if(!unmatched_neg_precond){
+ System.out.println("No unmatched neg "+cnd);
+ neg_only_consumed.add(cnd);
+ }
+
+ if(!unmatched_pos_precond){
+ System.out.println("No unmatched pos "+cnd);
+ pos_only_consumed.add(cnd);
+ }
+
+ //check the negatives
+
+ //If every negative precondition link has a corresponding positive
+ //effect from the same task
+ }
+
+ while(keep_looking){
+
+ for(TaskNode t: this.task_nodes.values()){
+
+
+ Map<CondNode, Boolean> preconditions = new LinkedHashMap<CondNode, Boolean>();
+ for(PrecondLink l: t.get_positive_precondition_links()){
+ preconditions.put(l.precondition, true);
+ }
+ for(PrecondLink l: t.get_negative_precondition_links()){
+ preconditions.put(l.precondition, false);
+ }
+
+ Map<CondNode, Boolean> useful_effects = new LinkedHashMap<CondNode, Boolean>();
+ for(EffectLink l: t.get_positive_effect_links()){
+ if(is_effect_useful(l)){
+ useful_effects.put(l.effect, true);
+ }
+ }
+
+ for(EffectLink l: t.get_negative_effect_links()){
+ if(is_effect_useful(l)){
+ useful_effects.put(l.effect, false);
+ }
+ }
+
+ Map<CondNode, Set<TaskNode>> cond_to_satisfiers = new LinkedHashMap<CondNode, Set<TaskNode>>();
+ Map<TaskNode, Map<CondNode, Boolean>> satisfiers_precond = new LinkedHashMap<TaskNode, Map<CondNode, Boolean>>();
+ Map<TaskNode, Map<CondNode, Boolean>> satisfiers_effects = new LinkedHashMap<TaskNode, Map<CondNode, Boolean>>();
+
+ List<CondNode> cond_list = new LinkedList<CondNode>();
+
+ for(CondNode c: preconditions.keySet()){
+ Set<TaskNode> satisfying = new HashSet<TaskNode>();
+ cond_to_satisfiers.put(c, satisfying);
+ for(EffectLink l: c.getAffectedBy()){
+
+ if(l.getWeight() == 1 && preconditions.get(c) == true ||
+ l.getWeight() == -1 && preconditions.get(c) == false){
+
+ satisfying.add(l.action);
+
+ Map<CondNode, Boolean> preconds_for_sat = new LinkedHashMap<CondNode, Boolean>();
+ for(PrecondLink pl: l.action.get_positive_precondition_links()){
+ preconds_for_sat.put(pl.precondition, true);
+ }
+ for(PrecondLink pl: l.action.get_negative_precondition_links()){
+ preconds_for_sat.put(pl.precondition, false);
+ }
+
+ satisfiers_precond.put(l.action, preconds_for_sat);
+
+ Map<CondNode, Boolean> effects_for_sat = new LinkedHashMap<CondNode, Boolean>();
+ for(EffectLink el: l.action.get_positive_effect_links()){
+ effects_for_sat.put(el.effect, true);
+ }
+
+ for(EffectLink el: l.action.get_negative_effect_links()){
+ effects_for_sat.put(el.effect, false);
+ }
+
+ satisfiers_effects.put(l.action, effects_for_sat);
+ }
+ }
+
+ cond_list.add(c);
+ }
+
+ // stored_sat_precond = null;
+ if(expand_satisfaction_combination(cond_list, cond_to_satisfiers, satisfiers_precond,
+ satisfiers_effects, new LinkedHashMap<CondNode, TaskNode>(), useful_effects)){
+
+ Map<CondNode, Boolean> all_sat_precond = new LinkedHashMap<CondNode, Boolean>();
+// for(CondNode cnd: stored_sat_precond.keySet()){
+// all_sat_precond.putAll(stored_sat_precond.get(cnd));
+// }
+ // for(CondNode cnd: all_sat_precond.keySet()){
+
+ // }
+
+ //Note! bah
+ boolean all_necessary_preconditions_extraneous = true;
+ for(CondNode cn: preconditions.keySet()){
+ if(!(all_sat_precond.containsKey(cn)&&all_sat_precond.get(cn)==preconditions.get(cn))){
+ for(PrecondLink pl: cn.getPreconditionTo()){
+ if(pl.getRequiredState() == preconditions.get(cn) &&
+ !(pl.getTaskID()== t.getNodeID())){
+ all_necessary_preconditions_extraneous = false;
+ }
+ }
+ }
+ }
+ //
+ if(all_necessary_preconditions_extraneous){
+
+ // to_remove.add(t);
+ }
+
+
+ Map<CondNode, Boolean> pruned_preconditions =
+ new LinkedHashMap<CondNode, Boolean>();
+
+ for(CondNode cnd: preconditions.keySet()){
+ if(!(all_sat_precond.containsKey(cnd)&&all_sat_precond.get(cnd)==preconditions.get(cnd))){
+ pruned_preconditions.put(cnd, preconditions.get(cnd));
+
+ }
+ }
+
+ boolean all_preconds_consumed = true;
+
+ for(CondNode cnd: pruned_preconditions.keySet()){
+ if(pruned_preconditions.get(cnd)){
+ if(!pos_only_consumed.contains(cnd)){
+ all_preconds_consumed = false;
+ }
+ }else{
+ if(!neg_only_consumed.contains(cnd)){
+ all_preconds_consumed = false;
+ }
+ }
+ }
+
+ if(all_preconds_consumed){
+
+ to_remove.add(t);
+ }
+
+ // for(EffectLink l: t.get_positive_effect_links()){
+ // if(!this.is_effect_useful(l)){
+ //
+ // }
+ // }
+ //
+ // for(EffectLink l: t.get_negative_effect_links()){
+ // if(!this.is_effect_useful(l)){
+ //
+ // }
+ // }
+
+ //Now know that this task leaves the environment the same
+ //as sometime before. Now we prune it if it invalidates a condition that has to stay true
+
+ // for(CondNode cn: useful_effects.keySet()){
+ // for(PrecondLink l: cn.getPreconditionTo()){
+ // if(l.required_state == useful_effects.get(cn)){
+ //
+ // num_clinks++;
+ // }
+ // }
+ // }
+
+ // for(EffectLink el: t.get_effect_links()){
+ // if(this.goal_states.containsKey(el.effect.getName()) &&
+ // this.goal_states.get(el.effect.getName()) != (el.getWeight()==1)){
+ // to_remove.add(t);
+ // }
+ // }
+
+ // if(num_clinks < 2){
+ //
+ // }
+ }
+
+ }
+
+ for(TaskNode tn: to_remove){
+ destroy_task(tn);
+ }
+
+
+
+ keep_looking = !to_remove.isEmpty();
+ removed_something = removed_something||keep_looking;
+
+ to_remove.clear();
+
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Removing useless tasks: "+(intv2-intv1)+" ms");
+
+ return removed_something;
+
+ //0. for every task:
+ //1. Get all preconditions of task
+ //Map<CondNode, boolean> preconditions
+ //1' Get all useful effects of task
+ //Map<CondNode, boolean> task_effects
+ //2. For each precondition, get all tasks that satisfy that precondition
+ //Map<CondNode, Set<TaskNode>> cond_to_satisfiers
+ //3. For each task that satisfies precondition, get preconditions
+ //Map<TaskNode, Set<CondNode>> satisfiers_precond
+ //4. For every combination of 1 task for each entry in cond_to_satisfiers
+ //get the whole collection of those tasks' preconditions from
+ //satisfiers_precond
+ //remove from the collection the negated effects of the tasks in the
+ //combination
+ //If for every combination, all entries in task_effects are in the collection,
+ //the task is useless. Delete task, move to next.
+ //5. If previous step didn't terminate, repeat 2 on the new collection until search is
+ //as deep as desired
+ //Note: to do it deeper, we would need to keep track of what task each condition
+ //is for
+
+ }
+
+// Map<CondNode, Map<CondNode, Boolean>> stored_sat_precond;
+
+ private boolean expand_satisfaction_combination(
+ List<CondNode> not_satisfied,
+ Map<CondNode, Set<TaskNode>> cond_to_satisfiers,
+ Map<TaskNode, Map<CondNode, Boolean>> satisfiers_precond,
+ Map<TaskNode, Map<CondNode, Boolean>> satisfiers_effects,
+ Map<CondNode, TaskNode> added,
+ Map<CondNode, Boolean> act_effects
+ ){
+
+ if(!not_satisfied.isEmpty()){
+
+ CondNode sat_cond = not_satisfied.get(0);
+
+ for(TaskNode tn: cond_to_satisfiers.get(sat_cond)){
+
+
+ List<CondNode> new_to_sat = new LinkedList<CondNode>(not_satisfied);
+ new_to_sat.remove(sat_cond);
+
+ Map<CondNode, TaskNode> fixed_tasks = new LinkedHashMap<CondNode, TaskNode>(added);
+ fixed_tasks.put(sat_cond, tn);
+
+ boolean toret = expand_satisfaction_combination(
+ new_to_sat,
+ cond_to_satisfiers,
+ satisfiers_precond,
+ satisfiers_effects,
+ fixed_tasks,
+ act_effects
+ );
+
+ if(!toret){
+ return false;
+ }
+
+ }
+ return true;
+
+ }else{
+
+
+ //0. Make this map new so we can modify it
+
+ Map<TaskNode, Map<CondNode, Boolean>> satisfiers_precond_local = new LinkedHashMap<TaskNode, Map<CondNode, Boolean>>();
+
+ for(TaskNode tnd: satisfiers_precond.keySet()){
+ satisfiers_precond_local.put(tnd, new LinkedHashMap<CondNode, Boolean>(satisfiers_precond.get(tnd)));
+ }
+
+ //1. Build the map of effects
+ Map<CondNode, Map<CondNode, Boolean>> all_sat_effects = new LinkedHashMap<CondNode, Map<CondNode, Boolean>>();
+ for(CondNode cnd: added.keySet()){
+ Map<CondNode, Boolean> to_add = satisfiers_effects.get(added.get(cnd));
+ all_sat_effects.put(cnd, to_add);
+ }
+
+
+ //2. Get rid of preconditions which must be different different places
+
+ //a. detect them
+
+ List<CondNode> to_purge_from_known_preconditions = new LinkedList<CondNode>();
+
+ for(CondNode root_cond1: added.keySet()){
+ for(CondNode precond1: satisfiers_precond_local.get(added.get(root_cond1)).keySet()){
+ for(CondNode root_cond2: added.keySet()){
+ for(CondNode precond2: satisfiers_precond_local.get(added.get(root_cond2)).keySet()){
+ if((precond1 == precond2) &&
+ (satisfiers_precond_local.get(added.get(root_cond1)).get(precond1) !=
+ satisfiers_precond_local.get(added.get(root_cond2)).get(precond2))){
+ to_purge_from_known_preconditions.add(precond1);
+ }
+ }
+ }
+ }
+ }
+
+ //b. erase them
+
+ for(CondNode cnd: to_purge_from_known_preconditions){
+ for(TaskNode tnd: satisfiers_precond_local.keySet()){
+ satisfiers_precond_local.remove(cnd);
+ }
+ }
+
+ //3. Build the map of precondition to conditions needed for it, but for each check
+ //to see that it is nowhere in the map of effects except under the same key
+
+ Map<CondNode, Map<CondNode, Boolean>> all_sat_precond = new LinkedHashMap<CondNode, Map<CondNode, Boolean>>();
+
+ for(CondNode root_cond: added.keySet()){
+ all_sat_precond.put(root_cond, new LinkedHashMap<CondNode, Boolean>());
+
+ //Find the preconditions of the task that satisfys that cond
+ for(CondNode precond: satisfiers_precond_local.get(added.get(root_cond)).keySet()){
+
+ boolean opp_found_in_effects = false;
+ //Check to see if it is in the effects map
+
+ out:
+ for(CondNode effect_root: all_sat_effects.keySet()){
+
+ if(added.get(effect_root) == added.get(root_cond)){
+ continue;
+ }
+
+ for(CondNode effect_eff: all_sat_effects.get(effect_root).keySet()){
+ if((precond == effect_eff) &&
+ (satisfiers_precond_local.get(added.get(root_cond)).get(precond)!=
+ all_sat_effects.get(effect_root).get(effect_eff))){
+ opp_found_in_effects = true;
+ break out;
+ }
+ }
+ }
+
+ if(!opp_found_in_effects){
+ all_sat_precond.get(root_cond).put(precond,
+ satisfiers_precond_local.get(added.get(root_cond)).get(precond));
+ }else{
+
+ }
+
+ }
+ }
+
+
+ //TODO set it null after every time through
+
+// if(stored_sat_precond == null){
+// stored_sat_precond = new LinkedHashMap<CondNode, Map<CondNode, Boolean>>();
+//
+// for(CondNode cnd: added.keySet()){
+// stored_sat_precond.put(cnd, new LinkedHashMap<CondNode, Boolean>(satisfiers_precond.get(added.get(cnd))));
+// }
+// }
+// else{
+// //Want to have stored_sat_precond.get(each precond) retain only the values
+// //in satisfiers_precond for that precondition
+//
+//
+//
+// //For every precondition
+// for(CondNode cond: added.keySet()){
+// List<CondNode> to_remove = new LinkedList<CondNode>();
+// Map<CondNode, Boolean> tmp = stored_sat_precond.get(cond);
+//
+// //For every value in stored_sat_precond of that precond
+// for(CondNode cnd: tmp.keySet()){
+//
+// //If satisfiers_precond doesn't have it, remove it
+// if(!satisfiers_precond.get(added.get(cond)).containsKey(cnd) ||
+// !(satisfiers_precond.get(added.get(cond)).get(cnd) == tmp.get(cnd))){
+// to_remove.add(cnd);
+// }
+// }
+// for(CondNode cnd: to_remove){
+// tmp.remove(cnd);
+// }
+// }
+// }
+
+
+// for(TaskNode t: satisfiers_precond.keySet()){
+
+// Map<CondNode, Boolean> tmp = stored_sat_precond.get(added.get(t));
+// List<CondNode> to_remove = new LinkedList<CondNode>();
+// for(CondNode cnd: tmp.keySet()){
+// if(!satisfiers_precond.get(t).containsKey(cnd) ||
+// !(satisfiers_precond.get(t).get(cnd) == tmp.get(cnd))){
+// to_remove.add(cnd);
+// }
+// }
+//
+// for(CondNode cnd: to_remove){
+// tmp.remove(cnd);
+// }
+//
+// }
+
+
+// }
+
+
+
+
+ //If all preconditions in the sat_preconditions, continue
+ //If any are not in it, return false
+
+
+ for(CondNode cnd: act_effects.keySet()){
+ for(CondNode cnd2: all_sat_precond.keySet()){
+ if(all_sat_precond.get(cnd2).containsKey(cnd)){
+ if(all_sat_precond.get(cnd2).get(cnd).booleanValue() !=
+ act_effects.get(cnd).booleanValue()){
+
+ return false;
+ }
+
+ }else{
+
+ return false;
+ }
+ }
+ }
+
+
+ return true;
+ }
+ }
+
+ private boolean is_effect_useful(EffectLink c){
+
+ double effect_value = c.getWeight();
+ CondNode cnd = c.effect;
+
+ if(this.goal_states.containsKey(c.effect.getName()) && this.goal_states.get(c.effect.getName()) == (c.getWeight()==1))
+ return true;
+
+ for(PrecondLink l: cnd.getPreconditionTo()){
+ if(l.required_state == true && effect_value > 0 ||
+ l.required_state == false && effect_value < 0){
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void setup_initial_action(TaskNode initial_action){
+
+ task_nodes.put("initact", initial_action);
+
+ for(CondNode c: condition_nodes.values()){
+ initial_action.attach_effect(c, (c.getProbability()-.5)*2);
+ }
+
+ effect_links.addAll(initial_action.get_positive_effect_links());
+ effect_links.addAll(initial_action.get_negative_effect_links());
+
+ this.task_to_resources.put(initial_action, new LinkedList<String>());
+ }
+
+ private boolean eliminate_irreleevant_tasks_and_conditions(){
+
+ long intv1 = new Date().getTime();
+
+ for(TaskNode t: this.task_nodes.values()){
+ t.get_positive_effect_links().clear();
+ t.get_negative_effect_links().clear();
+ }
+
+ for(CondNode con: this.condition_nodes.values()){
+ con.getPreconditionTo().clear();
+ }
+
+ ExpansionDataSet d = new ExpansionDataSet();
+
+
+ for(String s: goal_states.keySet()){
+ expand_relevant_condition(this.goal_states.get(s), this.condition_nodes.get(s), d);
+ }
+
+ Set<String> all_conds = new HashSet<String>(d.pos_condition_nodes.keySet());
+ all_conds.addAll(d.neg_condition_nodes.keySet());
+
+ boolean return_value = (condition_nodes.size() != all_conds.size());
+
+ condition_nodes = new LinkedHashMap<String, CondNode>();
+ condition_nodes.putAll(d.pos_condition_nodes);
+ condition_nodes.putAll(d.neg_condition_nodes);
+
+ return_value = return_value||(task_nodes.size() != d.task_nodes.size());
+
+ task_nodes = d.task_nodes;
+ precondition_links = d.relevant_preconditions;
+ effect_links = d.relevant_effects;
+
+ long intv2 = new Date().getTime();
+ System.out.println("Pruned irrelevant tasks and conditions: "+(intv2-intv1)+" ms");
+
+
+ return return_value;
+ }
+
+ class SplitChangePair{
+
+ Exp split_partial_exp;
+ Exp additions_to_other_exp;
+ }
+
+ class ExpansionDataSet{
+
+ Map<String, CondNode> pos_condition_nodes = new LinkedHashMap<String, CondNode>();
+ Map<String, CondNode> neg_condition_nodes = new LinkedHashMap<String, CondNode>();
+
+ Map<String, TaskNode> task_nodes= new LinkedHashMap<String, TaskNode>();
+
+ List<PrecondLink> relevant_preconditions = new LinkedList<PrecondLink>();
+ List<EffectLink> relevant_effects = new LinkedList<EffectLink>();
+ }
+
+ private void expand_relevant_condition(boolean val, CondNode cond, ExpansionDataSet d){
+
+ if(val){
+ if(d.pos_condition_nodes.containsValue(cond)){
+ return;
+ }
+ d.pos_condition_nodes.put(cond.getName(), cond);
+ }else{
+ if(d.neg_condition_nodes.containsValue(cond)){
+ return;
+ }
+ d.neg_condition_nodes.put(cond.getName(), cond);
+ }
+
+
+ for(EffectLink l: cond.getAffectedBy()){
+ if(val && l.getWeight() == 1){
+ l.action.get_positive_effect_links().add(l);
+ d.relevant_effects.add(l);
+ expand_relevant_task(l.action, d);
+ }else if (l.getWeight() == -1){
+ l.action.get_negative_effect_links().add(l);
+ d.relevant_effects.add(l);
+ expand_relevant_task(l.action, d);
+ }
+ }
+ }
+
+ private void expand_relevant_task(TaskNode t, ExpansionDataSet d){
+
+ if(d.task_nodes.containsValue(t)){
+ return;
+ }
+
+ d.task_nodes.put(t.getName(), t);
+
+ for(PrecondLink l: t.get_positive_precondition_links()){
+
+ l.precondition.getPreconditionTo().add(l);
+ d.relevant_preconditions.add(l);
+ expand_relevant_condition(true, l.precondition, d);
+ }
+
+ for(PrecondLink l: t.get_negative_precondition_links()){
+
+ l.precondition.getPreconditionTo().add(l);
+ d.relevant_preconditions.add(l);
+ expand_relevant_condition(false, l.precondition, d);
+ }
+ }
+
+ private boolean eliminate_impossible_tasks(){
+
+ long intv1 = new Date().getTime();
+
+ List<CondNode> new_values = new LinkedList<CondNode>(condition_nodes.values());
+
+ boolean removed_something;
+ boolean ever_removed_something = false;
+
+ do{
+
+ removed_something = false;
+
+ for(CondNode c_node: new_values){
+ if(condition_nodes.values().contains(c_node)){
+ removed_something = propagate_impossible_condition(c_node)||removed_something;
+ }
+ }
+
+ ever_removed_something = ever_removed_something||removed_something;
+
+ }while(removed_something);
+
+ long intv2 = new Date().getTime();
+ System.out.println("Eliminated impossible tasks: "+(intv2-intv1)+" ms");
+
+ return ever_removed_something;
+ }
+
+ private void destroy_task(TaskNode t){
+
+ for(PrecondLink l:t.get_positive_precondition_links()){
+ this.precondition_links.remove(l);
+ }
+
+ for(PrecondLink l:t.get_negative_precondition_links()){
+ this.precondition_links.remove(l);
+ }
+
+ for(EffectLink l:t.get_positive_effect_links()){
+ this.effect_links.remove(l);
+ }
+
+ for(EffectLink l:t.get_negative_effect_links()){
+ this.effect_links.remove(l);
+ }
+
+ t.destroy();
+
+ task_nodes.remove(t.getName());
+ }
+
+ private void destroy_condition(CondNode c){
+
+ for(PrecondLink l:c.getPreconditionTo()){
+ this.precondition_links.remove(l);
+ }
+
+ for(EffectLink l:c.getAffectedBy()){
+ this.effect_links.remove(l);
+ }
+
+
+ c.destroy();
+
+ condition_nodes.remove(c.getName());
+ }
+
+ private boolean propagate_impossible_condition(CondNode c_node){
+
+ boolean isTurnedFalse = false;
+ boolean isTurnedTrue = false;
+
+ boolean removed_something = false;
+
+ List<EffectLink> new_affected = new LinkedList<EffectLink>(c_node.getAffectedBy());
+
+ for(EffectLink e: new_affected){
+
+ if(c_node.getAffectedBy().contains(e)){
+ if(e.getWeight() > 0){
+ isTurnedTrue = true;
+ }else if(e.getWeight() < 0){
+ isTurnedFalse = true;
+ }
+ }
+ }
+
+ boolean condition_state = false;
+
+ if(!isTurnedTrue && c_node.getProbability() == 0){
+ condition_state = true;
+ }
+
+ if((!isTurnedTrue && c_node.getProbability() == 0)||(!isTurnedFalse && c_node.getProbability() == 1)){
+ List<PrecondLink> new_preconditions = new LinkedList<PrecondLink>(c_node.getPreconditionTo());
+
+ //There are actions, but they don't do anything, so get rid of them
+ for(EffectLink eff: c_node.getAffectedBy()){
+ if(eff.getWeight() > 0){
+ eff.action.get_positive_effect_links().remove(eff);
+ }else{
+ eff.action.get_negative_effect_links().remove(eff);
+ }
+ }
+
+ removed_something = true;
+ destroy_condition(c_node);
+ for(PrecondLink pre_link: new_preconditions){
+ if(c_node.getPreconditionTo().contains(pre_link)
+ && (condition_state == pre_link.required_state)){
+
+ TaskNode t = pre_link.action;
+ destroy_task(t);
+
+ List<EffectLink> new_effects = new LinkedList<EffectLink>();
+ new_effects.addAll(t.get_positive_effect_links());
+ new_effects.addAll(t.get_negative_effect_links());
+
+// for(EffectLink l: new_effects){
+// if(
+// ((l.getWeight() > 0 && t.get_positive_effect_links().contains(l))
+// ||(l.getWeight() < 0 &&t.get_negative_effect_links().contains(l))) &&
+// condition_nodes.containsValue(l.effect)){
+// propagate_impossible_condition(l.effect);
+// }
+// }
+ }else if (c_node.getPreconditionTo().contains(pre_link)){
+ if(pre_link.getRequiredState()){
+ pre_link.action.get_positive_precondition_links().remove(pre_link);
+ }else{
+ pre_link.action.get_negative_precondition_links().remove(pre_link);
+ }
+
+ }
+ }
+ }
+
+ return removed_something;
+ }
+
+
+ private void set_probabilities(){
+ for(TaskNode t: task_nodes.values()){
+ t.set_precondition_probabilities();
+ }
+ }
+
+ private boolean are_probabilistics_translatable(List<Action> action_list){
+
+ for(Action a: action_list){
+
+ Exp e = a.getEffect();
+
+ if(are_dependent_prob_terms(e) || are_conjunctive_prob_terms(e)){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean are_dependent_prob_terms(Exp e){
+
+ switch(e.getExpID()){
+ case AND:{
+ AndExp and_exp = (AndExp)e;
+ Iterator<Exp> children = and_exp.iterator();
+ while(children.hasNext()){
+ Exp child = children.next();
+ boolean result = are_dependent_prob_terms(child);
+ if(result){
+ return true;
+ }
+ }
+ return false;
+ }
+ case PROB_EXP:{
+ ProbExp prob_exp = (ProbExp)e;
+ if(prob_exp.size() > 1){
+ return true;
+ }
+
+ Iterator<Exp> children = prob_exp.iterator();
+ while(children.hasNext()){
+ Exp child = children.next();
+ boolean result = are_dependent_prob_terms(child);
+ if(result){
+ return true;
+ }
+ }
+
+ return false;
+
+ }case ATOMIC_FORMULA:{
+ return false;
+ }case NOT:{
+ return are_dependent_prob_terms(((NotExp)e).getExp());
+ } default:{
+ System.out.println("Error: term "+e+" not recognized here");
+ System.exit(0);
+ return true;
+ }
+ }
+
+ }
+
+ private boolean are_conjunctive_prob_terms(Exp e){
+ switch(e.getExpID()){
+ case AND:{
+ AndExp and_exp = (AndExp)e;
+ Iterator<Exp> children = and_exp.iterator();
+ while(children.hasNext()){
+ Exp child = children.next();
+ boolean result = are_conjunctive_prob_terms(child);
+ if(result){
+ return true;
+ }
+ }
+ return false;
+ }
+ case PROB_EXP:{
+ ProbExp prob_exp = (ProbExp)e;
+
+
+ Iterator<Exp> children = prob_exp.iterator();
+ while(children.hasNext()){
+ Exp child = children.next();
+
+ if(child.getExpID() == ExpID.AND){
+ return true;
+ }
+
+ boolean result = are_conjunctive_prob_terms(child);
+ if(result){
+ return true;
+ }
+ }
+
+ return false;
+
+ }case ATOMIC_FORMULA:{
+ return false;
+ }case NOT:{
+ return are_conjunctive_prob_terms(((NotExp)e).getExp());
+ } default:{
+ System.out.println("Error: term "+e+" not recognized here");
+ System.exit(0);
+ return true;
+ }
+ }
+ }
+
+ private void enumerate_actions(List<ActionData> action_data){
+
+ long intv1 = new Date().getTime();
+
+ for(ActionData a: action_data){
+ actionEnumerationAux(a);
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Enumerated actions: "+(intv2-intv1)+" ms");
+ }
+
+ private List<ActionData> parse_equality_constraints(List<Action> action_list){
+
+ long intv1 = new Date().getTime();
+
+ List<ActionData> action_data = new LinkedList<ActionData>();
+
+ Map<Variable, Variable> variable_equal_variable_list = new LinkedHashMap<Variable, Variable>();
+ Map<Variable, Variable> variable_not_equal_variable_list = new LinkedHashMap<Variable, Variable>();
+ Map<Variable, Constant> variable_equal_constant_list = new LinkedHashMap<Variable, Constant>();
+ Map<Variable, Constant> variable_not_equal_constant_list = new LinkedHashMap<Variable, Constant>();
+
+
+ Iterator<Action> action_iterator = action_list.iterator();
+ List<Action> new_actions = new LinkedList<Action>();
+
+ //TODO tentatively agree that this works because everything is and. When forall and exists
+ //are implemented, take another look
+ while(action_iterator.hasNext()){
+
+ variable_equal_variable_list.clear();
+ variable_not_equal_variable_list.clear();
+ variable_equal_constant_list.clear();
+ variable_not_equal_constant_list.clear();
+
+ Action current_action = action_iterator.next();
+ ActionData this_action_data = new ActionData(current_action, typeset_to_constant);
+ new_actions.add(current_action);
+
+ action_data.add(this_action_data);
+
+ List<Term> all_variables = current_action.getParameters();
+
+ for(Term t: all_variables){
+ if(t instanceof Variable){
+ this_action_data.add_free_variable((Variable)t);
+ }
+ }
+
+ AndExp tmp = new AndExp();
+ tmp.add(((Action)current_action).getPrecondition());
+ Iterator<Exp> precond_it = tmp.iterator();
+
+ AndExp new_precondition = tmp.clone();
+
+
+
+ while(precond_it.hasNext()){
+
+
+ Exp k = precond_it.next();
+
+ switch(k.getExpID()){
+ case ATOMIC_FORMULA:{
+ break;
+ }
+ case NOT:{
+
+ Exp internal = ((NotExp)k).getExp();
+
+ switch(internal.getExpID())
+ {
+ case F_COMP:{
+
+ EqualComp equal_exp = (EqualComp)internal;
+
+ Term arg1 = equal_exp.getArg1();
+ Term arg2 = equal_exp.getArg2();
+
+ boolean term1_var = (arg1 instanceof Variable);
+ boolean term2_var = (arg2 instanceof Variable);
+
+ if(term1_var && term2_var){
+ variable_not_equal_variable_list.put((Variable)arg1, (Variable)arg2);
+ new_precondition.remove(k);
+ }
+ else if(!term1_var && term2_var){
+ variable_not_equal_constant_list.put((Variable)arg2, (Constant)arg1);
+ new_precondition.remove(k);
+ }
+ else if(term1_var && !term2_var){
+ variable_not_equal_constant_list.put((Variable)arg1, (Constant)arg2);
+ new_precondition.remove(k);
+ }
+ else{
+ if(arg1.equals(arg2)){
+
+ new_actions.remove(current_action);
+ break;
+
+ }else{
+ new_precondition.remove(k);
+
+ }
+ new_precondition.remove(k);
+ }
+
+ break;
+ }default:{
+ break;
+ }
+ }
+ break;
+ }
+ case F_COMP:{
+ EqualComp equal_exp = (EqualComp)k;
+
+ Term arg1 = equal_exp.getArg1();
+ Term arg2 = equal_exp.getArg2();
+
+ boolean term1_var = (arg1 instanceof Variable);
+ boolean term2_var = (arg2 instanceof Variable);
+
+
+ if(term1_var && term2_var){
+ variable_equal_variable_list.put((Variable)arg1, (Variable)arg2);
+ new_precondition.remove(k);
+ }
+ else if(!term1_var && term2_var){
+ variable_equal_constant_list.put((Variable)arg2, (Constant)arg1);
+ new_precondition.remove(k);
+ }
+ else if(term1_var && !term2_var){
+ variable_equal_constant_list.put((Variable)arg1, (Constant)arg1);
+ new_precondition.remove(k);
+ }
+ else{
+ if(arg1.equals(arg2)){
+ new_precondition.remove(k);
+ }else{
+ new_actions.remove(current_action);
+ break;
+ }
+ new_precondition.remove(k);
+ }
+
+ break;
+
+ }default:{
+ System.out.println("Error: term "+k+" not recognized here");
+ break;
+ }
+
+ }
+ }
+
+ current_action.setPrecondition(new_precondition);
+
+ for(Variable t: variable_not_equal_variable_list.keySet()){
+ this_action_data.fix_variable_not_equal_variable(t, variable_not_equal_variable_list.get(t));
+ }
+ for(Variable t: variable_equal_variable_list.keySet()){
+ this_action_data.fix_variable_to_variable(t, variable_equal_variable_list.get(t));
+ }
+ for(Variable t: variable_not_equal_constant_list.keySet()){
+ this_action_data.fix_variable_not_equal_constant(t, variable_not_equal_constant_list.get(t));
+ }
+ for(Variable t: variable_equal_constant_list.keySet()){
+ this_action_data.fix_variable_to_constant(t,variable_equal_constant_list.get(t));
+ }
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Parsed equalities: "+(intv2-intv1)+" ms");
+
+ return action_data;
+ }
+
+ private List<Action> convert_preconditions_to_prenex(List<Action> action_list){
+
+ long intv1 = new Date().getTime();
+
+ List<Action> new_actions = new LinkedList<Action>();
+
+ for(Action a: action_list){
+
+ Action a2 = a.clone();
+ a2.setPrecondition(a2.getPrecondition().toNegativeNormalForm());
+ new_actions.add(a2);
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Normalized: "+(intv2 - intv1)+" ms");
+
+ return new_actions;
+ }
+
+ private List<Action> remove_conditionals(List<Action> action_list){
+
+ long intv1 = new Date().getTime();
+
+ boolean still_conditionals = true;
+ while(still_conditionals){
+ still_conditionals = false;
+ List<Action> new_actions = new LinkedList<Action>();
+
+ for(Action a: action_list){
+
+ List<SplitChangePair> changes = split_when_conditions(a.getEffect());
+
+ if(changes.isEmpty()){
+ new_actions.add(a);
+ }
+
+ int i = 0;
+ for(SplitChangePair p: changes){
+
+ Action newAct = a.clone();
+ newAct.setName(newAct.getName()+((i++==0)?"+":"-"));
+ newAct.setEffect(p.split_partial_exp);
+ AndExp newPrecondition = new AndExp();
+ newPrecondition.add(a.getPrecondition().clone());
+ newPrecondition.add(p.additions_to_other_exp);
+ newAct.setPrecondition(newPrecondition);
+ new_actions.add(newAct);
+
+ still_conditionals = true;
+ }
+ }
+
+ action_list = new_actions;
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Removed conditionals: "+(intv2-intv1)+" ms");
+
+ return action_list;
+
+ }
+
+ private List<Action> remove_precondition_disjunctions(List<Action> action_list){
+ //TODO I'm not convinced that the toDisjunctive stuff necessarily gets rid of every or expression
+ //Check if this is true, and if it's not, do the disjunction cleaner
+
+ long intv1 = new Date().getTime();
+
+ List<Action> actions_after_disjunctions = new LinkedList<Action>();
+
+ for(Action a: action_list){
+
+ Exp act_preconditions = ((Action)a).getPrecondition();
+ OrExp act_preconditions_disj = (OrExp)act_preconditions.toDisjunctiveNormalForm();
+ Iterator<Exp> terms_it = act_preconditions_disj.iterator();
+
+ int i = 0;
+ while(terms_it.hasNext()){
+
+ Exp new_act_preconditions = terms_it.next();
+ Action new_action = ((Action)a).clone();
+ new_action.setPrecondition(new_act_preconditions);
+ new_action.setName(a.getName()+"["+(i++)+"]");
+ actions_after_disjunctions.add(new_action);
+ }
+ }
+
+
+ long intv2 = new Date().getTime();
+ System.out.println("Removed disjunctions: "+(intv2-intv1)+" ms");
+
+ return actions_after_disjunctions;
+
+ }
+
+ private List<Action> get_all_actions(PDDLObject obj){
+
+ List<Action> actions_list = new LinkedList<Action>();
+ Iterator<ActionDef> action_def_it = obj.actionsIterator();
+
+ while(action_def_it.hasNext()){
+
+ ActionDef d = action_def_it.next();
+ actions_list.add(((Action)d).clone());
+ }
+
+ return actions_list;
+ }
+
+ private void set_initial_propositions(PDDLObject obj){
+ for(InitEl e: obj.getInit()){
+ CondNode n = condition_nodes.get(e.toString());
+ n.setProbability(1);
+ }
+ }
+
+ private void enumerate_propositions_default(PDDLObject obj){
+
+ long intv1 = new Date().getTime();
+
+ Iterator<AtomicFormula> atom_it = obj.predicatesIterator();
+
+ //First enumerate all propositions--all set to false
+ while(atom_it.hasNext()){
+
+ AtomicFormula form = atom_it.next();
+ List<Variable> variables = new LinkedList<Variable>(form.getFreeVariables());
+ propositionEnumerationAux(form, variables, variables, new Substitution());
+ }
+
+ long intv2 = new Date().getTime();
+ System.out.println("Enumerated conditions: "+(intv2-intv1)+" ms");
+ }
+
+ private void get_goals(PDDLObject obj){
+
+ Exp goals = obj.getGoal();
+ Iterator<Exp> goal_it = ((AndExp)goals.toConjunctiveNormalForm()).iterator();
+
+ while(goal_it.hasNext()){
+
+ Exp current = goal_it.next();
+
+ String seek_string = null;
+
+ switch(current.getExpID())
+ {
+ case NOT:
+ {
+ seek_string = (((NotExp)current).getExp().toString());
+ goal_states.put(seek_string, false);
+ break;
+
+ }
+ default: {
+
+ seek_string = (current.toString());
+ goal_states.put(seek_string, true);
+ }
+ }
+ }
+ }
+
+ private void record_constants(PDDLObject obj){
+
+ Iterator<Constant> const_it = obj.constantsIterator();
+
+
+ //Keep track of what type each constant is, to save pain later
+ while(const_it.hasNext()){
+ Constant c = const_it.next();
+
+ TypeSet type = c.getTypeSet();
+
+ Set<Type> all_types = new HashSet<Type>();
+ Iterator<Type> type_it = type.iterator();
+ while(type_it.hasNext()){
+ Type typ = type_it.next();
+ all_types.add(typ);
+ all_types.addAll(typ.getAllSuperTypes());
+ }
+
+ for(Type typ: all_types){
+
+ if(typeset_to_constant.get(typ) == null){
+ typeset_to_constant.put(typ, new LinkedList<Constant>());
+
+ }
+
+ typeset_to_constant.get(typ).add(c);
+ }
+
+ resources.put(c.toTypedString(), new Resource(c.toString(), "DISCRETE", "1"));
+
+ }
+ }
+
+ /**
+ * Finds all conditions in effects and splits them into separate actions.
+ *
+ * else false
+ */
+
+ //TODO when forall and exists are implemented, see if this is still valid.
+
+ private List<SplitChangePair> split_when_conditions(Exp e){
+
+ switch(e.getExpID()){
+
+ case AND:{
+
+ AndExp exp = (AndExp)e.clone();
+ Iterator<Exp> exp_it = exp.iterator();
+
+ while(exp_it.hasNext()){
+
+ Exp search = exp_it.next();
+ List<SplitChangePair> returned = split_when_conditions(search);
+
+ if(!returned.isEmpty()){
+
+ for(SplitChangePair p: returned){
+
+ AndExp copy = exp.clone();
+ copy.remove(search);
+ copy.add(p.split_partial_exp);
+ p.split_partial_exp = copy;
+ }
+ return returned;
+ }
+ }
+
+ //Nothing new to add, return nothing
+ return new LinkedList<SplitChangePair>();
+
+ }case ATOMIC_FORMULA:{
+
+ return new LinkedList<SplitChangePair>();
+
+ }case NOT:{
+
+ NotExp exp = (NotExp)e;
+ Exp inner = exp.getExp();
+ List<SplitChangePair> returned = split_when_conditions(inner);
+
+ if(!returned.isEmpty()){
+
+ for(SplitChangePair p: returned){
+
+ NotExp copy = exp.clone();
+ copy.setExp(p.split_partial_exp);
+ p.split_partial_exp = copy;
+ }
+
+ return returned;
+ }
+
+ return new LinkedList<SplitChangePair>();
+
+ }case WHEN:{
+
+ WhenExp when = (WhenExp)e;
+
+ Exp condition = when.getCondition();
+ Exp effect = when.getEffect();
+
+ List<SplitChangePair> changes = new LinkedList<SplitChangePair>();
+
+ SplitChangePair positive = new SplitChangePair();
+ positive.additions_to_other_exp = condition;
+ positive.split_partial_exp = effect;
+
+ SplitChangePair negative = new SplitChangePair();
+ negative.additions_to_other_exp = new NotExp(condition);
+ negative.split_partial_exp = new AndExp();
+
+ changes.add(positive);
+ changes.add(negative);
+
+ return changes;
+
+ }case PROB_EXP:{
+
+ ProbExp p = (ProbExp)e;
+
+ Iterator<Exp> exp_it = p.iterator();
+
+ while(exp_it.hasNext()){
+ Exp expr = exp_it.next();
+
+ List<SplitChangePair> returned = split_when_conditions(expr);
+
+ if(!returned.isEmpty()){
+
+ for(SplitChangePair pair: returned){
+
+ ProbExp new_exp = p.clone();
+ new_exp.removeExp(expr);
+ new_exp.addExp(pair.split_partial_exp, p.getProbability(expr));
+ pair.split_partial_exp = new_exp;
+
+ }
+
+ return returned;
+
+ }
+ }
+
+ return new LinkedList<SplitChangePair>();
+
+ }
+ }
+
+ System.out.println("Error: term "+e+" not recognized here");
+ System.exit(0);
+ return null;
+
+ }
+
+ private void actionEnumerationAux(ActionData dat){
+ if(dat.has_free_variable())
+ {
+ ActionData clone_dat = new ActionData(dat);
+ Variable to_fix = dat.get_first_free_variable();
+ for(Constant c: dat.get_possible_values(to_fix)){
+ clone_dat.temp_fix_variable_to_constant(to_fix, c);
+ actionEnumerationAux(clone_dat);
+ }
+
+ }else
+ {
+
+ String action_name = dat.get_action_name();
+ Exp preconditions = dat.get_precondition_expression();
+ Exp effects = dat.get_effect_expression();
+
+
+ Iterator<Exp> precond_it = ((AndExp)preconditions).iterator();
+ Iterator<Exp> effect_it = ((AndExp)effects).iterator();
+
+ TaskNode act = new TaskNode(action_name);
+
+
+ while(precond_it.hasNext()){
+
+ Exp k = precond_it.next();
+ String condition_seek = null;
+
+ switch(k.getExpID()){
+ case ATOMIC_FORMULA:{
+ condition_seek = (k.toString());
+ act.attach_precondition(condition_nodes.get(condition_seek),true);
+ break;
+ }case NOT:{
+ condition_seek = (((NotExp)k).getExp().toString());
+ act.attach_precondition(condition_nodes.get(condition_seek),false);
+ break;
+ }default:
+ {
+ System.out.println("Error: term "+k+" not recognized here");
+ System.exit(0);
+ break;
+ }
+ }
+ }
+
+ while(effect_it.hasNext()){
+
+ Exp k = effect_it.next();
+ String condition_seek = null;
+
+ switch(k.getExpID()){
+ case ATOMIC_FORMULA:{
+ condition_seek = (k.toString());
+ act.attach_effect(condition_nodes.get(condition_seek), 1);
+ break;
+ }case NOT:{
+ condition_seek = (((NotExp)k).getExp().toString());
+ act.attach_effect(condition_nodes.get(condition_seek), -1);
+ break;
+ }case PROB_EXP:{
+
+ ProbExp p = (ProbExp)k;
+ if(p.size() == 1){
+
+ Exp term = p.iterator().next();
+
+ switch(term.getExpID()){
+ case ATOMIC_FORMULA:{
+
+ condition_seek = (term.toString());
+ act.attach_effect(condition_nodes.get(condition_seek), p.getProbability(term));
+
+ break;
+ }
+ case NOT:{
+
+ condition_seek = ((NotExp)term).getExp().toString();
+ act.attach_effect(condition_nodes.get(condition_seek), -p.getProbability(term));
+
+ break;
+ }
+ default:{
+
+ System.out.println("Error: term "+term+" not recognized here");
+ System.exit(0);
+ }
+ }
+ }else if(p.size() == 0){
+ //meh
+ }
+ else{
+ System.out.println("Error: term "+k+" not recognized here");
+ System.exit(0);
+ }
+ break;
+ }default:{
+
+ System.out.println("Error: term "+k+" not recognized here");
+ System.exit(0);
+ break;
+ }
+ }
+ }
+
+
+ task_nodes.put(action_name, act);
+ task_to_resources.put(act, dat.get_all_substituted_parameters());
+ precondition_links.addAll(act.get_positive_precondition_links());
+ precondition_links.addAll(act.get_negative_precondition_links());
+
+ effect_links.addAll(act.get_positive_effect_links());
+ effect_links.addAll(act.get_negative_effect_links());
+ }
+ }
+
+
+ private void record_task_impls(){
+
+ for(TaskNode t: this.task_nodes.values()){
+ task_impls.put(t.getName(), new TaskImpl(t.getName()+"_impl"));
+ task_to_impl_links.add(new TaskToImpl(t.getNodeID(), (t.getName()+"_impl"), "1"));
+
+ for(String c: task_to_resources.get(t)){
+ impl_to_resource_links.add(new ImplToResource((t.getName()+"_impl"), c, "1"));
+ }
+ }
+ }
+
+ private void propositionEnumerationAux(AtomicFormula predicate, List<Variable> free, List<Variable> all_vars, Substitution s){
+
+ if(!free.isEmpty())
+ {
+ Variable to_fix = free.get(0);
+ List<Variable> reduced = new LinkedList<Variable>(free);
+ reduced.remove(0);
+
+
+ Iterator<Type> type_it = to_fix.getTypeSet().iterator();
+
+ while(type_it.hasNext()){
+ Type typ = type_it.next();
+ if(typeset_to_constant.get(typ) != null)
+ for(Constant c: typeset_to_constant.get(typ)){
+
+ Substitution s2 = s.clone();
+ s2.bind(to_fix, c);
+
+ propositionEnumerationAux(predicate, reduced, all_vars, s2);
+ }
+ }
+
+ }else
+ {
+
+ AtomicFormula substituted = predicate.apply(s);
+ String formula = (substituted.toString());
+ CondNode node = new CondNode(formula, 0, 0);
+ condition_nodes.put(formula, node);
+
+ }
+ }
+
+ public void printConditionNodes(){
+ System.out.println("Conditions: ");
+ System.out.println();
+ for(String s: condition_nodes.keySet()){
+ System.out.println(condition_nodes.get(s).toString());
+ }
+ System.out.println();
+ }
+
+ public void printTaskNodes(){
+ System.out.println("Actions: ");
+ System.out.println();
+ for(String s: task_nodes.keySet()){
+ System.out.println();
+ System.out.println(task_nodes.get(s).toString());
+ }
+ System.out.println();
+ }
+
+ public void printGoals(){
+ System.out.println("Goals: ");
+ System.out.println();
+ for(String s: goal_states.keySet()){
+ System.out.println(s+" Desired state: "+goal_states.get(s));
+ }
+ System.out.println();
+ }
+
+ public void printSAN(){
+ printConditionNodes();
+ printTaskNodes();
+ printGoals();
+ }
+
+ public void printTaskImpls(){
+ System.out.println("Task Impls:");
+ System.out.println();
+ for(String s: task_impls.keySet()){
+ System.out.println(task_impls.get(s).toString());
+ }
+
+ System.out.println();
+ }
+
+ public void printResources(){
+ System.out.println("Resources:");
+ System.out.println();
+ for(String s: resources.keySet()){
+ System.out.println(resources.get(s).toString());
+ }
+ System.out.println();
+ }
+
+ public void printTaskToImpls(){
+ System.out.println("TaskToImpls: ");
+ System.out.println();
+ for(TaskToImpl s: task_to_impl_links){
+ System.out.println(s.toString());
+ }
+ System.out.println();
+ }
+
+ public void printResourceToImpls(){
+ System.out.println("ResourceToImpls: ");
+ System.out.println();
+ for(ImplToResource r: impl_to_resource_links){
+ System.out.println(r.toString());
+ }
+ System.out.println();
+ }
+
+ public void printTM(){
+ printTaskImpls();
+ printResources();
+ printTaskToImpls();
+ printResourceToImpls();
+ }
+
+ public long getConditonNodeCount(){
+ return condition_nodes.size();
+ }
+
+ public long getActionNodeCount(){
+ return task_nodes.size();
+ }
+
+ public void write_SAN_to_xml(String filename){
+
+ try{
+ DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
+ Document doc = docBuilder.newDocument();
+
+ Element root = doc.createElement("SANet:network");
+
+ root.setAttribute("xmlns:SANet", "http://www.vanderbilt.edu/SANet");
+ root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ root.setAttribute("xsi:schemaLocation", "http://www.vanderbilt.edu/SANet SANet_Network.xsd");
+ root.setAttribute("xmlns", "http://www.vanderbilt.edu/SANet");
+
+ doc.appendChild(root);
+
+ Element defaultAtten = doc.createElement("defaultAttenFactor");
+ Text dAtten = doc.createTextNode("");
+ defaultAtten.appendChild(dAtten);
+
+ Element defCost = doc.createElement("defaultTaskCost");
+ Text dCText = doc.createTextNode("");
+ defCost.appendChild(dCText);
+
+ Element defCondUtil = doc.createElement("defaultCondUtil");
+ Text dCU = doc.createTextNode("");
+ defCondUtil.appendChild(dCU);
+
+ Element defProb = doc.createElement("defaultCondProbTrue");
+ Text probTextt = doc.createTextNode("");
+ defProb.appendChild(probTextt);
+
+ Element linkThresh = doc.createElement("linkThresh");
+ Text lThrT = doc.createTextNode("");
+ linkThresh.appendChild(lThrT);
+
+ root.appendChild(defaultAtten);
+ root.appendChild(defCost);
+ root.appendChild(defCondUtil);
+ root.appendChild(defProb);
+ root.appendChild(linkThresh);
+
+ for(TaskNode a: task_nodes.values()){
+
+ if(!init_act_visible && a.getName().equals("initact")){
+ continue;
+ }
+
+ Element taskNode = doc.createElement("taskNode");
+
+ Element nodeID = doc.createElement("nodeID");
+ Text idText = doc.createTextNode(a.getNodeID());
+ nodeID.appendChild(idText);
+
+ Element name = doc.createElement("name");
+ Text nameText = doc.createTextNode(a.getName());
+ name.appendChild(nameText);
+
+ Element priorProb = doc.createElement("priorProb");
+ Text probText = doc.createTextNode(new Double(a.getPriorProb()).toString());
+ priorProb.appendChild(probText);
+
+ Element attenFactor = doc.createElement("attenFactor");
+ Text text = doc.createTextNode(a.getAttenFactor());
+ attenFactor.appendChild(text);
+
+ Element cost = doc.createElement("cost");
+ Text costText = doc.createTextNode(a.getCost());
+ cost.appendChild(costText);
+
+ taskNode.appendChild(nodeID);
+ taskNode.appendChild(name);
+ taskNode.appendChild(priorProb);
+ taskNode.appendChild(attenFactor);
+ taskNode.appendChild(cost);
+
+ root.appendChild(taskNode);
+ }
+
+ for(CondNode c: condition_nodes.values()){
+ Element condNode = doc.createElement("condNode");
+
+ Element nodeID = doc.createElement("nodeID");
+ Text idText = doc.createTextNode(c.getNodeID());
+ nodeID.appendChild(idText);
+
+ Element name = doc.createElement("name");
+ Text nameText = doc.createTextNode(c.getName());
+ name.appendChild(nameText);
+
+ Element probTrue = doc.createElement("probTrue");
+ Text probText = doc.createTextNode(new Double(c.getProbability()).toString());
+ probTrue.appendChild(probText);
+
+ Element utility = doc.createElement("utility");
+ Text utilText = doc.createTextNode(new Double(c.getUtility()).toString());
+ utility.appendChild(utilText);
+
+ Element kind = doc.createElement("kind");
+ Text kindText = doc.createTextNode(c.getKind());
+ kind.appendChild(kindText);
+
+ Element attenFactor = doc.createElement("attenFactor");
+ Text attenText = doc.createTextNode(c.getAttenFactor());
+ attenFactor.appendChild(attenText);
+
+ condNode.appendChild(nodeID);
+ condNode.appendChild(name);
+ condNode.appendChild(probTrue);
+ condNode.appendChild(utility);
+ condNode.appendChild(kind);
+ condNode.appendChild(attenFactor);
+
+ root.appendChild(condNode);
+ }
+
+ for(PrecondLink l: precondition_links){
+
+
+
+ Element preLink = doc.createElement("precondLink");
+
+ Element condID = doc.createElement("condID");
+ Text idText = doc.createTextNode(l.getCondID());
+ condID.appendChild(idText);
+
+ Element taskID = doc.createElement("taskID");
+ Text taskText = doc.createTextNode(l.getTaskID());
+ taskID.appendChild(taskText);
+
+ Element portID = doc.createElement("portID");
+ Text portText = doc.createTextNode(l.getPortID());
+ portID.appendChild(portText);
+
+ Element trueProb = doc.createElement("trueProb");
+ Text trueText = doc.createTextNode(new Double(l.getTrueProb()).toString());
+ trueProb.appendChild(trueText);
+
+ Element falseProb = doc.createElement("falseProb");
+ Text falseText = doc.createTextNode(new Double(l.getFalseProb()).toString());
+ falseProb.appendChild(falseText);
+
+ preLink.appendChild(condID);
+ preLink.appendChild(taskID);
+ preLink.appendChild(portID);
+ preLink.appendChild(trueProb);
+ preLink.appendChild(falseProb);
+
+ root.appendChild(preLink);
+ }
+
+ for(EffectLink l: effect_links){
+
+ if(!init_act_visible && l.action.getName().equals("initact")){
+ continue;
+ }
+
+ Element effLink = doc.createElement("effectLink");
+
+ Element taskID = doc.createElement("taskID");
+ Text idText = doc.createTextNode(l.getTaskID());
+ taskID.appendChild(idText);
+
+ Element condID = doc.createElement("condID");
+ Text condText = doc.createTextNode(l.getCondID());
+ condID.appendChild(condText);
+
+ Element portID = doc.createElement("portID");
+ Text portText = doc.createTextNode(l.getPortID());
+ portID.appendChild(portText);
+
+ Element weight = doc.createElement("weight");
+ Text weightText = doc.createTextNode(new Double(l.getWeight()).toString());
+ weight.appendChild(weightText);
+
+ effLink.appendChild(taskID);
+ effLink.appendChild(condID);
+ effLink.appendChild(portID);
+ effLink.appendChild(weight);
+
+ root.appendChild(effLink);
+ }
+
+ //set up a transformer
+ TransformerFactory transfac = TransformerFactory.newInstance();
+ Transformer trans = transfac.newTransformer();
+ trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+ trans.setOutputProperty(OutputKeys.INDENT, "yes");
+ trans.setOutputProperty(OutputKeys.STANDALONE, "no");
+
+ //create string from xml tree
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ DOMSource source = new DOMSource(doc);
+ trans.transform(source, result);
+
+ FileWriter f = new FileWriter(filename);
+ f.write(sw.toString());
+ f.close();
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+ public void write_TM_to_xml(String filename){
+
+ try{
+ DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
+ Document doc = docBuilder.newDocument();
+
+ Element root = doc.createElement("SA-POP:taskMap");
+
+ root.setAttribute("xmlns:SA-POP", "http://www.vanderbilt.edu/SA-POP");
+ root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ root.setAttribute("xsi:schemaLocation", "http://www.vanderbilt.edu/SA-POP Task_Map.xsd");
+ root.setAttribute("xmlns", "http://www.vanderbilt.edu/SA-POP");
+
+ for(TaskImpl t: task_impls.values()){
+
+ if(!init_act_visible && t.getImplID().equals("initact_impl")){
+ continue;
+ }
+
+ Element taskImpl = doc.createElement("taskImpl");
+
+ Element implID = doc.createElement("implID");
+ Text implText = doc.createTextNode(t.getImplID());
+ implID.appendChild(implText);
+
+ Element param = doc.createElement("param");
+
+ Element paramID = doc.createElement("paramID");
+ Text paramIDText = doc.createTextNode(t.getParam().getParamID());
+ paramID.appendChild(paramIDText);
+
+ Element paramKind = doc.createElement("kind");
+ Text paramKindText = doc.createTextNode(t.getParam().getKind());
+ paramKind.appendChild(paramKindText);
+
+ Element paramValue = doc.createElement("value");
+ Text paramValueText = doc.createTextNode(t.getParam().getValue());
+ paramValue.appendChild(paramValueText);
+
+ param.appendChild(paramID);
+ param.appendChild(paramKind);
+ param.appendChild(paramValue);
+
+ taskImpl.appendChild(implID);
+ taskImpl.appendChild(param);
+
+ root.appendChild(taskImpl);
+
+ }
+
+ for(Resource r: resources.values()){
+
+ Element resource = doc.createElement("resource");
+
+ Element resourceID = doc.createElement("resourceID");
+ Text resourceText = doc.createTextNode(r.getResourceID());
+ resourceID.appendChild(resourceText);
+
+ Element kind = doc.createElement("kind");
+ Text kindText = doc.createTextNode(r.getKind());
+ kind.appendChild(kindText);
+
+ Element capacity = doc.createElement("capacity");
+ Text capacityText = doc.createTextNode(r.getCapacity());
+ capacity.appendChild(capacityText);
+
+ resource.appendChild(resourceID);
+ resource.appendChild(kind);
+ resource.appendChild(capacity);
+
+ root.appendChild(resource);
+
+ }
+
+ for(TaskToImpl t: task_to_impl_links){
+
+ if(!init_act_visible && t.getTaskID().equals("20")){
+ continue;
+ }
+
+ Element taskToImpl = doc.createElement("taskToImpl");
+
+ Element taskID = doc.createElement("taskID");
+ Text taskIDText = doc.createTextNode(t.getTaskID());
+ taskID.appendChild(taskIDText);
+
+ Element implID = doc.createElement("implID");
+ Text implIDText = doc.createTextNode(t.getImplID());
+ implID.appendChild(implIDText);
+
+ Element duration = doc.createElement("duration");
+ Text durationText = doc.createTextNode(t.getDuration());
+ duration.appendChild(durationText);
+
+ taskToImpl.appendChild(taskID);
+ taskToImpl.appendChild(implID);
+ taskToImpl.appendChild(duration);
+
+ root.appendChild(taskToImpl);
+
+ }
+
+ for(ImplToResource i: impl_to_resource_links){
+
+ Element implToResource = doc.createElement("implToResource");
+
+ Element implID = doc.createElement("implID");
+ Text implIDText = doc.createTextNode(i.getImplID());
+ implID.appendChild(implIDText);
+
+ Element resourceID = doc.createElement("resourceID");
+ Text resourceIDText = doc.createTextNode(i.getResourceID());
+ resourceID.appendChild(resourceIDText);
+
+ Element utilization = doc.createElement("utilization");
+ Text utilizationText = doc.createTextNode(i.getUtilization());
+ utilization.appendChild(utilizationText);
+
+ implToResource.appendChild(implID);
+ implToResource.appendChild(resourceID);
+ implToResource.appendChild(utilization);
+
+ root.appendChild(implToResource);
+ }
+
+ doc.appendChild(root);
+
+ //set up a transformer
+ TransformerFactory transfac = TransformerFactory.newInstance();
+ Transformer trans = transfac.newTransformer();
+ trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+ trans.setOutputProperty(OutputKeys.INDENT, "yes");
+ trans.setOutputProperty(OutputKeys.STANDALONE, "no");
+
+ //create string from xml tree
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ DOMSource source = new DOMSource(doc);
+ trans.transform(source, result);
+
+ FileWriter f = new FileWriter(filename);
+ f.write(sw.toString());
+ f.close();
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public void write_goals_to_file(String filename){
+ try{
+ FileWriter f = new FileWriter(filename);
+ for(String s: goal_states.keySet()){
+ f.write(condition_nodes.get(s).getNodeID()+"\n");
+ f.write(new Integer((goal_states.get(s))?10:-10).toString()+"\n");
+ }
+ f.close();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java
new file mode 100644
index 00000000000..33a77f964ba
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/CondNode.java
@@ -0,0 +1,106 @@
+package Translator.SAN_Data;
+
+import java.util.LinkedList;
+import java.util.List;
+
+
+/**
+ * Boolean state variable
+ * @author Ben
+ *
+ */
+public class CondNode{
+
+ private static int id_count = 0;
+
+ final String name;
+ final String nodeID;
+
+ double probTrue;
+ double utility;
+
+ String kind = "ENVIRON";
+
+ String attenFactor ="";
+
+ private List<EffectLink> affected_by;
+ private List<PrecondLink> precondition_to;
+
+ public CondNode(String p_name, double p_initial_probability, double p_init_util){
+
+ name = p_name;
+ nodeID = ("1"+id_count++);
+ probTrue = p_initial_probability;
+ utility = p_init_util;
+
+ affected_by = new LinkedList<EffectLink>();
+ precondition_to = new LinkedList<PrecondLink>();
+ }
+
+ public void destroy(){
+ for(EffectLink l: affected_by){
+ if(l.getWeight() > 0){
+ l.action.get_positive_effect_links().remove(l);
+ }else{
+ l.action.get_negative_effect_links().remove(l);
+ }
+ }
+
+ for(PrecondLink l: precondition_to){
+ if(l.getRequiredState()){
+ l.action.get_positive_precondition_links().remove(l);
+ }else{
+ l.action.get_negative_precondition_links().remove(l);
+ }
+ }
+ }
+
+ public List<EffectLink> getAffectedBy(){
+ return affected_by;
+ }
+
+ public List<PrecondLink> getPreconditionTo(){
+ return precondition_to;
+ }
+
+ public void setProbability(double prob){
+ probTrue = prob;
+ }
+
+ public String getNodeID(){
+ return nodeID;
+ }
+
+ public String getName(){
+ return name;
+ }
+
+ public double getProbability(){
+ return probTrue;
+ }
+
+ public double getUtility(){
+ return utility;
+ }
+
+
+ public String getKind(){
+ return kind;
+ }
+
+ public String getAttenFactor(){
+ return attenFactor;
+ }
+
+ public String toString(){
+ return ("Condition node: ["+name + "] ID: "+ nodeID +" Probability: "+ probTrue+ " Utility: "+ utility);
+ }
+
+ public void attach_precondition_link(PrecondLink l){
+ precondition_to.add(l);
+ }
+
+ public void attach_effect_link(EffectLink l){
+ affected_by.add(l);
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java
new file mode 100644
index 00000000000..69eeb862360
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/EffectLink.java
@@ -0,0 +1,63 @@
+package Translator.SAN_Data;
+
+public class EffectLink{
+
+ final public TaskNode action;
+ final public CondNode effect;
+
+ final double weight;
+
+ String portID ="";
+
+ public EffectLink(TaskNode p_action, CondNode p_effect, double p_weight){
+
+ action = p_action;
+ effect = p_effect;
+ weight = p_weight;
+
+ p_effect.attach_effect_link(this);
+ }
+
+ public String getTaskID(){
+ return action.getNodeID();
+ }
+
+ public String getCondID(){
+ return effect.getNodeID();
+ }
+
+ public String getPortID(){
+ return portID;
+ }
+
+ public double getWeight(){
+ return weight;
+ }
+
+ public String toString(){
+ return ("Effect link from: ["+action.name+"] to ["+ effect.name + "] Weight: "+weight);
+ }
+
+ public boolean sameSource(EffectLink l){
+ return this.action == l.action && this.weight == l.weight;
+ }
+
+ public boolean oppositeSource(EffectLink l){
+ return this.action == l.action && this.weight != l.weight;
+ }
+
+// /**
+// * Note! this does not
+// */
+// public boolean equals(Object obj){
+//
+// if(!(obj instanceof EffectLink)){
+// return false;
+// }
+//
+// EffectLink other_link = (EffectLink)obj;
+//
+// return (other_link.action == action && other_link.weight == weight);
+//
+// }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java
new file mode 100644
index 00000000000..175124eb64a
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/PrecondLink.java
@@ -0,0 +1,62 @@
+package Translator.SAN_Data;
+
+public class PrecondLink{
+
+ final public CondNode precondition;
+ final public TaskNode action;
+
+ final public boolean required_state;
+
+ double true_prob;
+ double false_prob;
+
+ String portID = "";
+
+ public PrecondLink(CondNode p_precond, TaskNode p_action, boolean required){
+
+ precondition = p_precond;
+ action = p_action;
+ required_state = required;
+
+ p_precond.attach_precondition_link(this);
+ }
+
+ public String getCondID(){
+ return precondition.getNodeID();
+ }
+
+ public String getTaskID(){
+ return action.getNodeID();
+ }
+
+ public double getTrueProb(){
+ return true_prob;
+ }
+
+ public double getFalseProb(){
+ return false_prob;
+ }
+
+ public boolean getRequiredState(){
+ return required_state;
+ }
+
+ public void setProbability(double prob){
+
+ if(required_state){
+ true_prob = prob;
+ false_prob = 0;
+ }else{
+ true_prob = 0;
+ false_prob = prob;
+ }
+ }
+
+ public String getPortID(){
+ return portID;
+ }
+
+ public String toString(){
+ return ("Precondition link from: ["+ precondition.name+ "] to ["+ action.name + "] t/f: "+ true_prob+ " "+ false_prob);
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java
new file mode 100644
index 00000000000..3c241a54370
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/SAN_Data/TaskNode.java
@@ -0,0 +1,161 @@
+package Translator.SAN_Data;
+
+import java.util.LinkedList;
+import java.util.List;
+
+
+/**
+ * Action node
+ * @author Ben
+ *
+ */
+public class TaskNode{
+
+ private static int id_count = 0;
+
+ final String name;
+ final String nodeID;
+
+ String attenFactor = "";
+ String cost = "";
+
+// private List<PrecondLink> preconditions;
+ private List<PrecondLink> positive_preconditions;
+ private List<PrecondLink> negative_preconditions;
+
+ private List<EffectLink> negative_effects;
+ private List<EffectLink> positive_effects;
+
+
+ public TaskNode(String p_name){
+
+ name = p_name;
+ nodeID = "2"+(id_count++);
+
+ positive_preconditions = new LinkedList<PrecondLink>();
+ negative_preconditions = new LinkedList<PrecondLink>();
+
+ positive_effects = new LinkedList<EffectLink>();
+ negative_effects = new LinkedList<EffectLink>();
+ }
+
+ public void destroy(){
+
+ for(PrecondLink l: positive_preconditions){
+ l.precondition.getPreconditionTo().remove(l);
+ }
+
+ for(PrecondLink l: negative_preconditions){
+ l.precondition.getPreconditionTo().remove(l);
+ }
+
+ for(EffectLink l: positive_effects){
+ l.effect.getAffectedBy().remove(l);
+ }
+
+ for(EffectLink l: negative_effects){
+ l.effect.getAffectedBy().remove(l);
+ }
+
+ }
+
+ public void set_precondition_probabilities(){
+
+ int links = positive_preconditions.size()+negative_preconditions.size();
+
+ for(PrecondLink l: positive_preconditions){
+ l.setProbability(Math.pow(.5, links-1));
+ }
+
+ for(PrecondLink l: negative_preconditions){
+ l.setProbability(Math.pow(.5, links-1));
+ }
+ }
+
+ public PrecondLink attach_precondition(CondNode n, boolean required_state){
+ PrecondLink plk = new PrecondLink(n, this, required_state);
+
+ if(required_state){
+ positive_preconditions.add(plk);
+ }
+ else{
+ negative_preconditions.add(plk);
+ }
+
+ return plk;
+ }
+
+ public EffectLink attach_effect(CondNode n, double weight){
+ EffectLink elk = new EffectLink(this, n, weight);
+
+ if(weight > 0){
+ positive_effects.add(elk);
+ }else{
+ negative_effects.add(elk);
+ }
+
+ return elk;
+ }
+
+ public String getName(){
+ return name;
+ }
+
+ public String getNodeID(){
+ return nodeID;
+ }
+
+ public String getAttenFactor(){
+ return attenFactor;
+ }
+
+ public String getCost(){
+ return cost;
+ }
+
+// public List<PrecondLink> get_precondition_links(){
+// return preconditions;
+// }
+
+ public List<PrecondLink> get_positive_precondition_links(){
+ return positive_preconditions;
+ }
+
+ public List<PrecondLink> get_negative_precondition_links(){
+ return negative_preconditions;
+ }
+
+ public List<EffectLink> get_positive_effect_links(){
+ return positive_effects;
+ }
+
+ public List<EffectLink> get_negative_effect_links(){
+ return negative_effects;
+ }
+
+ public double getPriorProb(){
+ return Math.pow(.5, positive_preconditions.size()+ negative_preconditions.size());
+ }
+
+ public String toString(){
+ String s = ("Action node: ["+ name+"] ID: "+nodeID);
+//
+// for(PrecondLink l: positive_preconditions){
+// s+=("\n "+l.toString());
+// }
+//
+// for(PrecondLink l: negative_preconditions){
+// s+=("\n "+l.toString());
+// }
+//
+// for(EffectLink l: positive_effects){
+// s+=("\n "+l.toString());
+// }
+//
+// for(EffectLink l: negative_effects){
+// s+=("\n "+l.toString());
+// }
+//
+ return s;
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java
new file mode 100644
index 00000000000..2acbdb2bc97
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/ImplToResource.java
@@ -0,0 +1,31 @@
+package Translator.TM_Data;
+
+public class ImplToResource {
+
+ public ImplToResource(String implID, String resourceID, String utilization) {
+ this.implID = implID;
+ this.resourceID = resourceID;
+ this.utilization = utilization;
+ }
+
+ private String implID;
+ private String resourceID;
+ private String utilization;
+
+ public String getImplID(){
+ return implID;
+ }
+
+ public String getResourceID(){
+ return resourceID;
+ }
+
+ public String getUtilization(){
+ return utilization;
+ }
+
+ public String toString(){
+ return ("ImplID: "+ implID+ " ResourceID: "+resourceID+ " Utilization: "+ utilization);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java
new file mode 100644
index 00000000000..990e736dd23
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/Resource.java
@@ -0,0 +1,31 @@
+package Translator.TM_Data;
+
+public class Resource {
+
+ public Resource(String resourceID, String kind, String capacity) {
+ this.resourceID = resourceID;
+ this.kind = kind;
+ this.capacity = capacity;
+ }
+
+ private String resourceID;
+ private String kind;
+ private String capacity;
+
+ public String getCapacity() {
+ return capacity;
+ }
+
+ public String getResourceID(){
+ return resourceID;
+ }
+
+ public String getKind(){
+ return kind;
+ }
+
+ public String toString(){
+ return ("ResourceID: "+ resourceID+" Kind: "+kind+" Capacity: "+capacity);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java
new file mode 100644
index 00000000000..e02e56b5456
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskImpl.java
@@ -0,0 +1,44 @@
+package Translator.TM_Data;
+
+public class TaskImpl {
+
+ public TaskImpl(String p_implID){
+ implID = p_implID;
+ param = new Param();
+ }
+
+ private String implID;
+ private Param param;
+
+ public String getImplID(){
+ return implID;
+ }
+
+ public Param getParam(){
+ return param;
+ }
+
+ public String toString(){
+ return ("ImplID: "+implID);
+ }
+
+ public class Param{
+
+ String paramID = "test_param1";
+ String kind = "test_kind1";
+ String value = "test_param_value1";
+
+ public String getParamID(){
+ return paramID;
+ }
+
+ public String getKind(){
+ return kind;
+ }
+
+ public String getValue(){
+ return value;
+ }
+ }
+}
+
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java
new file mode 100644
index 00000000000..5960bc2edc1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/Translator/TM_Data/TaskToImpl.java
@@ -0,0 +1,30 @@
+package Translator.TM_Data;
+
+public class TaskToImpl {
+
+ public TaskToImpl(String taskID, String implID, String duration) {
+ this.taskID = taskID;
+ this.implID = implID;
+ this.duration = duration;
+ }
+
+ private String taskID;
+ private String implID;
+ private String duration;
+
+ public String getTaskID(){
+ return taskID;
+ }
+
+ public String getImplID(){
+ return implID;
+ }
+
+ public String getDuration(){
+ return duration;
+ }
+
+ public String toString(){
+ return ("TaskID: "+ " ImplID: "+implID+" Duration: "+duration);
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java
new file mode 100644
index 00000000000..cebc0ce72e3
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Domain.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Set;
+
+import pddl4j.exp.AtomicFormula;
+import pddl4j.exp.action.ActionDef;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This interface defines the accessible methods from a domain.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface Domain extends Serializable {
+
+ /**
+ * Returns an iterator over the requirements of this pddl object.
+ *
+ * @return an iterator over the requirements of this pddl object.
+ */
+ Iterator<RequireKey> requirementsIterator();
+
+ /**
+ * Returns the set of constants associated to a specified type.
+ *
+ * @param type the type.
+ * @return the set of constants associated to a type or <code>null</code>
+ * if the type is not defined in the pddl object.
+ */
+ Set<Constant> getTypedDomain(Type type);
+
+ /**
+ * Returns the set of constants associated to a specified type.
+ *
+ * @param typeSet the type.
+ * @return the set of constants associated to a type or <code>null</code>
+ * if the type is not defined in the pddl object.
+ */
+ Set<Constant> getTypedDomain(TypeSet typeSet);
+
+ /**
+ * Returns an iterator over the types defined in this pddl object.
+ *
+ * @return an iterator over the types defined in this pddl object.
+ */
+ //Iterator<Type> typesIterator();
+
+ /**
+ * Returns an iterator over the constants defined in this pddl object.
+ *
+ * @return an iterator over the constants defined in this pddl object.
+ */
+ Iterator<Constant> constantsIterator();
+
+ /**
+ * Returns an iterator over the constants defined in this pddl object.
+ *
+ * @return an iterator over the constants defined in this pddl object.
+ */
+ Iterator<AtomicFormula> predicatesIterator();
+
+ /**
+ * Returns an iterator over the actions defined in this pddl object.
+ *
+ * @return an iterator over the actions defined in this pddl object.
+ */
+ Iterator<ActionDef> actionsIterator();
+
+ /**
+ * Returns the domain file where the PDDL object is defined.
+ *
+ * @return the domain file where the PDDL object is defined.
+ */
+ File getDomainFile();
+
+ /**
+ * Returns the name of the domain.
+ *
+ * @return the name of the domain.
+ */
+ String getDomainName();
+
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java
new file mode 100644
index 00000000000..e19794961a1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ErrorManager.java
@@ -0,0 +1,467 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * This class implements the error manager used by the parser and java pddl
+ * compiler.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class ErrorManager {
+
+ /**
+ * This enumeration defines the type of message log in the error manager.
+ */
+ public enum Message {
+ /**
+ * The parser error message.
+ */
+ PARSER_ERROR,
+
+ /**
+ * The parser warning message.
+ */
+ PARSER_WARNING,
+ /**
+ * The lexical error message.
+ */
+ LEXICAL_ERROR,
+ /**
+ * The linker error message.
+ */
+ LINKER_ERROR,
+ /**
+ * The linker warning message.
+ */
+ LINKER_WARNING,
+ /**
+ * The all type message.
+ */
+ ALL,
+ /**
+ * The parser message.
+ */
+ PARSER,
+ /**
+ * The parser message.
+ */
+ LINKER,
+ /**
+ * The error message.
+ */
+ ERROR,
+ /**
+ * The warning message.
+ */
+ WARNING,
+
+ }
+ /**
+ * The tree set used to store the messages.
+ */
+ private SortedSet<String> msg;
+
+ /**
+ * The tree set used to store the messages by type.
+ */
+ private TreeMap<Message, Set<String>> tMsg;
+
+ /**
+ * The tree set used to store the messages by file.
+ */
+ private SortedMap<File, Set<String>> fMsg;
+
+ /**
+ * The print stream of the error manager.
+ */
+ private PrintStream out;
+
+ /**
+ * Creates a new msg manager.
+ */
+ public ErrorManager() {
+ this.msg = new TreeSet<String>();
+ this.tMsg = new TreeMap<Message, Set<String>>();
+ this.fMsg = new TreeMap<File, Set<String>>();
+ this.out = System.out;
+ }
+
+ /**
+ * Sets a new output stream to the error manager.
+ *
+ * @param out the new output stream of the error manager.
+ */
+ private void setOutputStream(PrintStream out) {
+ this.out = out;
+ }
+
+ /**
+ * Print the messages log in the error manager.
+ *
+ * @param type the type of message to print.
+ */
+ public void print(Message type) {
+ this.print(this.getMessages(type));
+ }
+
+ /**
+ * Print the messages log in the error manager that concerns a specific file.
+ *
+ * @param file The file.
+ */
+ public void print(File file) {
+ this.print(this.fMsg.get(file));
+ }
+
+ /**
+ * Print the messages log in the error manager of a specific and concerning a specific file.
+ *
+ * @param type the type of message to print.
+ * @param file the file.
+ */
+ public void print(Message type, File file) {
+ this.print(this.getMessages(type, file));
+ }
+
+ /**
+ * Print the message to the current output stream.
+ *
+ * @param msg the list of messages to print.
+ */
+ private void print(Collection<String> msg) {
+ if (msg != null) {
+ for (String error : msg) {
+ this.out.println(error);
+ }
+ }
+ }
+
+ /**
+ * Returns the list of messages of a specific type.
+ *
+ * @param type The type of messages.
+ * @return The list of messages of a specific type.
+ */
+ public Set<String> getMessages(Message type) {
+ Set<String> messages = new HashSet<String>();
+ switch(type) {
+ case PARSER:
+ messages.addAll(this.getMessages(Message.PARSER_ERROR));
+ messages.addAll(this.getMessages(Message.PARSER_WARNING));
+ break;
+ case LINKER:
+ messages.addAll(this.getMessages(Message.LINKER_ERROR));
+ messages.addAll(this.getMessages(Message.LINKER_WARNING));
+ break;
+ case ERROR:
+ messages.addAll(this.getMessages(Message.LEXICAL_ERROR));
+ messages.addAll(this.getMessages(Message.PARSER_ERROR));
+ messages.addAll(this.getMessages(Message.LINKER_ERROR));
+ break;
+ case WARNING:
+ messages.addAll(this.getMessages(Message.PARSER_WARNING));
+ messages.addAll(this.getMessages(Message.LINKER_WARNING));
+ break;
+ case ALL:
+ messages = this.msg;
+ break;
+ default:
+ messages = this.tMsg.get(type);
+ if (messages == null) {
+ messages = new HashSet<String>();
+ }
+ }
+ return messages;
+ }
+
+ /**
+ * Returns the list of messages that concerns a specific file.
+ *
+ * @param file The file.
+ * @return The list of messages.
+ */
+ public Set<String> getMessages(File file) {
+ Set<String> msg = this.fMsg.get(file);
+ return msg == null ? new HashSet<String>() : msg;
+ }
+
+ /**
+ * Returns the list of messages of a specific type concerning a specific file.
+ *
+ * @param type The type of messages.
+ * @param file The file.
+ * @return The list of messages of a specific type concerning a specific file.
+ */
+ public Set<String> getMessages(Message type, File file) {
+ Set<String> s1 = new HashSet<String>(this.getMessages(type));
+ Set<String> s2 = this.getMessages(file);
+ s1.retainAll(s2);
+ return s1;
+ }
+
+ /**
+ * Init the msg manager.
+ */
+ public void clear() {
+ this.msg.clear();
+ // this.tMsg.clear();
+ }
+
+ /**
+ * Returns if the msg manager is empty, i.e., contains no message of any
+ * type.
+ *
+ * @return <code>true</code> if the msg manager is empty;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEmpty() {
+ return this.msg.isEmpty();
+ }
+
+ /**
+ * Returns <code>true</code> if the error manager contains message of a
+ * specific type.
+ *
+ * @param type th type tested.
+ * @return <code>true</code> if the error manager contains message of a
+ * specific type; <code>false</code> otherwise.
+ */
+ public boolean contains(Message type) {
+ return !this.getMessages(type).isEmpty();
+ }
+
+ /**
+ * Log an error message to the current print stream.
+ *
+ * @param msg the error message.
+ * @param file the file where the warning was encoutered.
+ * @param line the line of the error.
+ * @param column the column of the error.
+ */
+ public void logParserError(String msg, File file, int line, int column) {
+ String error = "Parser error at line " + line + ", column " + column
+ + " file (" + file.getName() + ") : " + msg;
+ this.msg.add(error);
+ Set<String> msgl = this.tMsg.get(Message.PARSER_ERROR);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.PARSER_ERROR, msgl);
+ }
+ msgl.add(error);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(error);
+ }
+
+ /**
+ * Log an lexical error message.
+ *
+ * @param msg the error message.
+ * @param file the file where the error was encoutered.
+ */
+ public void logLexicalError(String msg, File file) {
+ String error = msg + " in file " + file.getName();
+ this.msg.add(error);
+ Set<String> msgl = this.tMsg.get(Message.LEXICAL_ERROR);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.LEXICAL_ERROR, msgl);
+ }
+ msgl.add(error);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(error);
+ }
+
+ /**
+ * Log an lexical error message.
+ *
+ * @param msg the error message.
+ * @param file the file where the error was encoutered.
+ * @param line the line of the error.
+ * @param column the column of the error.
+ */
+ public void logLexicalError(String msg, File file, int line, int column) {
+ String error = "Lexical error at line " + line + ", column " + column + ", file (" + file.getName() + ") : " + msg;
+ this.msg.add(error);
+ Set<String> msgl = this.tMsg.get(Message.LEXICAL_ERROR);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.LEXICAL_ERROR, msgl);
+ }
+ msgl.add(error);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(error);
+ }
+
+ /**
+ * Log a warning message to the current print stream.
+ *
+ * @param msg the warning message.
+ * @param file the file where the warning was encoutered.
+ * @param line the line of the warning.
+ * @param column the column of the warning.
+ */
+ public void logParserWarning(String msg, File file, int line, int column) {
+ String warning = "Parser warning at line " + line + ", column " + column
+ + " file (" + file.getName() + ") : " + msg;
+ this.msg.add(warning);
+ Set<String> msgl = this.tMsg.get(Message.PARSER_WARNING);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.PARSER_WARNING, msgl);
+ }
+ msgl.add(warning);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(warning);
+ }
+
+ /**
+ * Log a warning message to the current print stream.
+ *
+ * @param msg the warning message.
+ * @param file the file where the warning was encoutered.
+ */
+ public void logLinkerWarning(String msg, File file) {
+ String warning = "Linker warning (" + file.getName() + "): " + msg;
+ this.msg.add(warning);
+ Set<String> msgl = this.tMsg.get(Message.LINKER_WARNING);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.LINKER_WARNING, msgl);
+ }
+ msgl.add(warning);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(warning);
+ }
+
+ /**
+ * Log an error message to the current print stream.
+ *
+ * @param msg the warning message.
+ * @param file the file where the warning was encoutered.
+ */
+ public void logLinkerError(String msg, File file) {
+ String error = "Linker error (" + file.getName() + "): " + msg;
+ this.msg.add(error);
+ Set<String> msgl = this.tMsg.get(Message.LINKER_ERROR);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.LINKER_ERROR, msgl);
+ }
+ msgl.add(error);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(error);
+ }
+
+ /**
+ * Log a warning message to the current print stream.
+ *
+ * @param msg the warning message.
+ * @param file the file where the warning was encoutered.
+ */
+ public void logParserWarning(String msg, File file) {
+ String warning = "Parser warning (" + file.getName() + "): " + msg;
+ this.msg.add(warning);
+ Set<String> msgl = this.tMsg.get(Message.PARSER_WARNING);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.PARSER_WARNING, msgl);
+ }
+ msgl.add(warning);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(warning);
+ }
+
+ /**
+ * Log an error message to the current print stream.
+ *
+ * @param msg the warning message.
+ * @param file the file where the warning was encoutered.
+ */
+ public void logParserError(String msg, File file) {
+ String error = "Compiler error (" + file.getName() + "): " + msg;
+ this.msg.add(error);
+ Set<String> msgl = this.tMsg.get(Message.PARSER_ERROR);
+
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.tMsg.put(Message.PARSER_ERROR, msgl);
+ }
+ msgl.add(error);
+ msgl = this.fMsg.get(file);
+ if (msgl == null) {
+ msgl = new LinkedHashSet<String>();
+ this.fMsg.put(file, msgl);
+ }
+ msgl.add(error);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java
new file mode 100644
index 00000000000..7996517c118
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/EvaluationException.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+/**
+ * EvaluationException is thrown if an attempt is made to evaluate a function
+ * and its evaluation fails. Specially, the evaluation may fail if the function
+ * is not ground or if an arithmetic error occurs during the evaluation.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class EvaluationException extends RuntimeException {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 6846672849363008483L;
+
+ /**
+ * Creates a new evaluation exception. with null as its detail message. The
+ * cause is not initialized, and may subsequently be initialized by a call
+ * to <code>Throwable.initCause(java.lang.Throwable)</code>.
+ */
+ public EvaluationException() {
+ super();
+ }
+
+ /**
+ * Creates a new evaluation exception with the specified detail message and
+ * cause.
+ *
+ * @param message the detail message (which is saved for later retrieval by
+ * the <code>Throwable.getMessage() method</code>).
+ * @param cause the cause (which is saved for later retrieval by the
+ * <code>Throwable.getCause()</code> method). (A
+ * <code>null</code> value is permitted, and indicates that the
+ * cause is nonexistent or unknown.)
+ */
+ public EvaluationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a new evaluation exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by a call
+ * to Throwable.initCause(java.lang.Throwable).
+ *
+ * @param message the detail message (which is saved for later retrieval by
+ * the Throwable.getMessage() method).
+ */
+ public EvaluationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new evaluation exception with the specified cause and a detail
+ * message of <code>(cause==null ? null : cause.toString())</code> (which
+ * typically contains the class and detail message of cause). This
+ * constructor is useful for exceptions that are little more than wrappers
+ * for other throwables (for example, <code>PrivilegedActionException</code>).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * <code>Throwable.getCause()</code> method). (A
+ * <code>null</code> value is permitted, and indicates that the
+ * cause is nonexistent or unknown.)
+ */
+ public EvaluationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java
new file mode 100644
index 00000000000..506a8d2f0a9
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/InvalidExpException.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import pddl4j.exp.ExpID;
+
+
+/**
+ * This expression is throw when an unexpected pddl expression is detected.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class InvalidExpException extends Exception {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5912801078385971869L;
+
+ /**
+ * The id of the invalid pddl expression.
+ */
+ private ExpID id;
+
+ /**
+ * Creates a new invalid PDDL expression.
+ */
+ private InvalidExpException() {}
+
+ /**
+ * Creates a new invalid PDDL expression with a specified expression id.
+ *
+ * @param id the id of the pddl expression that produce the exception.
+ */
+ public InvalidExpException(ExpID id) {
+ super();
+ this.id = id;
+ }
+
+ /**
+ * Creates a new invalid PDDL expression with a specified expression id.
+ *
+ * @param id the id of the pddl expression that produce the exception.
+ * @param message The message of the exception.
+ * @param cause The cause of the exception.
+ */
+ public InvalidExpException(ExpID id, String message, Throwable cause) {
+ super(message, cause);
+ this.id = id;
+ }
+
+ /**
+ * Creates a new invalid PDDL expression with a specified expression id.
+ *
+ * @param id the id of the pddl expression that produce the exception.
+ * @param message The message of the exception.
+ */
+ public InvalidExpException(ExpID id, String message) {
+ super(message);
+ this.id = id;
+ }
+
+ /**
+ * Creates a new invalid PDDL expression with a specified expression id.
+ *
+ * @param id the id of the pddl expression that produce the exception.
+ * @param cause The cause of the exception.
+ */
+ public InvalidExpException(ExpID id, Throwable cause) {
+ super(cause);
+ this.id = id;
+ }
+
+ /**
+ * Returns a string representation of this exception.
+ *
+ * @return a string representation of this exception.
+ */
+ public String toString() {
+ return super.getMessage() != null ?
+ "invalid PDDL expression " + this.id + " : " + super.getMessage() :
+ "invalid PDDL expression " + this.id;
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java
new file mode 100644
index 00000000000..69c9af1241b
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/PDDLObject.java
@@ -0,0 +1,697 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.AndExp;
+import pddl4j.exp.AtomicFormula;
+import pddl4j.exp.DerivedPredicate;
+import pddl4j.exp.Exp;
+import pddl4j.exp.InitEl;
+import pddl4j.exp.action.ActionDef;
+import pddl4j.exp.fexp.FHead;
+import pddl4j.exp.metric.MetricExp;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+import pddl4j.exp.term.Constant;
+
+/**
+ * This class implements a PDDL object that represente a planning domain either
+ * a planning problem.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class PDDLObject implements Domain, Problem {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -8333968277204698622L;
+
+ /**
+ * This enumeration defines the content of the PDDL object.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+ public enum Content {
+ /**
+ * The DOMAIN content.
+ */
+ DOMAIN,
+ /**
+ * The PARTIAL_PROBLEM content.
+ */
+ PARTIAL_PROBLEM,
+ /**
+ * The FULL_PROBLEM content.
+ */
+ FULL_PROBLEM;
+ }
+
+ /**
+ * The source version of PDDL object.
+ */
+ protected Source source;
+
+ /**
+ * The domain name of this PDDL object.
+ */
+ protected String domainName;
+
+ /**
+ * The problem name of this PDDL object.
+ */
+ protected String problemName;
+
+ /**
+ * The require table of this PDDL object.
+ */
+ protected LinkedHashSet<RequireKey> requirements;
+
+ /**
+ * Returns an iterator over the requirements of this pddl object.
+ *
+ * @return an iterator over the requirements of this pddl object.
+ */
+ public Iterator<RequireKey> requirementsIterator() {
+ return this.requirements.iterator();
+ }
+
+ /**
+ * The types table of this PDDL object.
+ */
+ protected Map<String, Set<String>> types;
+
+ /**
+ * The map used to store for each type its domain.
+ */
+ protected Map<Type, Set<Constant>> typeDomains;
+
+ /**
+ * Returns the set of constants associated to a specified type.
+ *
+ * @param type the type.
+ * @return the set of constants associated to a type or <code>null</code>
+ * if the type is not defined in the pddl object.
+ */
+ public Set<Constant> getTypedDomain(Type type) {
+ Set<Constant> domain = this.typeDomains.get(type);
+ if (domain == null) {
+ domain = new LinkedHashSet<Constant>();
+ }
+ for (Type st : type.getSubTypes()) {
+ Set<Constant> tmp = this.typeDomains.get(st);
+ if (tmp != null) domain.addAll(tmp);
+ }
+ return domain;
+ }
+
+ /**
+ * Returns the set of constants associated to a specified type.
+ *
+ * @param typeSet the type.
+ * @return the set of constants associated to a type or <code>null</code>
+ * if the type is not defined in the pddl object.
+ */
+ public Set<Constant> getTypedDomain(TypeSet typeSet) {
+ Set<Constant> domain = new LinkedHashSet<Constant>();
+ for (Type type : typeSet) {
+ domain.addAll(this.getTypedDomain(type));
+ }
+ return domain;
+ }
+
+
+
+ /**
+ * The constants table of this PDDL object.
+ */
+ protected Map<String, Constant> constants;
+
+ /**
+ * Returns an iterator over the constants defined in this pddl object.
+ *
+ * @return an iterator over the constants defined in this pddl object.
+ */
+ public Iterator<Constant> constantsIterator() {
+ return this.constants.values().iterator();
+ }
+
+ /**
+ * The predicates table of this PDDL object.
+ */
+ protected Set<AtomicFormula> predicates;
+
+ /**
+ * Returns an iterator over the constants defined in this pddl object.
+ *
+ * @return an iterator over the constants defined in this pddl object.
+ */
+ public Iterator<AtomicFormula> predicatesIterator() {
+ return this.predicates.iterator();
+ }
+
+ /**
+ * The functions table of this PDDL object.
+ */
+ protected Set<FHead> functions;
+
+ /**
+ * Returns an iterator over the functions defined in this pddl object.
+ *
+ * @return an iterator over the functions defined in this pddl object.
+ */
+ public Iterator<FHead> functionsIterator() {
+ return this.functions.iterator();
+ }
+
+ /**
+ * The constraints table of this PDDL object.
+ */
+ protected Set<Exp> constraints;
+
+ /**
+ * The actions table of this PDDL object.
+ */
+ protected Map<String, ActionDef> actions;
+
+ /**
+ * Returns an iterator over the actions defined in this pddl object.
+ *
+ * @return an iterator over the actions defined in this pddl object.
+ */
+ public Iterator<ActionDef> actionsIterator() {
+ return this.actions.values().iterator();
+ }
+
+ /**
+ * The axioms predicates table of this PDDL object.
+ */
+ protected Set<DerivedPredicate> axioms;
+
+ /**
+ * The initial state.
+ */
+ protected ArrayList<InitEl> init;
+
+ /**
+ * The goal.
+ */
+ protected Exp goal;
+
+ /**
+ * The content of the PDDL object.
+ */
+ protected Content content;
+
+ /**
+ * The metric specification.
+ */
+ protected MetricExp metric;
+
+ /**
+ * The domain file where the PDDL object is defined.
+ */
+ protected File domainFile;
+
+ /**
+ * The domain file where the PDDL object is defined.
+ */
+ protected File problemFile;
+
+
+ /**
+ * Creates a new PDDL object.
+ */
+ public PDDLObject() {
+ this.content = Content.DOMAIN;
+ this.domainFile = null;
+ this.problemFile = null;
+ this.source = Source.V3_0;
+ this.domainName = new String();
+ this.problemName = new String();
+ this.requirements = new LinkedHashSet<RequireKey>();
+ this.requirements.add(RequireKey.STRIPS);
+ this.types = new LinkedHashMap<String, Set<String>>();
+ this.types.put(Type.OBJECT_SYMBOL, new LinkedHashSet<String>());
+ this.typeDomains = new LinkedHashMap<Type, Set<Constant>>();
+ this.constants = new LinkedHashMap<String, Constant>();
+ this.predicates = new LinkedHashSet<AtomicFormula>();
+ this.functions = new LinkedHashSet<FHead>();
+ this.constraints = new LinkedHashSet<Exp>();
+ this.actions = new LinkedHashMap<String, ActionDef>();
+ this.axioms = new LinkedHashSet<DerivedPredicate>();
+ this.init = new ArrayList<InitEl>();
+ this.goal = new AndExp();
+ this.metric = null;
+ }
+
+ /**
+ * Returns the metric of the PDDL object.
+ *
+ * @return the metric of the PDDL object.
+ */
+ public MetricExp getMetric() {
+ return this.metric;
+ }
+
+ /**
+ * Returns the domain file where the PDDL object is defined.
+ *
+ * @return the domain file where the PDDL object is defined.
+ */
+ public File getDomainFile() {
+ return this.domainFile;
+ }
+
+ /**
+ * Returns the problem file where the PDDL object is defined.
+ *
+ * @return the problem file where the PDDL object is defined.
+ */
+ public File getProblemFile() {
+ return this.problemFile;
+ }
+
+ /**
+ * Returns the content of the PDDL object.
+ *
+ * @return the content of the PDDL object.
+ */
+ public Content getContent() {
+ return this.content;
+ }
+
+ /**
+ * Returns the goal of the PDDL object.
+ *
+ * @return the goal of the PDDL object.
+ */
+ public Exp getGoal() {
+ return this.goal;
+ }
+
+ /**
+ * Returns the initial state of the PDDL object.
+ *
+ * @return the initial state of the PDDL object.
+ */
+ public List<InitEl> getInit() {
+ return this.init;
+ }
+
+ /**
+ * Returns the name of the domain.
+ *
+ * @return the name of the domain.
+ */
+ public String getDomainName() {
+ return this.domainName;
+ }
+
+ /**
+ * Returns the name of the problem.
+ *
+ * @return the name of the problem.
+ */
+ public String getProblemName() {
+ return this.problemName;
+ }
+
+ /**
+ * Returns <code>true</code> if this domain is equal to an other object,
+ * i.e., if the other object is an instance of the class <code>Domain</code>
+ * not null and has the image.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this domain is equals to an other object;
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj.getClass().equals(this.getClass())) {
+ PDDLObject other = (PDDLObject) obj;
+ return this.domainName.equals(other.domainName)
+ && this.problemName.equals(other.problemName)
+ && this.content.equals(other.content);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this domain.
+ *
+ * @return the hash code value of this domain.
+ */
+ public int hashCode() {
+ return this.domainName.hashCode() + this.problemName.hashCode()
+ + this.content.hashCode();
+ }
+
+ /**
+ * Returns a string representation of the PDDL object.
+ *
+ * @return the string representation of the PDDL object.
+ */
+ public String toString() {
+ String str = new String();
+ switch (this.content) {
+ case DOMAIN:
+ str = toDomainString();
+ break;
+ case PARTIAL_PROBLEM:
+ str = toPartialProblemString();
+ break;
+ case FULL_PROBLEM:
+ str = toFullProblemString();
+ break;
+ }
+ return str;
+ }
+
+ /**
+ * Returns a string representation of a domain.
+ *
+ * @return the string representation of a domain.
+ */
+ private String toDomainString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(define (domain " + this.domainName + ")\n");
+ str.append(this.requirementstoString());
+ str.append(this.typestoString());
+ str.append(this.constantsToString("constants"));
+ str.append(this.predicatesToString());
+ str.append(this.functionsToString());
+ str.append(this.constraintsToString());
+ str.append(this.axiomsToString());
+ str.append(this.actionsToString());
+ return str.toString();
+
+ }
+
+ /**
+ * Returns a string representation of a partial problem.
+ *
+ * @return the string representation of a partial problem.
+ */
+ private String toPartialProblemString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(define (problem " + this.problemName + ")\n");
+ str.append("(:domain " + this.domainName + ")\n");
+ str.append(this.requirementstoString());
+ str.append(this.constantsToString("objects"));
+ str.append(this.constraintsToString());
+ str.append(this.initToString());
+ str.append(this.goalToString());
+ str.append(this.metricToString());
+ return str.toString();
+
+ }
+
+ /**
+ * Returns a string representation of a full problem.
+ *
+ * @return the string representation of a full problem.
+ */
+ private String toFullProblemString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:problem " + this.problemName + ")\n");
+ str.append("(:domain " + this.domainName + ")\n");
+ str.append(this.requirementstoString());
+ str.append(this.typestoString());
+ str.append(this.constantsToString("constants"));
+ str.append(this.predicatesToString());
+ str.append(this.functionsToString());
+ str.append(this.constraintsToString());
+ str.append(this.axiomsToString());
+ str.append(this.actionsToString());
+ str.append(this.initToString());
+ str.append(this.goalToString() + "\n");
+ str.append(this.metricToString());
+ return str.toString();
+
+ }
+
+ /**
+ * Returns a string representation of the requirements.
+ *
+ * @return a string representation of the requirements.
+ */
+ private String requirementstoString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.requirements.isEmpty()) {
+ str.append("(:requirements");
+ for (RequireKey rk : this.requirements) {
+ str.append(" " + rk.toString());
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the types.
+ *
+ * @return a string representation of the types.
+ */
+ private String typestoString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.types.isEmpty()) {
+ str.append("(:types");
+ for (String img : this.types.keySet()) {
+ Type type = new Type(img, this.types);
+ str.append("\n " + type.toString());
+ Set<Type> superTypes = type.getSuperTypes();
+ if (!superTypes.isEmpty()) {
+ str.append(" -");
+ Iterator<Type> i = superTypes.iterator();
+ if (superTypes.size() > 1) {
+ str.append(" (either");
+ while (i.hasNext()) {
+ str.append(" " + i.next().toString());
+ }
+ str.append(")");
+ } else {
+ str.append(" " + i.next().toString());
+ }
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the constants.
+ *
+ * @param label the label "constants" for domain and "objects for problem.
+ * @return a string representation of the constants.
+ */
+ private String constantsToString(String label) {
+ StringBuffer str = new StringBuffer();
+ if (!this.constants.isEmpty()) {
+ str.append("(:" + label);
+ for (Constant cst : this.constants.values()) {
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append("\n " + cst.toTypedString());
+ } else {
+ str.append(" " + cst.toString());
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the predicates.
+ *
+ * @return a string representation of the predicates.
+ */
+ private String predicatesToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.predicates.isEmpty()) {
+ str.append("(:predicates");
+ for (AtomicFormula atom : this.predicates) {
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append("\n " + atom.toTypedString());
+ } else {
+ str.append(" " + atom.toString());
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the functions.
+ *
+ * @return a string representation of the functions.
+ */
+ private String functionsToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.functions.isEmpty()) {
+ str.append("(:functions");
+ for (FHead func : this.functions) {
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append("\n " + func.toTypedString());
+ } else {
+ str.append("\n " + func.toString());
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the constraints.
+ *
+ * @return a string representation of the constraints.
+ */
+ private String constraintsToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.constraints.isEmpty()) {
+ str.append("(:constraints");
+ for (Exp exp : this.constraints) {
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append("\n " + exp.toTypedString());
+ } else {
+ str.append("\n " + exp.toString());
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the axioms.
+ *
+ * @return a string representation of the axioms.
+ */
+ private String axiomsToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.axioms.isEmpty()) {
+ for (DerivedPredicate axiom : this.axioms) {
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append(axiom.toTypedString());
+ } else {
+ str.append(axiom.toString());
+ }
+ str.append("\n");
+ }
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the actions.
+ *
+ * @return a string representation of the actions.
+ */
+ private String actionsToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.actions.isEmpty()) {
+ for (ActionDef action : this.actions.values()) {
+ str.append(action.toTypedString());
+ str.append("\n");
+ }
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the metric.
+ *
+ * @return a string representation of the metric.
+ */
+ private String metricToString() {
+ StringBuffer str = new StringBuffer();
+ if (this.metric != null) {
+ str.append(this.metric.toString());
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the init.
+ *
+ * @return a string representation of the init.
+ */
+ private String initToString() {
+ StringBuffer str = new StringBuffer();
+ if (!this.init.isEmpty()) {
+ str.append("(:init");
+ for (InitEl el : this.init) {
+ str.append("\n ");
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append(el.toTypedString());
+ } else {
+ str.append(el.toString());
+ }
+ }
+ str.append(")\n");
+ }
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the goal.
+ *
+ * @return a string representation of the goal.
+ */
+ private String goalToString() {
+ StringBuffer str = new StringBuffer();
+ if (this.goal != null) {
+ str.append("(:goal ");
+ str.append("\n ");
+ if (this.requirements.contains(RequireKey.TYPING)) {
+ str.append(goal.toTypedString());
+ } else {
+ str.append(goal.toString());
+ }
+ str.append(")");
+ }
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java
new file mode 100644
index 00000000000..ac34dd91069
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Parser.java
@@ -0,0 +1,5152 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import pddl4j.PDDLObject.Content;
+import pddl4j.exp.AndExp;
+import pddl4j.exp.AtomicFormula;
+import pddl4j.exp.DerivedPredicate;
+import pddl4j.exp.ExistsExp;
+import pddl4j.exp.Exp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.ForallExp;
+import pddl4j.exp.ImplyExp;
+import pddl4j.exp.InitEl;
+import pddl4j.exp.Literal;
+import pddl4j.exp.NotAtomicFormula;
+import pddl4j.exp.NotExp;
+import pddl4j.exp.OrExp;
+import pddl4j.exp.PrefExp;
+import pddl4j.exp.ProbExp;
+import pddl4j.exp.QuantifiedExp;
+import pddl4j.exp.WhenExp;
+import pddl4j.exp.action.Action;
+import pddl4j.exp.action.ActionDef;
+import pddl4j.exp.action.DurativeAction;
+import pddl4j.exp.assign.Assign;
+import pddl4j.exp.assign.AssignOpExp;
+import pddl4j.exp.assign.Decrease;
+import pddl4j.exp.assign.Increase;
+import pddl4j.exp.assign.ScaleDown;
+import pddl4j.exp.assign.ScaleUp;
+import pddl4j.exp.cond.AlwaysExp;
+import pddl4j.exp.cond.AlwaysWithinExp;
+import pddl4j.exp.cond.AtMostOnceExp;
+import pddl4j.exp.cond.HoldAfterExp;
+import pddl4j.exp.cond.HoldDuringExp;
+import pddl4j.exp.cond.SometimeAfterExp;
+import pddl4j.exp.cond.SometimeBeforeExp;
+import pddl4j.exp.cond.SometimeExp;
+import pddl4j.exp.cond.WithinExp;
+import pddl4j.exp.fcomp.Comp;
+import pddl4j.exp.fcomp.EqualComp;
+import pddl4j.exp.fcomp.FCompExp;
+import pddl4j.exp.fcomp.GEqualComp;
+import pddl4j.exp.fcomp.GreaterComp;
+import pddl4j.exp.fcomp.LEqualComp;
+import pddl4j.exp.fcomp.LessComp;
+import pddl4j.exp.fexp.BinaryAdd;
+import pddl4j.exp.fexp.BinaryDivide;
+import pddl4j.exp.fexp.BinaryMultiply;
+import pddl4j.exp.fexp.BinaryOp;
+import pddl4j.exp.fexp.BinarySubstract;
+import pddl4j.exp.fexp.FExp;
+import pddl4j.exp.fexp.FHead;
+import pddl4j.exp.fexp.NArityAdd;
+import pddl4j.exp.fexp.NArityMultiply;
+import pddl4j.exp.fexp.NArityOp;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.metric.MaximizeExp;
+import pddl4j.exp.metric.MetricExp;
+import pddl4j.exp.metric.MinimizeExp;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+import pddl4j.exp.time.AtEndTimedExp;
+import pddl4j.exp.time.AtStartTimedExp;
+import pddl4j.exp.time.AtTimedExp;
+import pddl4j.exp.time.OverAllTimedExp;
+import pddl4j.exp.time.OverTimedExp;
+import pddl4j.exp.time.TimedLiteral;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+import pddl4j.lexer.Lexer;
+import pddl4j.lexer.LexerTreeConstants;
+import pddl4j.lexer.ParseException;
+import pddl4j.lexer.SimpleNode;
+
+/**
+ * Implements the <tt>Parser</tt> of PDD4L library. The parser can be
+ * configured to accept only specified requirements of PDDL langage. The list of
+ * requirements accepted are as follow:
+ * <ul>
+ * <li><tt>:strips</tt> - Basic STRIPS-style.</li>
+ * <li><tt>:typing</tt> - Allows type names in declaration of variables</li>
+ * <li><tt>:negative-preconditions</tt> - Allows <tt>not</tt> in goal and
+ * preconditions descriptions.</li>
+ * <li><tt>:disjunctive-preconditions</tt> - Allows </tt>or</tt> in goal
+ * and preconditions descriptions.</li>
+ * <li><tt>:equality</tt> - Supports <tt>=</tt> as built-in predicate.</li>
+ * <li><tt>:existential-preconditions</tt> - Allows <tt>exists</tt> in goal
+ * and preconditions descriptions.</li>
+ * <li><tt>:universal-preconditions</tt> - Allows <tt>forall</tt> in goal
+ * and preconditions descriptions.</li>
+ * <li><tt>:quantified-preconditions</tt> - Is equivalent to <tt>:existential-preconditions</tt> +
+ * <tt>:universal-preconditions</tt>.</li>
+ * <li><tt>:conditional-effects</tt> - Allows <tt>when</tt> clause in
+ * actionCtx effects.</li>
+ * <li><tt>:fluents</tt> - Allows function definitions and use of effects
+ * using assignement operators and numeric preconditions.</li>
+ * <li><tt>:adl</tt> - Is equivalent to <tt>:strips</tt> + <tt>:typing</tt> +
+ * <tt>:negative-preconditions</tt> + <tt>:disjunctive-preconditions</tt> +
+ * <tt>:equality</tt> + <tt>:quantified-preconditions</tt> + <tt>:conditional-effects</tt>.</li>
+ * <li><tt>:durative-actions</tt> - Allows durative actions. Note that this
+ * does note imply <tt>:fluents</tt>.</li>
+ * <li><tt>:derived-predicate</tt> - Allows predicates whose truth value is
+ * defined by a formula.</li>
+ * <li><tt>:time-initial-literals</tt> - Allows the initial state to specify
+ * literals that will become true at a specified time point implies <tt>durative-actions</tt>.</li>
+ * <li><tt>:preferences</tt> - Allows use of preferences in actionCtx
+ * preconditions and goals.</li>
+ * <li><tt>:constraints</tt> - Allows use of constraints fields in domain and
+ * problem description. These may contain modal operator supporting trajectory
+ * constraints.</li>
+ * </ul>
+ * <p>
+ * All the properties can be modified using the following methods (by default
+ * the parser is ADL):
+ *
+ * <pre>
+ * Properties options = new Properties();
+ * options.pu(RequireKey.TYPING, true);
+ * options.put(RequireKey.NEGATIVE_PRECONDITIONS, true);
+ * ...
+ * parser.setOptions(options);
+ * </pre>
+ *
+ * </p>
+ * <p>
+ * A simple example of how to use the ADL parser:
+ *
+ * <pre>
+ * public static void main(String[] args) {
+ * // Checks the command line
+ * if (args.length != 2) {
+ * System.err.println(&quot;Invalid command line&quot;);
+ * } else {
+ * // Creates an instance of the java pddl parser
+ * Parser parser = new Parser(options);
+ * Domain domain = parser.parse(new File(args[0]));
+ * Problem problem = parser.parse(new File(args[1]));
+ * PDDLObject obj = parser.link(domain, problem);
+ * // Gets the error manager of the pddl parser
+ * ErrorManager mgr = parser.getErrorManager();
+ * // If the parser produces errors we print it and stop
+ * if (mgr.contains(Message.ERROR)) {
+ * mgr.print(Message.ALL);
+ * } // else we print the warnings
+ * else {
+ * mgr.print(Message.WARNING);
+ * System.out.println(&quot;\nParsing domain \&quot;&quot; + domain.getDomainName()
+ * + &quot;\&quot; done successfully ...&quot;);
+ * System.out.println(&quot;Parsing problem \&quot;&quot; + problem.getProblemName()
+ * + &quot;\&quot; done successfully ...\n&quot;);
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * @author Damien Pellier
+ * @version 1.0, 14/01/03
+ */
+public final class Parser {
+
+ /**
+ * The file extention pddl.
+ */
+ public static final String PDDL_EXTENTION = ".pddl";
+
+ /**
+ * The error manager of the parser.
+ */
+ private ErrorManager mgr;
+
+ /**
+ * The parser input file.
+ */
+ private File file;
+
+ /**
+ * The PDDL object returns by the parser.
+ */
+ private PDDLObject obj;
+
+ /**
+ * The requirement accepted by the parser.
+ */
+ private Properties options;
+
+ /**
+ * The actionCtx used to store the context.
+ */
+ private ActionDef actionCtx;
+
+ /**
+ * The quantified expression used to store the context.
+ */
+ private QuantifiedExp quantifiedExpCtx;
+
+ /**
+ * The flag use to specified the context.
+ */
+ private boolean constantDef = false;
+
+ /**
+ * Create a new <tt>Parser</tt>.
+ */
+ public Parser() {
+ super();
+ this.options = Parser.getDefaultOptions();
+ this.mgr = new ErrorManager();
+ }
+
+ /**
+ * Create a new <tt>Parser</tt> with a specific errors manager.
+ *
+ * @param options the options of the parser.
+ */
+ public Parser(Properties options) {
+ super();
+ this.options = options;
+ this.mgr = new ErrorManager();
+ }
+
+ /**
+ * Create a new <tt>Parser</tt> with a specific errors manager.
+ *
+ * @param mgr the error manager of the parser.
+ */
+ public Parser(ErrorManager mgr) {
+ super();
+ this.options = Parser.getDefaultOptions();
+ this.mgr = mgr;
+ }
+
+ /**
+ * Create a new <tt>Parser</tt> with a specific errors manager.
+ *
+ * @param options the options of the parser.
+ * @param mgr the error manager of the parser.
+ */
+ public Parser(Properties options, ErrorManager mgr) {
+ super();
+ this.options = options;
+ this.mgr = mgr;
+ }
+
+ /**
+ * Parses a PDDL file.
+ *
+ * @param file the file to parse.
+ * @return The PDDL object representing the PDDL file or null if the parsing fails.
+ * @throws FileNotFoundException if the file to parse does not exist.
+ * @throws NullPointerException if <code>file == null</code>.
+ */
+ public PDDLObject parse(File file) throws FileNotFoundException {
+ if (file == null)
+ throw new NullPointerException("\"file\" parameter is null");
+ PDDLObject obj = null;
+
+ try {
+ String ext = file.getName().substring(file.getName().lastIndexOf("."));
+ if (!ext.equals(Parser.PDDL_EXTENTION)) {
+ this.mgr.logParserWarning("File \""
+ + file.getName() + "\": " + " File should have \".pddl\" extension.", file);
+ }
+ } catch (StringIndexOutOfBoundsException e) {
+ this.mgr.logParserWarning("File \""
+ + file.getName() + "\": " + " File should have \".pddl\" extension.", file);
+ }
+ SimpleNode root = null;
+ this.file = file;
+ Lexer lexer = new Lexer(new FileInputStream(file));
+ lexer.setErrorManager(this.mgr);
+ lexer.setFile(this.file);
+ try {
+ root = lexer.parse();
+ if (root != null) {
+ obj = this.root(root);
+ }
+ } catch (Throwable e) {
+ boolean print = false;
+ Object debug = this.options.get("debug");
+ if (debug instanceof String) {
+ if (debug.equals("true")) {
+ print = true;
+ }
+ } else if (debug instanceof Boolean) {
+ if (debug.equals(true)) {
+ print = true;
+ }
+ }
+ if (print) {
+ e.printStackTrace(System.err);
+ }
+ }
+
+ return obj;
+ }
+
+ /**
+ * Prints the syntaxic tree of a specific pddl file.
+ *
+ * @param file the pddl file.
+ * @throws FileNotFoundException if the file to parse does not exist.
+ * @throws NullPointerException if <code>file == null</code>.
+ */
+ public void printSyntaxicTree(File file) throws FileNotFoundException {
+ if (file == null)
+ throw new NullPointerException("\"file\" parameter is null");
+ SimpleNode n;
+ try {
+ this.file = file;
+ Lexer lexer = new Lexer(new FileInputStream(file));
+ lexer.setFile(file);
+ lexer.setErrorManager(this.mgr);
+ SimpleNode root = lexer.parse();
+ root.dump("");
+ } catch (ParseException pe) {
+ boolean print = false;
+ Object debug = this.options.get("debug");
+ if (debug instanceof String) {
+ if (debug.equals("true")) {
+ print = true;
+ }
+ } else if (debug instanceof Boolean) {
+ if (debug.equals(true)) {
+ print = true;
+ }
+ }
+ if (print) {
+ pe.printStackTrace(System.err);
+ }
+ }
+ }
+
+ /**
+ * Returns the options of the parser.
+ *
+ * @return the options of the parser.
+ */
+ public Properties getOptions() {
+ return this.options;
+ }
+
+ /**
+ * Sets the new options of the parser.
+ *
+ * @param options the new options of the parser.
+ */
+ public void setOptions(Properties options) {
+ this.options = options;
+ }
+
+ /**
+ * Returns the error manager of the compiler.
+ *
+ * @return the error manager of the compiler.
+ */
+ public ErrorManager getErrorManager() {
+ return this.mgr;
+ }
+
+ /**
+ * Sets a new error manager to the compiler.
+ *
+ * @param mgr the new error manager of the compiler.
+ */
+ public void setErrorManager(ErrorManager mgr) {
+ this.mgr = mgr;
+ }
+
+ /**
+ * Returns the default options of the parser.
+ *
+ * @return the default options.
+ */
+ public static Properties getDefaultOptions() {
+ Properties options = new Properties();
+ options.put("source", Source.V3_0);
+ options.put("debug", true);
+ options.put(RequireKey.STRIPS, true);
+ options.put(RequireKey.TYPING, true);
+ options.put(RequireKey.NEGATIVE_PRECONDITIONS, true);
+ options.put(RequireKey.EQUALITY, true);
+ options.put(RequireKey.QUANTIFIED_PRECONDITIONS, true);
+ options.put(RequireKey.EXISTENTIAL_PRECONDITIONS, true);
+ options.put(RequireKey.UNIVERSAL_PRECONDITIONS, true);
+ options.put(RequireKey.CONDITIONAL_EFFECTS, true);
+ options.put(RequireKey.ADL, true);
+ return options;
+ }
+
+ /**
+ * Creates a new PDDL
+ * object containing also the domain informations. This method is usefull to
+ * check the symbol shared between domain and problem input files.
+ *
+ * @param domain the domain.
+ * @param problem the problem.
+ * @return a PDDL object containing all the information needed for planning.
+ * @throws NullPointerException if <code>domain == null || problem == null</code>.
+ */
+ public PDDLObject link(Domain domain, Problem problem) {
+ if (domain == null || problem == null) {
+ throw new NullPointerException();
+ }
+ PDDLObject dom = (PDDLObject) domain;
+ PDDLObject pb = (PDDLObject) problem;
+ boolean failure = false;
+ PDDLObject object = new PDDLObject();
+ object.content = PDDLObject.Content.FULL_PROBLEM;
+ object.domainFile = domain.getDomainFile();
+ object.problemFile = problem.getProblemFile();
+ object.actions.putAll(dom.actions);
+ object.axioms.addAll(dom.axioms);
+ object.constants.putAll(dom.constants);
+ for (Constant cts : pb.constants.values()) {
+ TypeSet newType = new TypeSet();
+ for (Type ts : cts.getTypeSet()) {
+ Set<String> pt = dom.types.get(ts.getImage());
+ if (pt == null) {
+ this.mgr.logLinkerError("type \"" + ts.toString() + "\" of object \""
+ + cts + "\" is undefined.", problem.getProblemFile());
+ failure = true;
+ } else {
+ newType.add(new Type(ts.getImage(), dom.types));
+ }
+ }
+ cts.setTypeSet(newType);
+ object.constants.put(cts.getImage(), cts);
+ }
+
+ for (Constant cst : object.constants.values()) {
+ for (Type type : cst.getTypeSet()) {
+ Set<Constant> setCst = object.typeDomains.get(type);
+ if (setCst == null) {
+ setCst = new LinkedHashSet<Constant>();
+ object.typeDomains.put(type, setCst);
+ }
+ setCst.add(cst);
+ }
+ }
+ object.constraints.addAll(dom.constraints);
+ object.constraints.addAll(pb.constraints);
+ object.domainName = domain.getDomainName();
+ object.goal = pb.goal;
+ object.init = pb.init;
+ for (InitEl el : object.init) {
+ if (el.getExpID().equals(ExpID.ATOMIC_FORMULA)) {
+ AtomicFormula atom = (AtomicFormula) el;
+ boolean match = false;
+ Iterator<AtomicFormula> i = dom.predicates.iterator();
+ while (i.hasNext() && !match) {
+ AtomicFormula copy = i.next().clone().standardize();
+ Substitution sigma = copy.match(atom);
+ match = sigma != null;
+ }
+ if (!match) {
+ this.mgr.logLinkerError("predicate \""
+ + atom.toString()
+ + "\" undefined.", this.file);
+ }
+ } else if (el.getExpID().equals(ExpID.F_COMP)) {
+ FCompExp fComp = (FCompExp) el;
+ boolean match = false;
+ Iterator<FHead> i = dom.functions.iterator();
+ while (i.hasNext() && !match) {
+ FHead copy = i.next().clone().standardize();
+ Substitution sigma = copy.unify(fComp.getArg2());
+ match = sigma != null;
+ }
+ if (!match) {
+ this.mgr.logLinkerError("function \""
+ + fComp.getArg2().toString()
+ + "\" undefined.", this.file);
+ }
+ } else {
+ this.mgr.logLinkerError("invalide expression in init block",
+ problem.getProblemFile());
+ }
+
+ }
+
+ object.metric = pb.metric;
+ object.predicates.addAll(dom.predicates);
+ object.problemName = problem.getProblemName();
+ if (!pb.requirements.equals(dom.requirements)) {
+ this.mgr.logLinkerWarning("domain and problem should have the same requirements.",
+ problem.getProblemFile());
+ }
+ object.types.putAll(dom.types);
+ object.requirements = dom.requirements;
+ if (!dom.source.equals(pb.source)) {
+ this.mgr.logLinkerError("Imcompatible source version\"" , problem.getProblemFile());
+ } else {
+ object.source = dom.source;
+ }
+ return failure ? null : object;
+ }
+
+ /**
+ * Extracts the object structures from the <code>ROOT</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ROOT</code> node.
+ * @return the domain extract.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private PDDLObject root(SimpleNode node) throws ParserException {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTDOMAIN:
+ return this.domain(cn);
+ case LexerTreeConstants.JJTPROBLEM:
+ return this.problem(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from a <code>PROBLEM</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PROBLEM</code> node.
+ * @return the problem structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private PDDLObject problem(SimpleNode node) throws ParserException {
+ this.obj = new PDDLObject();
+ this.obj.content = PDDLObject.Content.PARTIAL_PROBLEM;
+ this.obj.problemFile = this.file;
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTPROBLEM_NAME:
+ String name = this.file.getName();
+ if (!cn.getImage().equals(name.substring(0, name.lastIndexOf(".")))) {
+ this.mgr.logParserWarning("problem \"" + cn.getImage() + "\" must be defined in a file \""
+ + cn.getImage() + ".pddl\".", this.file, cn.getLine(),
+ cn.getColumn());
+ }
+ this.obj.problemName = cn.getImage();
+ break;
+ case LexerTreeConstants.JJTDOMAIN_NAME:
+ this.obj.domainName = cn.getImage();
+ break;
+ case LexerTreeConstants.JJTREQUIRE_DEF:
+ this.requireDef(cn);
+ break;
+ case LexerTreeConstants.JJTOBJECT_DECLARATION:
+ this.object_declaration(cn);
+ break;
+ case LexerTreeConstants.JJTINIT:
+ this.init(cn);
+ break;
+ case LexerTreeConstants.JJTGOAL:
+ this.goal(cn);
+ break;
+ case LexerTreeConstants.JJTCONSTRAINTS:
+ this.constraints(cn);
+ break;
+ case LexerTreeConstants.JJTMETRIC_SPEC:
+ this.metric_spec(cn);
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * Extracts the object structures from the <code>METRIC_SPEC</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>METRIC_SPEC</code> node.
+ * @return the metric expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private MetricExp metric_spec(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch(cn.getId()) {
+ case LexerTreeConstants.JJTMAXIMIZE:
+ obj.metric = this.maximize(cn);
+ return obj.metric;
+ case LexerTreeConstants.JJTMINIMIZE:
+ obj.metric = this.minimize(cn);
+ return obj.metric;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>MAXIMIZE</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>MAXIMIZE</code> node.
+ * @return the maximize expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private MetricExp maximize(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTMETRIC_F_EXP) {
+ return new MaximizeExp(this.metric_f_exp(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>MINIMIZE</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>MINIMIZE</code> node.
+ * @return the minimize expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private MetricExp minimize(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTMETRIC_F_EXP) {
+ return new MinimizeExp(this.metric_f_exp(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>METRIC_F_EXP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>METRIC_F_EXP</code> node.
+ * @return the metric function expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term metric_f_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch(cn.getId()) {
+ case LexerTreeConstants.JJTUNARY_OP_METRIC_F_EXP:
+ return this.unary_op_metric_f_exp(cn);
+ case LexerTreeConstants.JJTBINARY_OP_METRIC_F_EXP:
+ return this.binary_op_metric_f_exp(cn);
+ case LexerTreeConstants.JJTMULTI_OP_METRIC_F_EXP:
+ return this.multi_op_metric_f_exp(cn);
+ case LexerTreeConstants.JJTNUMBER:
+ return this.number(cn);
+ case LexerTreeConstants.JJTCONSTANT_F_HEAD:
+ return this.constant_f_head(cn);
+ case LexerTreeConstants.JJTTOTAL_TIME:
+ return new Variable(Variable.TOTAL_TIME, Type.NUMBER);
+ case LexerTreeConstants.JJTVIOLATED_PREF_EXP:
+ return this.violated_pref_exp(cn);
+
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>VIOLATED_PREF_EXP</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>VIOLATED_PREF_EXP</code> node.
+ * @return the violated preference expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Variable violated_pref_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTPREF_NAME) {
+ return new Variable(Variable.VIOLATED_PREF_VARIABLE + this.pref_name(cn),
+ Type.NUMBER);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>CONSTANT_F_HEAD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>CONSTANT_F_HEADF_HEAD</code> node.
+ * @return the function head structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FHead constant_f_head(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() > 0) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTFUNCTOR) {
+ FHead f_head = new FHead(this.functor(cn1), Type.NUMBER);
+ for (int i = 1; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTCONSTANT:
+ f_head.add(this.constant(cn));
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel()
+ + " unexpected.");
+ }
+ }
+ return f_head;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>MULTI_OP_METRIC_F_EXP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>MULTI_OP_METRIC_F_EXP</code> node.
+ * @return the binray numeric operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private NArityOp multi_op_metric_f_exp(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTADD_NARITY_OP_METRIC_F_EXP:
+ return this.add_narity_op_metric_f_exp(cn);
+ case LexerTreeConstants.JJTMULTIPLY_NARITY_OP_METRIC_F_EXP:
+ return this.multiply_narity_op_metric_f_exp(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ADD_NARITY_OP_METRIC_F_EXP</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ADD_NARITY_OP_METRIC_F_EXP</code> node.
+ * @return the multi divide function expression build
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private NArityAdd add_narity_op_metric_f_exp(SimpleNode node) throws ParserException {
+ NArityAdd exp = new NArityAdd();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTMETRIC_F_EXP:
+ exp.add(this.metric_f_exp(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>MULTIPLY_NARITY_OP_METRIC_F_EXP</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>MULTIPLY_NARITY_OP_METRIC_F_EXP</code> node.
+ * @return the multi divide function expression build
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private NArityMultiply multiply_narity_op_metric_f_exp(SimpleNode node) throws ParserException {
+ NArityMultiply exp = new NArityMultiply();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTMETRIC_F_EXP:
+ exp.add(this.metric_f_exp(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>BINARY_OP_METRIC_F_EXP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>BINARY_OP_METRIC_F_EXP</code> node.
+ * @return the binray numeric operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp binary_op_metric_f_exp(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTADD_OP_METRIC_F_EXP:
+ return this.add_op_metric_f_exp(cn);
+ case LexerTreeConstants.JJTSUBSTRACT_OP_METRIC_F_EXP:
+ return this.substract_op_metric_f_exp(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ADD_OP_METRIC_F_EXP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ADD_OP_METRIC_F_EXP</code> node.
+ * @return the add operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryAdd add_op_metric_f_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTMETRIC_F_EXP
+ && cn2.getId() == LexerTreeConstants.JJTMETRIC_F_EXP) {
+ return new BinaryAdd(this.metric_f_exp(cn1), this.metric_f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SUBSTRACT_OP_METRIC_F_EXP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SUBSTRACT_OP_METRIC_F_EXP</code> node.
+ * @return the substract operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinarySubstract substract_op_metric_f_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTMETRIC_F_EXP
+ && cn2.getId() == LexerTreeConstants.JJTMETRIC_F_EXP) {
+ return new BinarySubstract(this.metric_f_exp(cn1), this.metric_f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>UNARY_OP_METRIC_F_EXP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>UNARY_OP_METRIC_F_EXP</code> node.
+ * @return the unary op metric function expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FExp unary_op_metric_f_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTMETRIC_F_EXP) {
+ return new BinarySubstract(new Number(), this.metric_f_exp(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>INIT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INIT</code> node.
+ * @return the initial state structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp goal(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTPRE_GD) {
+ obj.goal = this.pre_gd(cn);
+ return obj.goal;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>INIT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INIT</code> node.
+ * @return the initial state structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ArrayList<InitEl> init(SimpleNode node) throws ParserException {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTINIT_EL:
+ obj.init.add(this.init_el(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj.init;
+ }
+
+ /**
+ * Extracts the object structures from the <code>INIT_EL</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INIT_EL</code> node.
+ * @return initial state element.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private InitEl init_el(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTLITERAL:
+ return this.ground_literal(cn);
+ case LexerTreeConstants.JJTEQUAL_INIT_EL:
+ return this.equal_init_el(cn);
+ case LexerTreeConstants.JJTTIMED_LITERAL:
+ return this.timed_literal(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>INIT_EL</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INIT_EL</code> node.
+ * @return initial state element.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private TimedLiteral timed_literal(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTLITERAL) {
+ Number number = this.number(cn1);
+ if (number.getValue() < 0) {
+ this.mgr.logParserError("time stamp of timed literal must be positive",
+ file, cn1.getLine(), cn1.getColumn());
+ }
+ return new TimedLiteral(number, this.ground_literal(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>INIT_EL</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INIT_EL</code> node.
+ * @return initial state element.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private EqualComp equal_init_el(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTNUMBER) {
+ return new EqualComp(this.f_head(cn1), this.number(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>OBJECT_DECLARATION</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>OBJECT_DECLARATION</code> node.
+ * @return the object declartion structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Constant> object_declaration(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTTYPED_LIST) {
+ this.constantDef = true;
+ this.constant_typed_list(cn, obj.constants);
+ this.constantDef = false;
+ return obj.constants;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+
+ /**
+ * Extracts the object structures from a <code>DOMAIN</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DOMAIN</code> node.
+ * @return the domain structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private PDDLObject domain(SimpleNode node) throws ParserException {
+ this.obj = new PDDLObject();
+ this.obj.content = PDDLObject.Content.DOMAIN;
+ this.obj.domainFile = this.file;
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTDOMAIN_NAME:
+ obj.domainName = cn.getImage();
+ String name = file.getName();
+ if (!cn.getImage().equals(name.substring(0, name.lastIndexOf(".")))) {
+ this.mgr.logParserWarning("Domain \"" + cn.getImage() + "\" should be defined in a file \""
+ + cn.getImage() + ".pddl\".", this.file, cn.getLine(),
+ cn.getColumn());
+ }
+ break;
+ case LexerTreeConstants.JJTREQUIRE_DEF:
+ this.requireDef(cn);
+ break;
+ case LexerTreeConstants.JJTTYPE_DEF:
+ this.types_def(cn);
+ break;
+ case LexerTreeConstants.JJTCONSTANT_DEF:
+ this.constants_def(cn);
+ break;
+ case LexerTreeConstants.JJTPREDICATE_DEF:
+ this.predicates_def(cn);
+ break;
+ case LexerTreeConstants.JJTFUNCTION_DEF:
+ this.functions_def(cn);
+ break;
+ case LexerTreeConstants.JJTCONSTRAINTS:
+ this.constraints(cn);
+ break;
+ case LexerTreeConstants.JJTSTRUCTURE_DEF:
+ this.structure_def(cn);
+ break;
+ default:
+
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * Extracts the object structures from the <code>STRUCTURE_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>STRUCTURE_DEF</code> node.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private void structure_def(SimpleNode node) throws ParserException {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTACTION_DEF:
+ this.action_def(cn);
+ break;
+ case LexerTreeConstants.JJTDURATION_ACTION_DEF:
+ if (!this.obj.requirements.contains(RequireKey.DURATIVE_ACTIONS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.DURATIVE_ACTIONS
+ + "\" needed to specify durative actions.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ this.durative_action_def(cn);
+ break;
+ case LexerTreeConstants.JJTDERIVED_DEF:
+ this.derived_def(cn);
+ break;
+ default:
+ this.actionCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>DURATIVE_ACTION</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DURATIVE_ACTION</code> node.
+ * @return the durative actionCtx structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private DurativeAction durative_action_def(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 3) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ SimpleNode cn3 = (SimpleNode) node.jjtGetChild(2);
+ if (cn1.getId() == LexerTreeConstants.JJTDA_SYMBOL
+ && cn2.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn3.getId() == LexerTreeConstants.JJTDA_DEF_BODY) {
+ DurativeAction action = new DurativeAction(this.action_name(cn1));
+ LinkedHashMap<String, Variable> parameters = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn2, parameters);
+ for (Variable param : parameters.values()) {
+ action.add(param);
+ }
+ this.da_def_body(cn3, action);
+ if (this.obj.actions.containsKey(action.getName())) {
+ this.mgr.logParserError("Duplicated action \"" + action.getName()
+ + " \"." , this.file, cn1.getLine(), cn1.getColumn());
+ } else {
+ this.obj.actions.put(action.getName(), action);
+ }
+ return action;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_DEF_BODY</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_DEF_BODY</code> node.
+ * @param action the duratiive actionCtx to initialize.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private void da_def_body(SimpleNode node, DurativeAction action) throws ParserException {
+ this.actionCtx = action;
+ if (node.jjtGetNumChildren() == 3) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ SimpleNode cn3 = (SimpleNode) node.jjtGetChild(2);
+ if (cn1.getId() == LexerTreeConstants.JJTDURATION_CONSTRAINT
+ && cn2.getId() == LexerTreeConstants.JJTDA_GD
+ && cn3.getId() == LexerTreeConstants.JJTDA_EFFECT) {
+ action.setConstraint(this.duration_constraint(cn1));
+ action.setCondition(this.da_gd(cn2));
+ action.setEffect(this.da_effect(cn3));
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ this.actionCtx = null;
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_EFFECT</code> node.
+ * @return the durative actionCtx effect expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAND_DA_EFFECT:
+ return this.and_da_effect(cn);
+ case LexerTreeConstants.JJTTIMED_EFFECT:
+ return this.timed_effect(cn);
+ case LexerTreeConstants.JJTFORALL_DA_EFFECT:
+ if (!this.obj.requirements.contains(RequireKey.CONDITIONAL_EFFECTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.CONDITIONAL_EFFECTS
+ + "\" needed to specify conditional durative effect.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.forall_da_effect(cn);
+ case LexerTreeConstants.JJTWHEN_DA_EFFECT:
+ if (!this.obj.requirements.contains(RequireKey.CONDITIONAL_EFFECTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.CONDITIONAL_EFFECTS
+ + "\" needed to specify conditional durative effect.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.when_da_effect(cn);
+ case LexerTreeConstants.JJTDA_ASSIGN_OP:
+ if (!this.obj.requirements.contains(RequireKey.FLUENTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.FLUENTS
+ + "\" needed to specify assign operation in durative actionCtx effect.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.da_assign_op(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_ASSIGN_DA</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_F_ASSIGN_DA_EFFECT</code> node.
+ * @return the durative assign function expression.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AssignOpExp da_assign_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTASSIGN:
+ return this.da_assign(cn);
+ case LexerTreeConstants.JJTSCALE_UP:
+ return this.da_scale_up(cn);
+ case LexerTreeConstants.JJTSCALE_DOWN:
+ return this.da_scale_down(cn);
+ case LexerTreeConstants.JJTINCREASE:
+ return this.da_increase(cn);
+ case LexerTreeConstants.JJTDECREASE:
+ return this.da_decrease(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>WHEN_DA_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>WHEN_DA_EFFECT</code> node.
+ * @return the when duratve actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private WhenExp when_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTDA_GD
+ && cn2.getId() == LexerTreeConstants.JJTTIMED_EFFECT) {
+ Exp cond = this.da_gd(cn1);
+ Exp effect = this.timed_effect(cn2);
+ return new WhenExp(cond, effect);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_DA_EFFECT</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_DA_EFFECT</code> node.
+ * @return the universal durative effect expression structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_da_effect(SimpleNode node) throws ParserException {
+
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTDA_EFFECT) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.da_effect(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>TIMED_EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TIMED_EFFECT</code> node.
+ * @return the timed effect expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp timed_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_DA_EFFECT:
+ return this.at_da_effect(cn);
+ case LexerTreeConstants.JJTAT_F_ASSIGN_DA_EFFECT:
+ return this.at_f_assign_da_effect(cn);
+ case LexerTreeConstants.JJTASSIGN_OP_T:
+ if (!this.obj.requirements.contains(RequireKey.CONDITIONAL_EFFECTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.CONDITIONAL_EFFECTS
+ + "\" needed to specify conditional durative effect.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.assign_op_t(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>ASSIGN_OP_T</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ASSIGN_OP_T</code> node.
+ * @return the durative assign operation expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AssignOpExp assign_op_t(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTINCREASE:
+ return this.increase_assign_op_t(cn);
+ case LexerTreeConstants.JJTDECREASE:
+ return this.decrease_assign_op_t(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DECREASE_ASSIGN_OP_T</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DECREASE_ASSIGN_OP_T</code> node.
+ * @return the decrease durative expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Decrease decrease_assign_op_t(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_T) {
+ return new Decrease(this.f_head(cn1), this.f_exp_t(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>INCREASE_ASSIGN_OP_T</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INCREASE_ASSIGN_OP_T</code> node.
+ * @return the increase durative expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Increase increase_assign_op_t(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_T) {
+ return new Increase(this.f_head(cn1), this.f_exp_t(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_EXP_T</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>F_EXP_T</code> node.
+ * @return the durative fonction expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term f_exp_t(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTCONTINOUS_VARIABLE) {
+ return new Variable(Variable.CONTINOUS_VARIABLE, Type.NUMBER);
+ }
+ } else if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ Variable cv = new Variable(Variable.CONTINOUS_VARIABLE, Type.NUMBER);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTCONTINOUS_VARIABLE) {
+ return new BinaryMultiply(this.f_exp(cn1), cv);
+ } else if (cn1.getId() == LexerTreeConstants.JJTCONTINOUS_VARIABLE
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinaryMultiply(cv, this.f_exp(cn1));
+
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_F_ASSIGN_DA_EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_F_ASSIGN_DA_EFFECT</code> node.
+ * @return the at durative actionCtx effect expression that contains a fonction assign.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtTimedExp at_f_assign_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_END_F_ASSIGN_DA_EFFECT:
+ return this.at_end_f_assign_da_effect(cn);
+ case LexerTreeConstants.JJTAT_START_F_ASSIGN_DA_EFFECT:
+ return this.at_start_f_assign_da_effect(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_START_F_ASSIGN_DA_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_START_F_ASSIGN_DA_EFFECT</code> node.
+ * @return the at start durative actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtStartTimedExp at_start_f_assign_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTF_ASSIGN_DA) {
+ Exp exp = this.f_assign_da(cn);
+ return new AtStartTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_END_F_ASSIGN_DA_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_F_ASSIGN_DA_EFFECT</code> node.
+ * @return the at start durative actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtEndTimedExp at_end_f_assign_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTF_ASSIGN_DA) {
+ Exp exp = this.f_assign_da(cn);
+ return new AtEndTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_ASSIGN_DA</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_F_ASSIGN_DA_EFFECT</code> node.
+ * @return the durative assign function expression.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AssignOpExp f_assign_da(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTASSIGN:
+ return this.da_assign(cn);
+ case LexerTreeConstants.JJTSCALE_UP:
+ return this.da_scale_up(cn);
+ case LexerTreeConstants.JJTSCALE_DOWN:
+ return this.da_scale_down(cn);
+ case LexerTreeConstants.JJTINCREASE:
+ return this.da_increase(cn);
+ case LexerTreeConstants.JJTDECREASE:
+ return this.da_decrease(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>DA_SCALE_UP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_SCALE_UP</code> node.
+ * @return the durative actionCtx assign scale up expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ScaleUp da_scale_up(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new ScaleUp(this.f_head(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_DECREASE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_DECREASE</code> node.
+ * @return the durative actionCtx descrease expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Decrease da_decrease(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new Decrease(this.f_head(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_INCREASE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_INCREASE</code> node.
+ * @return the durative actionCtx increase expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Increase da_increase(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new Increase(this.f_head(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_SCALE_DOWN</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_SCALE_DOWN</code> node.
+ * @return the surative actionCtx assign scale up expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ScaleDown da_scale_down(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new ScaleDown(this.f_head(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_ASSIGN</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_ASSIGN</code> node.
+ * @return the durative assign effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Assign da_assign(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new Assign(this.f_head(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_EXP_DA</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>F_EXP_DA</code> node.
+ * @return the durative fonction expression structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term f_exp_da(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTF_EXP:
+ return this.f_exp(cn);
+ case LexerTreeConstants.JJTDA_BINARY_OP:
+ return this.da_binary_op(cn);
+ case LexerTreeConstants.JJTDA_UNARY_OP:
+ return this.da_unary_op(cn);
+ case LexerTreeConstants.JJTVAR_DURATION:
+ if (!this.obj.requirements.contains(RequireKey.DURATION_INEQUALITIES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.DURATION_INEQUALITIES
+ + "\" needed to specify durative inequalities in actionCtx effect.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return new Variable(Variable.DURATIVE_VARIABLE, Type.NUMBER);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_UNARY_OP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_UNARY_OP</code> node.
+ * @return the durative unary operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp da_unary_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new BinarySubstract(new Number(0.0), this.f_exp_da(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_BINARY_OP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_BINARY_OP</code> node.
+ * @return the surative binary numeric operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp da_binary_op(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTADD_OP:
+ return this.da_add_op(cn);
+ case LexerTreeConstants.JJTSUBSTRACT_OP:
+ return this.da_substract_op(cn);
+ case LexerTreeConstants.JJTMULTIPLY_OP:
+ return this.multiply_op(cn);
+ case LexerTreeConstants.JJTDIVIDE_OP:
+ return this.divide_op(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_ADD_OPERATION</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_ADD_OPERATION</code> node.
+ * @return the add operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryAdd da_add_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP_DA
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new BinaryAdd(this.f_exp_da(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_SUBSTRACT_OP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_SUBSTRACT_OP</code> node.
+ * @return the substract operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinarySubstract da_substract_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP_DA
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new BinarySubstract(this.f_exp_da(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_MULTIPLY_OP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_MULTIPLY_OP</code> node.
+ * @return the durative multiply operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryMultiply da_multiply_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP_DA
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new BinaryMultiply(this.f_exp_da(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_DIVIDE_OP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_DIVIDE_OP</code> node.
+ * @return the durative divide operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryDivide da_divide_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP_DA
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP_DA) {
+ return new BinaryDivide(this.f_exp_da(cn1), this.f_exp_da(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_DA_EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_DA_EFFECT</code> node.
+ * @return the at durative actionCtx effect expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtTimedExp at_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_END_DA_EFFECT:
+ return this.at_end_da_effect(cn);
+ case LexerTreeConstants.JJTAT_START_DA_EFFECT:
+ return this.at_start_da_effect(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_END_DA_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_DA_EFFECT</code> node.
+ * @return the at start durative actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtEndTimedExp at_end_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTLITERAL) {
+ Exp exp = this.literal(cn);
+ return new AtEndTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_START_DA_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_START_DA_EFFECT</code> node.
+ * @return the at start durative actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtStartTimedExp at_start_da_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTLITERAL) {
+ Exp exp = this.literal(cn);
+ return new AtStartTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_DA_EFFECT</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_DA_EFFECT</code> node.
+ * @return the conjunctive durative actionCtx effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_da_effect(SimpleNode node) throws ParserException {
+ AndExp exp = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTDA_EFFECT:
+ exp.add(this.da_effect(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>DA_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DA_GD</code> node.
+ * @return the durative actionCtx goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp da_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTPREF_TIMED_GD:
+ return this.pref_timed_gd(cn);
+ case LexerTreeConstants.JJTAND_DA_GD:
+ return this.and_da_gd(cn);
+ case LexerTreeConstants.JJTFORALL_DA_GD:
+ if (!this.obj.requirements.contains(RequireKey.UNIVERSAL_PRECONDITIONS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.PREFERENCES
+ + "\" needed to specify preferences.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.forall_da_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_DA_GD</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_DA_GD</code> node.
+ * @return the universal duartive actionCtx goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_da_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTDA_GD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.da_gd(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_DA_GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_DA_GD</code> node.
+ * @return the conjunctive durative actionCtx goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_da_gd(SimpleNode node) throws ParserException {
+ AndExp exp = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTDA_GD:
+ exp.add(this.da_gd(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREF_TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREF_TIMED_GD</code> node.
+ * @return the preference timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp pref_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTTIMED_GD:
+ return this.timed_gd(cn);
+ case LexerTreeConstants.JJTNAMED_PREF_TIMED_GD:
+ if (!this.obj.requirements.contains(RequireKey.PREFERENCES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.PREFERENCES
+ + "\" needed to specify preferences.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.named_pref_timed_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>NAMED_PREF_TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>NAMED_PREF_TIMED_GD</code> node.
+ * @return the name preference timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private PrefExp named_pref_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTTIMED_GD) {
+ Exp exp = this.timed_gd(cn1);
+ return new PrefExp(exp);
+ }
+ } else if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTPREF_NAME
+ && cn2.getId() == LexerTreeConstants.JJTPREF_TIMED_GD) {
+ String name = this.pref_name(cn1);
+ Exp exp = this.timed_gd(cn2);
+ return new PrefExp(name, exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TIMED_GD</code> node.
+ * @return the timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_TIMED_GD:
+ return this.at_timed_gd(cn);
+ case LexerTreeConstants.JJTOVER_TIMED_GD:
+ return this.over_timed_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>OVER_TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>OVER_TIMED_GD</code> node.
+ * @return the over timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private OverTimedExp over_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTOVER_ALL_TIMED_GD:
+ return this.over_all_timed_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>OVER_ALL_TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>OVER_ALL_TIMED_GD</code> node.
+ * @return the over all timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private OverTimedExp over_all_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new OverAllTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_TIMED_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_TIMED_GD</code> node.
+ * @return the at timed goal description expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtTimedExp at_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_START_TIMED_GD:
+ return this.at_start_timed_gd(cn);
+ case LexerTreeConstants.JJTAT_END_TIMED_GD:
+ return this.at_end_timed_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_START_TIMED_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_START_TIMED_GD</code> node.
+ * @return the at start timed goal description expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtStartTimedExp at_start_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new AtStartTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_END_TIMED_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_TIMED_GD</code> node.
+ * @return the at end timed goal description expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtEndTimedExp at_end_timed_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new AtEndTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DURATION_CONSTRAINT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DURATION_CONSTRAINT</code> node.
+ * @return the duration constraint expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp duration_constraint(SimpleNode node) throws ParserException {
+ Exp exp = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTEMPTY_OR:
+ exp = this.empty_or(cn);
+ break;
+ case LexerTreeConstants.JJTAND_SIMPLE_DURATION_CONSTRAINT:
+ if (!this.obj.requirements.contains(RequireKey.DURATION_INEQUALITIES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.DURATION_INEQUALITIES
+ + "\" needed to specify conjunction of durative constraints.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ exp = this.and_simple_duration_constraint(cn);
+ break;
+ case LexerTreeConstants.JJTSIMPLE_DURATION_CONSTRAINT:
+ exp = this.simple_duration_constraint(cn);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_SIMPLE_DURATION_CONSTRAINT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_SIMPLE_DURATION_CONSTRAINT</code> node.
+ * @return the conjuncive simple duration constraint expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_simple_duration_constraint(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTSIMPLE_DURATION_CONSTRAINT) {
+ AndExp exp = new AndExp();
+ exp.add(this.simple_duration_constraint(cn));
+ return exp;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SIMPLE_DURATION_CONSTRAINT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SIMPLE_DURATION_CONSTRAINT</code> node.
+ * @return the simple duration constraint expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp simple_duration_constraint(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTD_OP:
+ return this.d_op(cn);
+ case LexerTreeConstants.JJTAT_SIMPLE_DURATION_CONSTRAINT:
+ return this.at_simple_duration_constraint(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_SIMPLE_DURATION_CONSTRAINT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_SIMPLE_DURATION_CONSTRAINT</code> node.
+ * @return the at simple duration constraint expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtTimedExp at_simple_duration_constraint(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAT_END_SIMPLE_DURATION_CONSTRAINT:
+ return this.at_end_simple_duration_constraint(cn);
+ case LexerTreeConstants.JJTAT_START_SIMPLE_DURATION_CONSTRAINT:
+ return this.at_start_simple_duration_constraint(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_END_SIMPLE_DURATION_CONSTRAINT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_SIMPLE_DURATION_CONSTRAINT</code> node.
+ * @return the at end simple durative constraint expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtEndTimedExp at_end_simple_duration_constraint(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTSIMPLE_DURATION_CONSTRAINT) {
+ Exp exp = this.simple_duration_constraint(cn);
+ return new AtEndTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_START_SIMPLE_DURATION_CONSTRAINT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_START_SIMPLE_DURATION_CONSTRAINT</code> node.
+ * @return the at start simple durative constraint expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtStartTimedExp at_start_simple_duration_constraint(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTSIMPLE_DURATION_CONSTRAINT) {
+ Exp exp = this.simple_duration_constraint(cn);
+ return new AtStartTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>D_OP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>D_OP</code> node.
+ * @return the durative operation expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp d_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTGEQUAL_D_OP:
+ if (!this.obj.requirements.contains(RequireKey.DURATION_INEQUALITIES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.DURATION_INEQUALITIES
+ + "\" needed to specify durative inequalitities.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.gequal_d_op(cn);
+ case LexerTreeConstants.JJTLEQUAL_D_OP:
+ if (!this.obj.requirements.contains(RequireKey.DURATION_INEQUALITIES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.DURATION_INEQUALITIES
+ + "\" needed to specify durative inequalitities.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.lequal_d_op(cn);
+ case LexerTreeConstants.JJTEQUAL_D_OP:
+ return this.equal_d_op(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>EQUAL_D_OP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EQUAL_D_OP</code> node.
+ * @return the equal durative operation expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp equal_d_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTVAR_DURATION
+ && cn2.getId() == LexerTreeConstants.JJTD_VALUE) {
+ Variable cv = new Variable(Variable.DURATIVE_VARIABLE, Type.NUMBER);
+ return new EqualComp(cv, this.d_value(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>LEQUAL_D_OP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LEQUAL_D_OP</code> node.
+ * @return the less equal durative operation expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp lequal_d_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTVAR_DURATION
+ && cn2.getId() == LexerTreeConstants.JJTD_VALUE) {
+ Variable cv = new Variable(Variable.DURATIVE_VARIABLE, Type.NUMBER);
+ return new LEqualComp(cv, this.d_value(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>GEQUAL_D_OP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>GEQUAL_D_OP</code> node.
+ * @return the greater equal durative operation expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp gequal_d_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTVAR_DURATION
+ && cn2.getId() == LexerTreeConstants.JJTD_VALUE) {
+ Variable cv = new Variable(Variable.DURATIVE_VARIABLE, Type.NUMBER);
+ return new GEqualComp(cv, this.d_value(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>GEQUAL_D_OP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>D_OP</code> node.
+ * @return the greater equal durative operation expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term d_value(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTNUMBER:
+ return this.number(cn);
+ case LexerTreeConstants.JJTF_EXP:
+ if (!this.obj.requirements.contains(RequireKey.FLUENTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.FLUENTS
+ + "\" needed to specify fluent expressions.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ return this.f_exp(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+
+ /**
+ * Extracts the object structures from the <code>EMPTY_OR</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EMPTY_OR</code> node.
+ * @return the empty or expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private OrExp empty_or(SimpleNode node) throws ParserException {
+ return new OrExp();
+ }
+
+ /**
+ * Extracts the object structures from the <code>DURATION_CONSTRAINT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DURATION_CONSTRAINT</code> node.
+ * @return the duration constraint expression built
+ * @throws ParserException if an error occurs while parsing.
+ */
+
+ /**
+ * Extracts the object structures from the <code>DERIVED_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DERIVED_DEF</code> node.
+ * @return the actionCtx structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private DerivedPredicate derived_def(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTATOMIC_FORMULA
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ AtomicFormula head = this.atomic_formula(cn1);
+ Exp body = this.gd(cn2);
+ DerivedPredicate axiom = new DerivedPredicate(head, body);
+ this.obj.axioms.add(axiom);
+ return axiom;
+ }
+
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ /**
+ * Extracts the object structures from the <code>ACTION_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ACTION_DEF</code> node.
+ * @return the actionCtx structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Action action_def(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 3) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ SimpleNode cn3 = (SimpleNode) node.jjtGetChild(2);
+ if (cn1.getId() == LexerTreeConstants.JJTACTION_NAME
+ && cn2.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn3.getId() == LexerTreeConstants.JJTACTION_DEF_BODY) {
+ Action action = new Action(this.action_name(cn1));
+ LinkedHashMap<String, Variable> parameters = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn2, parameters);
+ for (Variable param : parameters.values()) {
+ action.add(param);
+ }
+ this.action_def_body(cn3, action);
+ if (this.obj.actions.containsKey(action.getName())) {
+ this.mgr.logParserError("Duplicated action \"" + action.getName()
+ + " \"." , this.file, cn1.getLine(), cn1.getColumn());
+ } else {
+ this.obj.actions.put(action.getName(), action);
+ }
+ return action;
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>ACTION_DEF_BODY</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ACTION_DEF_BODY</code> node.
+ * @param action the actionCtx to initialize.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private void action_def_body(SimpleNode node, Action action) throws ParserException {
+ this.actionCtx = action;
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTPRE_GD
+ && cn2.getId() == LexerTreeConstants.JJTEFFECT) {
+ action.setPrecondition(this.pre_gd(cn1));
+ action.setEffect(this.effect(cn2));
+ } else {
+ this.actionCtx = null;
+ }
+ } else {
+ this.actionCtx = null;
+ }
+ this.actionCtx = null;
+ }
+
+ /**
+ * Extracts the object structures from the <code>EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EFFECT</code> node.
+ * @return the effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAND_C_EFFECT:
+ return this.and_c_effect(cn);
+ case LexerTreeConstants.JJTC_EFFECT:
+ return this.c_effect(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Extracts the object structures from the <code>EFFECT</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EFFECT</code> node.
+ * @return the effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp c_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTFORALL_EFFECT:
+ return this.forall_effect(cn);
+ case LexerTreeConstants.JJTWHEN_CON_EFFECT:
+ return this.when_con_effect(cn);
+ case LexerTreeConstants.JJTP_EFFECT:
+ return this.p_effect(cn);
+ case LexerTreeConstants.JJTPROB_EFFECT:
+ return this.prob_effect(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * For cleanliness, this returns an AndExp which is the conjunction of
+ * all the individual probability expressions.
+ *
+ * @param node
+ * @return
+ * @throws ParserException
+ */
+ private ProbExp prob_effect(SimpleNode node) throws ParserException {
+
+ Iterator<SimpleNode> children = node.iterator();
+
+ ProbExp prob_term = new ProbExp();
+
+ for(int i=0; i < node.jjtGetNumChildren(); i++){
+ SimpleNode cn = (SimpleNode)node.jjtGetChild(i);
+ SimpleNode real_cn = (SimpleNode)cn.jjtGetChild(1);
+
+ Exp child = null;
+
+ switch(real_cn.getId()){
+ case LexerTreeConstants.JJTC_EFFECT:
+ child = this.c_effect(real_cn);
+ break;
+ case LexerTreeConstants.JJTAND_C_EFFECT:
+ child = this.and_c_effect(real_cn);
+ break;
+
+ }
+
+ prob_term.addExp(child, this.number(((SimpleNode)cn.jjtGetChild(0))).getValue());
+
+ }
+
+ return prob_term;
+
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>WHEN_CON_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>WHEN_CON_EFFECT</code> node.
+ * @return the when effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private WhenExp when_con_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTGD
+ && cn2.getId() == LexerTreeConstants.JJTCOND_EFFECT) {
+ Exp cond = this.gd(cn1);
+ Exp effect = this.cond_effect(cn2);
+ return new WhenExp(cond, effect);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>WHEN_C_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>WHEN_C_EFFECT</code> node.
+ * @return the when effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp cond_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAND_P_EFFECT:
+ return this.and_p_effect(cn);
+ case LexerTreeConstants.JJTP_EFFECT:
+ return this.p_effect(cn);
+ case LexerTreeConstants.JJTAND_C_EFFECT:
+ return this.and_c_effect(cn);
+ case LexerTreeConstants.JJTC_EFFECT:
+ return this.c_effect(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_P_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_P_EFFECT</code> node.
+ * @return the conjuncive propositional effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_p_effect(SimpleNode node) throws ParserException {
+ AndExp exp = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTP_EFFECT:
+ exp.add(this.p_effect(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>P_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>P_EFFECT</code> node.
+ * @return the propositional effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp p_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTASSIGN_OP:
+ if (!this.obj.requirements.contains(RequireKey.FLUENTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.FLUENTS
+ + "\" missing.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ return this.assign_op(cn);
+ case LexerTreeConstants.JJTLITERAL:
+ return this.literal(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ASSIGN_OP_EXP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ASSIGN_OP_EXP</code> node.
+ * @return the assign operation expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AssignOpExp assign_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTASSIGN:
+ return this.assign(cn);
+ case LexerTreeConstants.JJTSCALE_UP:
+ return this.scale_up(cn);
+ case LexerTreeConstants.JJTSCALE_DOWN:
+ return this.scale_down(cn);
+ case LexerTreeConstants.JJTINCREASE:
+ return this.increase(cn);
+ case LexerTreeConstants.JJTDECREASE:
+ return this.decrease(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SCALE_UP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SCALE_UP</code> node.
+ * @return the assign scale up expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ScaleUp scale_up(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new ScaleUp(this.f_head(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DECREASE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DECREASE</code> node.
+ * @return the descrease expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Decrease decrease(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new Decrease(this.f_head(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>INCREASE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>INCREASE</code> node.
+ * @return the increase expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Increase increase(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new Increase(this.f_head(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SCALE_DOWN</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SCALE_DOWN</code> node.
+ * @return the assign scale up expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ScaleDown scale_down(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new ScaleDown(this.f_head(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ASSIGN</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ASSIGN</code> node.
+ * @return the propositional effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Assign assign(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_HEAD
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new Assign(this.f_head(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_C_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_C_EFFECT</code> node.
+ * @return the universal effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_effect(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTEFFECT) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.effect(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_C_EFFECT</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_C_EFFECT</code> node.
+ * @return the conjuncive effect expression built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_c_effect(SimpleNode node) throws ParserException {
+ AndExp effect = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ if (cn.getId() == LexerTreeConstants.JJTC_EFFECT) {
+ effect.add(this.c_effect(cn));
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+ return effect;
+ }
+
+ /**
+ * Extracts the object structures from the <code>PRE_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PRE_GD</code> node.
+ * @return the precondition goal description built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp pre_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTEMPTY_OR:
+ return this.empty_or(cn);
+ case LexerTreeConstants.JJTPREF_GD:
+ return this.pref_gd(cn);
+ case LexerTreeConstants.JJTAND_PRE_GD:
+ return this.and_pre_gd(cn);
+ case LexerTreeConstants.JJTFORALL_PRE_GD:
+ if (!this.obj.requirements.contains(RequireKey.UNIVERSAL_PRECONDITIONS)
+ && !this.obj.requirements.contains(RequireKey.QUANTIFIED_PRECONDITIONS)) {
+ this.mgr.logParserError("Universal formula cannot be defined without require keys \""
+ + RequireKey.UNIVERSAL_PRECONDITIONS
+ + "\" or \""
+ + RequireKey.QUANTIFIED_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ return this.forall_pre_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_PRE_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_PRE_GD</code> node.
+ * @return the universal precondition goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_pre_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTPRE_GD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.pre_gd(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_PRE_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_PRE_GD</code> node.
+ * @return the conjuncive precondition goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_pre_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTPRE_GD) {
+ AndExp pre_gd = new AndExp();
+ pre_gd.add(this.pre_gd(cn));
+ return pre_gd;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREF_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREF_GD</code> node.
+ * @return the precondition goal description built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp pref_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTNAMED_PREF_GD:
+ return this.named_pref_gd(cn);
+ case LexerTreeConstants.JJTGD:
+ return this.gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREF_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREF_GD</code> node.
+ * @return the precondition goal description built
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp named_pref_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn1);
+ return new PrefExp(exp);
+ }
+ } else if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTPREF_NAME
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ String name = this.pref_name(cn1);
+ Exp exp = this.gd(cn2);
+ return new PrefExp(name, exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ACTION_NAME</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ACTION_NAME</code> node.
+ * @return the actionCtx name structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private String action_name(SimpleNode node) throws ParserException {
+ return node.getImage();
+ }
+
+ /**
+ * Extracts the object structures from the <code>REQUIRE_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>REQUIRE_DEF</code> node.
+ * @return the require definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<RequireKey> requireDef(SimpleNode node) throws ParserException {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTREQUIRE_KEY:
+ RequireKey rk = RequireKey.getRequireKey(cn.getImage());
+
+ if (rk == null) {
+ this.mgr.logParserError("Invalid require key \"" + cn.getImage() + "\".",
+ file, node.getLine(), node.getColumn());
+ } else if (rk != null && this.options.get(rk) == null) {
+ this.mgr.logParserError("Require key \"" + rk.getImage()
+ + "\" forbidden due to parser requirement options." ,
+ file, cn.getLine(), cn.getColumn());
+ } else {
+ if (rk.equals(RequireKey.ADL)) {
+ obj.requirements.add(RequireKey.ADL);
+ obj.requirements.add(RequireKey.STRIPS);
+ obj.requirements.add(RequireKey.TYPING);
+ obj.requirements.add(RequireKey.EXISTENTIAL_PRECONDITIONS);
+ obj.requirements.add(RequireKey.UNIVERSAL_PRECONDITIONS);
+ obj.requirements.add(RequireKey.QUANTIFIED_PRECONDITIONS);
+ obj.requirements.add(RequireKey.CONDITIONAL_EFFECTS);
+ obj.requirements.add(RequireKey.DISJUNCTIVE_PRECONDITIONS);
+ obj.requirements.add(RequireKey.EQUALITY);
+ obj.requirements.add(RequireKey.FLUENTS);
+ obj.requirements.add(RequireKey.NEGATIVE_PRECONDITIONS);
+ } else if (rk.equals(RequireKey.QUANTIFIED_PRECONDITIONS)) {
+ obj.requirements.add(RequireKey.QUANTIFIED_PRECONDITIONS);
+ obj.requirements.add(RequireKey.EXISTENTIAL_PRECONDITIONS);
+ obj.requirements.add(RequireKey.UNIVERSAL_PRECONDITIONS);
+ } else {
+ obj.requirements.add(rk);
+ }
+ }
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj.requirements;
+ }
+
+ /**
+ * Extracts the object structures from the <code>TYPE_DEF</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPE_DEF</code> node.
+ * @return the type definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Set<String>> types_def(SimpleNode node) throws ParserException {
+ if (!this.obj.requirements.contains(RequireKey.TYPING)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.TYPING
+ + "\" needed to specify typed terms.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTTYPED_LIST:
+ this.type_typed_list(cn, obj.types);
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj.types;
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>TYPED_LIST</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPED_LIST</code> node.
+ * @param tl the types list of primitive type already built.
+ * @return the typed list structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Set<String>> type_typed_list(SimpleNode node,
+ Map<String, Set<String>> tl) throws ParserException {
+ boolean typed = false;
+ Set<String> ptl = new LinkedHashSet<String>();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTPRIMITIVE_TYPE:
+ String pt = primitive_type(cn);
+ if (pt.equals(Type.NUMBER_SYMBOL) || pt.equals(Type.OBJECT_SYMBOL)) {
+ this.mgr.logParserError("Type \"" + pt + "\" is a reserved type.",
+ this.file, cn.getLine(), cn.getColumn());
+ } else if (tl.containsKey(pt)) {
+ this.mgr.logParserError("Type \"" + pt + "\" duplicated definition.",
+ this.file, cn.getLine(), cn.getColumn());
+ } else {
+ tl.put(pt, new LinkedHashSet<String>());
+ ptl.add(pt);
+ }
+ break;
+ case LexerTreeConstants.JJTTYPE:
+ typed = true;
+ Set<String> type = type(cn);
+ for (String pti : type) {
+ if (pti.equals(Type.NUMBER_SYMBOL)) {
+ this.mgr.logParserError("Type \"" + pti + "\" not allow in type declaration.",
+ this.file, node.getLine(), node.getColumn());
+ } else if (!tl.containsKey(pti)) {
+ this.mgr.logParserError("Type \"" + pti + "\" undefinied.",
+ this.file, node.getLine(), node.getColumn());
+ } else {
+ Set<String> ti = tl.get(pti);
+ ti.addAll(ptl);
+ }
+ }
+ break;
+ case LexerTreeConstants.JJTTYPED_LIST:
+ if (!this.obj.requirements.contains(RequireKey.TYPING)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.TYPING
+ + "\" needed to specify types.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ Map<String, Set<String>> typed_list = this.type_typed_list(cn, tl);
+ tl.putAll(typed_list);
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ if (!typed) {
+ Set<String> obj = tl.get(Type.OBJECT_SYMBOL);
+ for (String t : tl.keySet()) {
+ if (!t.equals(Type.NUMBER_SYMBOL) && !t.equals(Type.OBJECT_SYMBOL)) {
+ obj.add(t);
+ }
+ }
+
+ }
+ return tl;
+ }
+
+
+
+ /**
+ * Extracts the object structures from the <code>TYPED_LIST</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPED_LIST</code> node.
+ * @param tl the typed list of variables already built.
+ * @return the typed list structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Variable> var_typed_list(SimpleNode node,
+ LinkedHashMap<String, Variable> tl) throws ParserException {
+ List<Variable> vtl = new ArrayList<Variable>();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTVARIABLE:
+ Variable v = this.variable(cn);
+ if (tl.containsKey(v.getImage())) {
+ this.mgr.logParserError("Variable \"" + v + "\" duplicated definition.",
+ this.file, cn.getLine(), cn.getColumn());
+ } else {
+ vtl.add(v);
+ tl.put(v.getImage(), v);
+ }
+
+ break;
+ case LexerTreeConstants.JJTTYPE:
+ Set<String> type = type(cn);
+ TypeSet newType = new TypeSet();
+ for (String pti : type) {
+ if (pti.equals(Type.NUMBER_SYMBOL)) {
+ this.mgr.logParserError("Type \"" + pti + "\" not allow in type declaration.",
+ this.file, node.getLine(), node.getColumn());
+ } else if (!this.obj.types.containsKey(pti)) {
+ this.mgr.logParserError("Type \"" + pti + "\" undefinied.",
+ this.file, node.getLine(), node.getColumn());
+ } else {
+ newType.add(new Type(pti, obj.types));
+ }
+ }
+ for (Variable vi : vtl) {
+ vi.setTypeSet(newType);
+ }
+ break;
+ case LexerTreeConstants.JJTTYPED_LIST:
+
+ if (!this.obj.requirements.contains(RequireKey.TYPING)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.TYPING
+ + "\" needed to specify typed variables.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ this.var_typed_list(cn, tl);
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return tl;
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>TYPED_LIST</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPED_LIST</code> node.
+ * @param tl the typed list of constants already built.
+ * @return the typed list structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Constant> constant_typed_list(SimpleNode node,
+ Map<String, Constant> tl) throws ParserException {
+ List<Constant> ctl = new ArrayList<Constant>();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTCONSTANT:
+ Constant c = this.constant(cn);
+ if (tl.containsKey(c.getImage())) {
+ this.mgr.logParserError("Constant \"" + c + "\" duplicated definition.",
+ this.file, cn.getLine(), cn.getColumn());
+ } else {
+ ctl.add(c);
+ tl.put(c.getImage(), c);
+ }
+ break;
+ case LexerTreeConstants.JJTTYPE:
+ Set<String> type = type(cn);
+ TypeSet newType = new TypeSet();
+ for (String pti : type) {
+ if (pti.equals(Type.NUMBER_SYMBOL)) {
+ this.mgr.logParserError("Type \"" + pti + "\" not allow in type declaration.",
+ this.file, node.getLine(), node.getColumn());
+ } else if (!this.obj.types.containsKey(pti)
+ && !this.obj.getContent().equals(PDDLObject.Content.PARTIAL_PROBLEM)) {
+ this.mgr.logParserError("Type \"" + pti + "\" undefinied.",
+ this.file, node.getLine(), node.getColumn());
+ } else {
+ newType.add(new Type(pti, obj.types));
+ }
+ }
+ for (Constant ci : ctl) {
+ ci.setTypeSet(newType);
+ }
+ break;
+ case LexerTreeConstants.JJTTYPED_LIST:
+ if (!this.obj.requirements.contains(RequireKey.TYPING)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.TYPING
+ + "\" needed to specify typed constants.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ this.constant_typed_list(cn, tl);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return tl;
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>PRIMITIVE_TYPE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PRIMITIVE_TYPE</code> node.
+ * @return the primitive type structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private String primitive_type(SimpleNode node) throws ParserException {
+ return node.getImage();
+ }
+
+
+ /**
+ * Extracts the object structures from the <code>TYPE</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPE</code> node.
+ * @return the type structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<String> type(SimpleNode node) throws ParserException {
+ Set<String> type = new LinkedHashSet<String>();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ if (cn.getId() == LexerTreeConstants.JJTPRIMITIVE_TYPE) {
+ type.add(this.primitive_type(cn));
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+ return type;
+ }
+
+ /**
+ * Extracts the object structures from the <code>CONSTANTS_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>CONSTANTS_DEF</code> node.
+ * @return the constants definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Map<String, Constant> constants_def(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTTYPED_LIST) {
+ this.constantDef = true;
+ this.constant_typed_list(cn, obj.constants);
+ for (Constant cst : obj.constants.values()) {
+ for (Type pt : cst.getTypeSet()) {
+ Set<Constant> domain = this.obj.typeDomains.get(pt);
+ if (domain == null) {
+ domain = new LinkedHashSet<Constant>();
+ }
+ domain.add(cst);
+ }
+ }
+ this.constantDef = false;
+ return obj.constants;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>CONSTANT</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>CONSTANT</code> node.
+ * @return the constant structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Constant constant(SimpleNode node) throws ParserException {
+ Constant cons = new Constant(node.getImage(), new Type(Type.OBJECT_SYMBOL, obj.types));
+ if (!this.constantDef) {
+ Constant cst = this.obj.constants.get(cons.getImage());
+ if (cst == null) {
+ this.mgr.logParserError("Constant \"" + cons +"\" undefined." ,
+ this.file, node.getLine(), node.getColumn());
+ } else {
+ cons = cst;
+ }
+ }
+ return cons;
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREDICATES_DEF</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREDICATES_DEF</code> node.
+ * @return the predicates definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<AtomicFormula> predicates_def(SimpleNode node) throws ParserException {
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTATOMIC_FORMULA_SKELETON:
+ obj.predicates.add(this.atomic_formula_skeleton(cn));
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj.predicates;
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREDICATES_DEF</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREDICATES_DEF</code> node.
+ * @return the predicates definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtomicFormula atomic_formula_skeleton(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTPREDICATE
+ && cn2.getId() == LexerTreeConstants.JJTTYPED_LIST) {
+ AtomicFormula afs = new AtomicFormula(this.predicate(cn1));
+ LinkedHashMap<String, Variable> arguments = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn2, arguments);
+ for (Variable arg : arguments.values()) {
+ afs.add(arg);
+ }
+ return afs;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREDICATE</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREDICATE</code> node.
+ * @return the predicate structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private String predicate(SimpleNode node) throws ParserException {
+ return node.getImage();
+ }
+
+ /**
+ * Extracts the object structures from the <code>FUNCTIONS_DEF</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FUNCTIONS_DEF</code> node.
+ * @return the functions definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<FHead> functions_def(SimpleNode node) throws ParserException {
+ if (!this.obj.requirements.contains(RequireKey.FLUENTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.FLUENTS
+ + "\" needed to defined functions.", this.file, node.getLine(),
+ node.getColumn());
+ }
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTFUNCTION_TYPED_LIST:
+ this.atomic_function_skeleton_typed_list(cn, obj.functions);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return obj.functions;
+ }
+
+ /**
+ * Extracts the object structures from the <code>TYPED_LIST</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TYPED_LIST</code> node.
+ * @param tl the typed list of constants already built.
+ * @return the typed list structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<FHead> atomic_function_skeleton_typed_list(
+ SimpleNode node, Set<FHead> tl)
+ throws ParserException {
+ List<FHead> atftl = new ArrayList<FHead>();
+ TypeSet number = new TypeSet();
+ number.add(Type.NUMBER);
+
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTATOMIC_FUNCTION_SKELETON:
+ FHead func = this.atomic_function_skeleton(cn);
+ func.setTypeSet(number);
+ tl.add(func);
+ break;
+ case LexerTreeConstants.JJTFUNCTION_TYPE:
+ if (!cn.getImage().equals(Type.NUMBER_SYMBOL)) {
+ this.mgr.logParserError("FExp can be only typed as number.",
+ this.file, node.getLine(), node.getColumn());
+ }
+ break;
+ case LexerTreeConstants.JJTFUNCTION_TYPED_LIST:
+ if (!this.obj.requirements.contains(RequireKey.TYPING)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.TYPING
+ + "\" needed to specify typed functions.", this.file,
+ node.getLine(), node.getColumn());
+ }
+ this.atomic_function_skeleton_typed_list(cn, tl);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return tl;
+ }
+
+
+ /**
+ * Extracts the object structures from the
+ * <code>ATOMIC_FUNCTION_SKELETON</code> node of the syntaxic tree and
+ * implements the semantic check.
+ *
+ * @param node the <code>ATOMIC_FUNCTION_SKELETON</code> node.
+ * @return the atomic function skeleton structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FHead atomic_function_skeleton(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTFUNCTOR
+ && cn2.getId() == LexerTreeConstants.JJTTYPED_LIST) {
+ FHead afs = new FHead(this.functor(cn1), Type.NUMBER);
+ LinkedHashMap<String, Variable> arguments = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn2, arguments);
+ for (Variable arg : arguments.values()) {
+ afs.add(arg);
+ }
+ return afs;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FUNCTOR</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FUNCTOR</code> node.
+ * @return the functor structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private String functor(SimpleNode node) throws ParserException {
+ return node.getImage();
+ }
+
+ /**
+ * Extracts the object structures from the <code>TERM</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TERM</code> node.
+ * @return the exp structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Variable variable(SimpleNode node) throws ParserException {
+ Variable var = new Variable(node.getImage(), new Type(Type.OBJECT_SYMBOL, obj.types));
+ if (this.actionCtx != null) {
+ TypeSet qt = null;
+ if (this.quantifiedExpCtx != null) {
+ Iterator<Variable> i = this.quantifiedExpCtx.iterator();
+ while (i.hasNext() && qt == null) {
+ Variable vi = i.next();
+ if (var.getImage().equals(vi.getImage())) {
+ qt = vi.getTypeSet();
+ }
+ }
+ }
+ TypeSet pt = null;
+ if (this.actionCtx != null) {
+ Iterator<Term> i = this.actionCtx.iterator();
+ while (i.hasNext() && pt == null) {
+ Term ti = i.next();
+ if (var.getImage().equals(ti.getImage())) {
+ pt = ti.getTypeSet();
+ }
+ }
+ }
+ if (qt == null && pt == null) {
+ this.mgr.logParserError("Variable \"" + var +"\" undefined in action \""
+ + this.actionCtx.getName() + "\".",
+ this.file, node.getLine(), node.getColumn());
+ } else if (qt != null && pt != null && !qt.equals(pt)) {
+ this.mgr.logParserError("Variable \"" + var +"\" conflicted type in action \""
+ + this.actionCtx.getName() + "\".",
+ this.file, node.getLine(), node.getColumn());
+ } else {
+ if (qt != null) {
+ var.setTypeSet(qt);
+ } else {
+ var.setTypeSet(pt);
+ }
+ }
+ }
+ return var;
+
+ }
+
+ /**
+ * Extracts the object structures from the <code>CONSTRAINTS</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>CONSTRAINTS</code> node.
+ * @return the constraints definition structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Set<Exp> constraints(SimpleNode node) throws ParserException {
+ if (!this.obj.requirements.contains(RequireKey.CONSTRAINTS)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.CONSTRAINTS
+ + "\" missing to define constraints.", this.file,
+ node.getLine(),
+ node.getColumn());
+ }
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTPREF_CON_GD) {
+ obj.constraints.add(this.pref_con_gd(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREF_CON_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREF_CON_GD</code> node.
+ * @return the conditional goal description preference structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp pref_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAND_PREF_CON_GD:
+ return this.and_pref_con_gd(cn);
+ case LexerTreeConstants.JJTFORALL_PREF_CON_GD:
+ return this.forall_pref_con_gd(cn);
+ case LexerTreeConstants.JJTNAMED_PREF_CON_GD:
+ return this.named_pref_con_gd(cn);
+ case LexerTreeConstants.JJTCON_GD:
+ return this.con_gd(cn);
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_PREF_CON_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_PREF_CON_GD</code> node.
+ * @return the and condition goal description preference structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_pref_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTPREF_CON_GD) {
+ AndExp pre_con_gd = new AndExp();
+ pre_con_gd.add(this.pref_con_gd(cn));
+ return pre_con_gd;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_PREF_CON_GD</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_PREF_CON_GD</code> node.
+ * @return the forall condition goal description preference structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_pref_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTPREF_CON_GD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.pref_con_gd(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREFERENCE</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREFERENCE</code> node.
+ * @return the preference structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private PrefExp named_pref_con_gd(SimpleNode node) throws ParserException {
+ if (!this.obj.requirements.contains(RequireKey.PREFERENCES)) {
+ this.mgr.logParserError("Require key \"" + RequireKey.PREFERENCES
+ + "\" missing.", this.file, node.getLine(), node.getColumn());
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTCON_GD) {
+ Exp exp = this.con_gd(cn1);
+ return new PrefExp(exp);
+ }
+
+ } else if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTPREF_NAME
+ && cn2.getId() == LexerTreeConstants.JJTCON_GD) {
+ String name = this.pref_name(cn1);
+ Exp exp = this.con_gd(cn2);
+ return new PrefExp(name, exp);
+ }
+ } else {
+ throw new ParserException("aAn internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("1An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+
+ }
+
+ /**
+ * Extracts the object structures from the <code>PREF_NAME</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>PREF_NAME</code> node.
+ * @return the preference image structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private String pref_name(SimpleNode node) throws ParserException {
+ return node.getImage();
+ }
+
+ /**
+ * Extracts the object structures from the <code>CON_GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>CON_GD</code> node.
+ * @return the conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp con_gd(SimpleNode node) throws ParserException {
+ Exp exp = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTAND_CON_GD:
+ exp = this.and_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTFORALL_CON_GD:
+ exp = this.forall_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTAT_END_CON_GD:
+ exp = this.at_end_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTALWAYS_CON_GD:
+ exp = this.always_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTSOMETIME_CON_GD:
+ exp = this.sometime_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTWITHIN_CON_GD:
+ exp = this.within_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTAT_MOST_ONCE_CON_GD:
+ exp = this.at_most_once_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTSOMETIME_AFTER_CON_GD:
+ exp = this.sometime_after_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTSOMETIME_BEFORE_CON_GD:
+ exp = this.sometime_before_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTALWAYS_WITHIN_CON_GD:
+ exp = this.always_within_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTHOLD_DURING_CON_GD:
+ exp = this.hold_during_con_gd(cn);
+ break;
+ case LexerTreeConstants.JJTHOLD_AFTER_CON_GD:
+ exp = this.hold_after_con_gd(cn);
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>HOLD_AFTER</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>HOLD_AFTER</code> node.
+ * @return the "hold after" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private HoldAfterExp hold_after_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Number time = this.number(cn1);
+ Exp exp = this.gd(cn2);
+ return new HoldAfterExp(exp, time);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>HOLD_DURING</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>HOLD_DURING</code> node.
+ * @return the "hold during" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private HoldDuringExp hold_during_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 3) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ SimpleNode cn3 = (SimpleNode) node.jjtGetChild(2);
+ if (cn1.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Number lt = this.number(cn1);
+ Number ut = this.number(cn2);
+ Exp exp = this.gd(cn3);
+ return new HoldDuringExp(lt, ut, exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ALWAYS_WITHIN</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ALWAYS_WITHIN</code> node.
+ * @return the "always within" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AlwaysWithinExp always_within_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 3) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ SimpleNode cn3 = (SimpleNode) node.jjtGetChild(2);
+ if (cn1.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTGD
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Number time = this.number(cn1);
+ Exp arg1 = this.gd(cn2);
+ Exp arg2 = this.gd(cn3);
+ return new AlwaysWithinExp(arg1, arg2, time);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SOMETIME_BEFORE</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SOMETIME_BEFORE</code> node.
+ * @return the "sometime before" conditional goal description structure
+ * built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private SometimeBeforeExp sometime_before_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTGD
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Exp arg1 = this.gd(cn1);
+ Exp arg2 = this.gd(cn2);
+ return new SometimeBeforeExp(arg1, arg2);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SOMETIME_AFTER</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SOMETIME_AFTER</code> node.
+ * @return the "sometime after" conditional goal description structure
+ * built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private SometimeAfterExp sometime_after_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTGD
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Exp arg1 = this.gd(cn1);
+ Exp arg2 = this.gd(cn2);
+ return new SometimeAfterExp(arg1, arg2);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_MOST_ONCE</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_MOST_ONCE</code> node.
+ * @return the "at most once" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtMostOnceExp at_most_once_con_gd(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new AtMostOnceExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>WITHIN</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>WITHIN</code> node.
+ * @return the "within" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private WithinExp within_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTNUMBER
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Number time = this.number(cn1);
+ Exp exp = this.gd(cn2);
+ return new WithinExp(exp, time);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SOMETIME</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SOMETIME</code> node.
+ * @return the "sometime" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private SometimeExp sometime_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new SometimeExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ALWAYS</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ALWAYS</code> node.
+ * @return the "always" conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AlwaysExp always_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ Exp exp = this.gd(cn);
+ return new AlwaysExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_CON_GD</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_CON_GD</code> node.
+ * @return the and conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_con_gd(SimpleNode node) throws ParserException {
+ AndExp and = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTCON_GD:
+ and.add(this.con_gd(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return and;
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_CON_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_CON_GD</code> node.
+ * @return the universal conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTCON_GD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.con_gd(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>AT_END_CON_GD</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AT_END_CON_GD</code> node.
+ * @return the at end conditional goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtEndTimedExp at_end_con_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTCON_GD) {
+ Exp exp = this.gd(cn);
+ return new AtEndTimedExp(exp);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>GD</code> node.
+ * @return the goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Exp gd(SimpleNode node) throws ParserException {
+ Exp exp = null;
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTATOMIC_FORMULA:
+ exp = this.atomic_formula(cn);
+ break;
+ case LexerTreeConstants.JJTAND_GD:
+ exp = this.and_gd(cn);
+ break;
+ case LexerTreeConstants.JJTOR_GD:
+ if (!this.obj.requirements.contains(RequireKey.DISJUNCTIVE_PRECONDITIONS)) {
+ this.mgr.logParserError("Disjunctive formula cannot be defined without require key \""
+ + RequireKey.DISJUNCTIVE_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ exp = this.or_gd(cn);
+ break;
+ case LexerTreeConstants.JJTNOT_GD:
+ NotExp notExp = this.not_gd(cn);
+ if (!notExp.getExp().getExpID().equals(ExpID.F_COMP) && !this.obj.requirements.contains(RequireKey.NEGATIVE_PRECONDITIONS)) {
+ this.mgr.logParserError("Negative formula cannot be defined without require key \""
+ + RequireKey.NEGATIVE_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ exp = notExp;
+ break;
+ case LexerTreeConstants.JJTIMPLY_GD:
+ if (!this.obj.requirements.contains(RequireKey.DISJUNCTIVE_PRECONDITIONS)) {
+ this.mgr.logParserError("Implication formula cannot be defined without require key \""
+ + RequireKey.DISJUNCTIVE_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ exp = this.imply_gd(cn);
+ break;
+ case LexerTreeConstants.JJTFORALL_GD:
+ if (!this.obj.requirements.contains(RequireKey.UNIVERSAL_PRECONDITIONS)
+ && !this.obj.requirements.contains(RequireKey.QUANTIFIED_PRECONDITIONS)) {
+ this.mgr.logParserError("Universal formula cannot be defined without require keys \""
+ + RequireKey.UNIVERSAL_PRECONDITIONS
+ + "\" or \""
+ + RequireKey.QUANTIFIED_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ exp = this.forall_gd(cn);
+ break;
+ case LexerTreeConstants.JJTEXISTS_GD:
+ if (!this.obj.requirements.contains(RequireKey.EXISTENTIAL_PRECONDITIONS)
+ && !this.obj.requirements.contains(RequireKey.QUANTIFIED_PRECONDITIONS)) {
+ this.mgr.logParserError("Existential formula cannot be defined without require keys \""
+ + RequireKey.EXISTENTIAL_PRECONDITIONS
+ + "\" or \""
+ + RequireKey.QUANTIFIED_PRECONDITIONS
+ + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ exp = this.exists_gd(cn);
+ break;
+ case LexerTreeConstants.JJTF_COMP:
+ FCompExp fCompExp = this.f_comp(cn);
+ if (!this.obj.requirements.contains(RequireKey.FLUENTS)) {
+ if (!(fCompExp.getOp().equals(Comp.EQUAL)
+ && fCompExp.getArg1().getExpID().equals(ExpID.TERM)
+ && fCompExp.getArg2().getExpID().equals(ExpID.TERM)
+ && this.obj.requirements.contains(RequireKey.EQUALITY))) {
+ this.mgr.logParserError("FExp expression cannot be defined without require keys \""
+ + RequireKey.FLUENTS + "\" or \"" +RequireKey.EQUALITY + "\".", this.file, node.getLine(), node.getColumn());
+ }
+ }
+ exp = fCompExp;
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>FCOMP</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FCOMP</code> node.
+ * @return the comparaison function structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp f_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTBINARY_COMP) {
+ return this.binary_comp(cn);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>BINARY_COMP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>BINARY_COMP</code> node.
+ * @return the binray numeric operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FCompExp binary_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTGREATER_COMP:
+ return this.greater_comp(cn);
+ case LexerTreeConstants.JJTGREATER_EQUAL_COMP:
+ return this.greater_equal_comp(cn);
+ case LexerTreeConstants.JJTLESS_COMP:
+ return this.less_comp(cn);
+ case LexerTreeConstants.JJTLESS_EQUAL_COMP:
+ return this.less_equal_comp(cn);
+ case LexerTreeConstants.JJTEQUAL_COMP:
+ return this.equal_comp(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>GREATER_COMP</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>GREATER_COMP</code> node.
+ * @return the greater compraison structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private GreaterComp greater_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new GreaterComp(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>LESS_COMP</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LESS_COMP</code> node.
+ * @return the less compraison structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private LessComp less_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new LessComp(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>EQUAL_COMP</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EQUAL_COMP</code> node.
+ * @return the equal compraison structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private EqualComp equal_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new EqualComp(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>GREATER_EQUAL_COMP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>GREATER_EQUAL_COMP</code> node.
+ * @return the greater equal compraison structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private GEqualComp greater_equal_comp(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new GEqualComp(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>LESS_EQUAL_COMP</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LESS_EQUAL_COMP</code> node.
+ * @return the less equal compraison structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private LEqualComp less_equal_comp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new LEqualComp(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_EXP</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>F_EXP</code> node.
+ * @return the fonction expression structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term f_exp(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTNUMBER:
+ return this.number(cn);
+ case LexerTreeConstants.JJTOP:
+ return this.op(cn);
+ case LexerTreeConstants.JJTF_HEAD:
+ return this.f_head(cn);
+ case LexerTreeConstants.JJTVARIABLE:
+ return this.variable(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>F_HEAD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>F_HEAD</code> node.
+ * @return the function head structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private FHead f_head(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() > 0) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTFUNCTOR) {
+ FHead f_head = new FHead(this.functor(cn1), Type.NUMBER);
+ for (int i = 1; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTTERM:
+ f_head.add(this.term(cn));
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel()
+ + " unexpected.");
+ }
+ }
+ return f_head;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>OPERATION</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>OPERATION</code> node.
+ * @return the operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTBINARY_OPERATION:
+ return this.binary_operation(cn);
+ case LexerTreeConstants.JJTUNARY_OP:
+ return this.unary_operation(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>UNARY_OPERATION</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>UNARY_OPERATION</code> node.
+ * @return the unary operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp unary_operation(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinarySubstract(new Number(0.0), this.f_exp(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>BINRAY_OPERATION</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>BINRAY_OPERATION</code> node.
+ * @return the binray numeric operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryOp binary_operation(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTADD_OP:
+ return this.add_op(cn);
+ case LexerTreeConstants.JJTSUBSTRACT_OP:
+ return this.substract_op(cn);
+ case LexerTreeConstants.JJTMULTIPLY_OP:
+ return this.multiply_op(cn);
+ case LexerTreeConstants.JJTDIVIDE_OP:
+ return this.divide_op(cn);
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ADD_OPERATION</code> node
+ * of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ADD_OPERATION</code> node.
+ * @return the add operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryAdd add_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinaryAdd(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>SUBSTRACT_OPERATION</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>SUBSTRACT_OPERATION</code> node.
+ * @return the substract operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinarySubstract substract_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinarySubstract(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>MULTIPLY_OPERATION</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>MULTIPLY_OPERATION</code> node.
+ * @return the multiply operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryMultiply multiply_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinaryMultiply(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>DIVIDE_OPERATION</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>DIVIDE_OPERATION</code> node.
+ * @return the divide operation structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private BinaryDivide divide_op(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTF_EXP
+ && cn2.getId() == LexerTreeConstants.JJTF_EXP) {
+ return new BinaryDivide(this.f_exp(cn1), this.f_exp(cn2));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>NUMBER</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>NUMBER</code> node.
+ * @return the number structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Number number(SimpleNode node) throws ParserException {
+ return new Number(Double.valueOf(node.getImage()));
+ }
+
+ /**
+ * Extracts the object structures from the <code>AND_GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>AND_GD</code> node.
+ * @return the conjunctive goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AndExp and_gd(SimpleNode node) throws ParserException {
+ AndExp exp = new AndExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTGD:
+ exp.add(this.gd(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>OR_GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>OR_GD</code> node.
+ * @return the disjunctive goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private OrExp or_gd(SimpleNode node) throws ParserException {
+ OrExp exp = new OrExp();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTGD:
+ exp.add(this.gd(cn));
+ break;
+ default:
+ throw new ParserException(
+ "An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>NOT_GD</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>NOT_GD</code> node.
+ * @return the negative goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private NotExp not_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTGD) {
+ return new NotExp(this.gd(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>IMPLY_GD</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>IMPLY_GD</code> node.
+ * @return the implicative goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ImplyExp imply_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTGD
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ Exp head = this.gd(cn1);
+ Exp body = this.gd(cn2);
+ return new ImplyExp(head, body);
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>FORALL_GD</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>FORALL_GD</code> node.
+ * @return the universal goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ForallExp forall_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ForallExp forall = new ForallExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ forall.add(var);
+ }
+ this.quantifiedExpCtx = forall;
+ Exp exp = this.gd(cn2);
+ forall.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return forall;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>EXISTS_GD</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>EXISTS_GD</code> node.
+ * @return the existential goal description structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private ExistsExp exists_gd(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() == 2) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ SimpleNode cn2 = (SimpleNode) node.jjtGetChild(1);
+ if (cn1.getId() == LexerTreeConstants.JJTTYPED_LIST
+ && cn2.getId() == LexerTreeConstants.JJTGD) {
+ ActionDef tmp = this.actionCtx;
+ this.actionCtx = null;
+ ExistsExp exists = new ExistsExp();
+ LinkedHashMap<String, Variable> vars = new LinkedHashMap<String, Variable>();
+ this.var_typed_list(cn1, vars);
+ this.actionCtx = tmp;
+ for (Variable var : vars.values()) {
+ exists.add(var);
+ }
+ this.quantifiedExpCtx = exists;
+ Exp exp = this.gd(cn2);
+ exists.setExp(exp);
+ this.quantifiedExpCtx = null;
+ return exists;
+ }
+ }
+ this.quantifiedExpCtx = null;
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>LITERAL</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LITERAL</code> node.
+ * @return the exp literal structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Literal literal(SimpleNode node) throws ParserException {
+ Literal exp = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTATOMIC_FORMULA:
+ exp = this.atomic_formula(cn);
+ break;
+ case LexerTreeConstants.JJTNOT_ATOMIC_FORMULA:
+ exp = this.not_atomic_formula(cn);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>LITERAL</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LITERAL</code> node.
+ * @return the exp literal structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Literal ground_literal(SimpleNode node) throws ParserException {
+ Literal exp = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTATOMIC_FORMULA:
+ exp = this.ground_atomic_formula(cn);
+ break;
+ case LexerTreeConstants.JJTNOT_ATOMIC_FORMULA:
+ exp = this.not_ground_atomic_formula(cn);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return exp;
+ }
+
+ /**
+ * Extracts the object structures from the <code>LITERAL</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LITERAL</code> node.
+ * @return the exp literal structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Literal not_atomic_formula(SimpleNode node)
+ throws ParserException {
+ Literal exp = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTATOMIC_FORMULA) {
+ return new NotAtomicFormula(this.atomic_formula(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>LITERAL</code> node of
+ * the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>LITERAL</code> node.
+ * @return the exp literal structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Literal not_ground_atomic_formula(SimpleNode node)
+ throws ParserException {
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ if (cn.getId() == LexerTreeConstants.JJTATOMIC_FORMULA) {
+ return new NotAtomicFormula(this.ground_atomic_formula(cn));
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ATOMIC_FORMULA</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ATOMIC_FORMULA</code> node.
+ * @return the atomic formula structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtomicFormula atomic_formula(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() > 0) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTPREDICATE) {
+ AtomicFormula atomic_formula = new AtomicFormula(this.predicate(cn1));
+ for (int i = 1; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ if (cn.getId() == LexerTreeConstants.JJTTERM) {
+ atomic_formula.add(this.term(cn));
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ if (!this.obj.getContent().equals(Content.PARTIAL_PROBLEM)) {
+ boolean match = false;
+ Iterator<AtomicFormula> i = obj.predicates.iterator();
+ while (i.hasNext() && !match) {
+ AtomicFormula copy = i.next().clone().standardize();
+ Substitution sigma = copy.match(atomic_formula);
+ match = sigma != null;
+
+ }
+ if (!match) {
+ this.mgr.logParserWarning("predicate \""
+ + atomic_formula.toTypedString()
+ + "\" undefined.", this.file, node
+ .getLine(), node.getColumn());
+ obj.predicates.add(atomic_formula);
+ }
+ }
+ return atomic_formula;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>ATOMIC_FORMULA</code>
+ * node of the syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>ATOMIC_FORMULA</code> node.
+ * @return the atomic formula structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private AtomicFormula ground_atomic_formula(SimpleNode node) throws ParserException {
+ if (node.jjtGetNumChildren() > 0) {
+ SimpleNode cn1 = (SimpleNode) node.jjtGetChild(0);
+ if (cn1.getId() == LexerTreeConstants.JJTPREDICATE) {
+ AtomicFormula atomic_formula = new AtomicFormula(this.predicate(cn1));
+ for (int i = 1; i < node.jjtGetNumChildren(); i++) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(i);
+ if (cn.getId() == LexerTreeConstants.JJTCONSTANT) {
+ atomic_formula.add(this.constant(cn));
+ } else {
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return atomic_formula;
+ }
+ }
+ throw new ParserException("An internal parser error occurs: node "
+ + node.getLabel() + " unexpected.");
+ }
+
+ /**
+ * Extracts the object structures from the <code>TERM</code> node of the
+ * syntaxic tree and implements the semantic check.
+ *
+ * @param node the <code>TERM</code> node.
+ * @return the exp structure built.
+ * @throws ParserException if an error occurs while parsing.
+ */
+ private Term term(SimpleNode node) throws ParserException {
+ Term t = null;
+ if (node.jjtGetNumChildren() == 1) {
+ SimpleNode cn = (SimpleNode) node.jjtGetChild(0);
+ switch (cn.getId()) {
+ case LexerTreeConstants.JJTCONSTANT:
+ t = this.constant(cn);
+ break;
+ case LexerTreeConstants.JJTVARIABLE:
+ t = this.variable(cn);
+ break;
+ default:
+ throw new ParserException("An internal parser error occurs: node "
+ + cn.getLabel() + " unexpected.");
+ }
+ }
+ return t;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java
new file mode 100644
index 00000000000..303350717f9
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/ParserException.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+
+/**
+ * This class implements a parser exception. The parser exception of exception
+ * is thrown if an internal error occurs in parser.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class ParserException extends Exception {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 1695639410883338894L;
+
+ /**
+ * The line of the error.
+ */
+ private int line;
+
+ /**
+ * The column of the error.
+ */
+ private int column;
+
+ /**
+ * The file where the error was detected.
+ */
+ private File file;
+
+ /**
+ * Creates a new parser exception with a specific message and cause.
+ *
+ * @param message the message.
+ * @param cause the cause.
+ */
+ public ParserException(String message, Throwable cause) {
+ super(message, cause);
+ this.line = -1;
+ this.column = -1;
+ this.file = null;
+ }
+
+ /**
+ * Creates a new parser exception with a specific message.
+ *
+ * @param message the message.
+ */
+ public ParserException(String message) {
+ super(message);
+ this.line = -1;
+ this.column = -1;
+ this.file = null;
+ }
+
+ /**
+ * Creates a new parser exception with a specific message.
+ *
+ * @param message the message.
+ * @param file the file where the error was detected.
+ * @param line the line of the file where the error was detected.
+ * @param column the column of the file where the error was detected.
+ */
+ public ParserException(String message, File file, int line, int column) {
+ super(message);
+ this.file = file;
+ this.line = line;
+ this.column = column;
+ }
+
+ /**
+ * Returns the file where the error was detected.
+ *
+ * @return the file where the error was detected or <code>null</code> if no file was specifies.
+ */
+ public File getFile() {
+ return this.file;
+ }
+
+ /**
+ * Returns the column of parser exception.
+ *
+ * @return the column of the parser exception or -1 if no column was specified.
+ */
+ public int getColumn() {
+ return this.column;
+ }
+
+ /**
+ * Returns the line of parser exception.
+ *
+ * @return the line of the parser exception or -1 if no line was specified.
+ */
+ public int getLine() {
+ return this.line;
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java
new file mode 100644
index 00000000000..668328a00ff
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Problem.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.InitEl;
+import pddl4j.exp.metric.MetricExp;
+import pddl4j.exp.term.Constant;
+
+/**
+ * This interface defines the accessible methods from a problem.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface Problem extends Serializable {
+
+ /**
+ * Returns an iterator over the requirements of this pddl object.
+ *
+ * @return an iterator over the requirements of this pddl object.
+ */
+ Iterator<RequireKey> requirementsIterator();
+
+ /**
+ * Returns an iterator over the constants defined in this pddl object.
+ *
+ * @return an iterator over the constants defined in this pddl object.
+ */
+ Iterator<Constant> constantsIterator();
+
+ /**
+ * Returns the metric of the PDDL object.
+ *
+ * @return the metric of the PDDL object.
+ */
+ MetricExp getMetric();
+
+ /**
+ * Returns the problem file where the PDDL object is defined.
+ *
+ * @return the problem file where the PDDL object is defined.
+ */
+ File getProblemFile();
+
+ /**
+ * Returns the goal of the PDDL object.
+ *
+ * @return the goal of the PDDL object.
+ */
+ Exp getGoal();
+
+ /**
+ * Returns the initial state of the PDDL object.
+ *
+ * @return the initial state of the PDDL object.
+ */
+ List<InitEl> getInit();
+
+ /**
+ * Returns the name of the domain.
+ *
+ * @return the name of the domain.
+ */
+ String getDomainName();
+
+ /**
+ * Returns the name of the problem.
+ *
+ * @return the name of the problem.
+ */
+ String getProblemName();
+
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java
new file mode 100644
index 00000000000..6caa82b178e
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/RequireKey.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+/**
+ * This enumeration defines le set of PDDL require key.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum RequireKey {
+ /**
+ * The PDDL :strips requirement.
+ */
+ STRIPS(":strips"),
+ /**
+ * The PDDL :typing requirement.
+ */
+ TYPING(":typing"),
+ /**
+ * The PDDL :negative-preconditions requirement.
+ */
+ NEGATIVE_PRECONDITIONS(":negative-preconditions"),
+ /**
+ * The PDDL :disjunctive-preconditions requirement.
+ */
+ DISJUNCTIVE_PRECONDITIONS(":disjunctive-preconditions"),
+ /**
+ * The PDDL :equality requirement.
+ */
+ EQUALITY(":equality"),
+ /**
+ * The PDDL :existential-preconditions requirement.
+ */
+ EXISTENTIAL_PRECONDITIONS(":existential-preconditions"),
+ /**
+ * The PDDL :universal-preconditions requirement.
+ */
+ UNIVERSAL_PRECONDITIONS(":universal-preconditions"),
+ /**
+ * The PDDL :quantified-preconditions requirement.
+ */
+ QUANTIFIED_PRECONDITIONS(":quantified-preconditions"),
+ /**
+ * The PDDL :conditional-effects requirement.
+ */
+ CONDITIONAL_EFFECTS(":conditional-effects"),
+ /**
+ * The PDDL :fluents requirement.
+ */
+ FLUENTS(":fluents"),
+ /**
+ * The PDDL :adl requirement.
+ */
+ ADL(":adl"),
+ /**
+ * The PDDL :durative-actions requirement.
+ */
+ DURATIVE_ACTIONS(":durative-actions"),
+ /**
+ * The PDDL :derived-predicates requirement.
+ */
+ DERIVED_PREDICATES(":derived-predicates"),
+ /**
+ * The PDDL :times-initial-literals requirement.
+ */
+ TIMED_INITIAL_LITERALS(":timed-initial-literals"),
+ /**
+ * The PDDL :preferences requirement.
+ */
+ PREFERENCES(":preferences"),
+ /**
+ * The PDDL :constraints requirement.
+ */
+ CONSTRAINTS(":constraints"),
+ /**
+ * The PDDL :continus-effects requirement.
+ */
+ CONTINUS_EFFECTS(":continous-effects"),
+ /**
+ * The PDDL :duration-inegalities requirement.
+ */
+ DURATION_INEQUALITIES(":duration-inequalities");
+
+ /**
+ * The image associate to the require key in the PDDL langage.
+ */
+ private String image;
+
+ /**
+ * Create a new require key with a specific image.
+ *
+ * @param image the image of the require key. The image of the require key must be not null.
+ */
+ private RequireKey(String image) {
+ this.image = image;
+ }
+
+ /**
+ * Returns the require key with a specific image or <code>null</code> if there is no require key with the
+ * specific image.
+ *
+ * @param image the image of the require key searched.
+ * @return the require key searched or <code>null</code> if it was not found in the enumeration.
+ */
+ public static RequireKey getRequireKey(String image) {
+ for (RequireKey rk : RequireKey.values()) {
+ if (rk.image.equalsIgnoreCase(image)) {
+ return rk;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the image of this require key.
+ *
+ * @return the image of this require key.
+ */
+ public String getImage() {
+ return this.image;
+ }
+
+ /**
+ * Returns a string representation of this require key.
+ *
+ * @return a string representation of this require key.
+ */
+ public String toString() {
+ return this.image;
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java
new file mode 100644
index 00000000000..d5e65c8cee0
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/Source.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j;
+
+/**
+ * This enumeration is used to specify the difference version of PDDL langage.
+ */
+public enum Source {
+ /**
+ * The 3.0 version of the PDDL source.
+ */
+ V3_0;
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java
new file mode 100644
index 00000000000..0844edf7f16
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AbstractExp.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+/**
+ * This abstract class implements the common part of all PDDl expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class AbstractExp implements Exp {
+
+ /**
+ * The id of the expression.
+ */
+ private ExpID id;
+
+ /**
+ * Creates a new expression with a specific id.
+ *
+ * @param id The id of the expression.
+ */
+ protected AbstractExp(ExpID id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the id of the expression.
+ *
+ * @return the id of the expression.
+ * @see pddl4j.exp.Exp#getExpID()
+ */
+ public final ExpID getExpID() {
+ return this.id;
+ }
+
+ /**
+ * Returns <code>true</code> if this expression is equal to an other
+ * object. This method returns <code>true</code> if the object is a not
+ * null reference to an instance of the class <code>AbstractExp</code> and
+ * both expressions have the same expression id.
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if the expression is equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof AbstractExp) {
+ AbstractExp other = (AbstractExp) obj;
+ return this.id.equals(other.id);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for this expression. This method
+ * is supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for this expression.
+ */
+ public int hashCode() {
+ return this.id.hashCode();
+ }
+
+ /**
+ * Returns a deep copy of this expression.
+ *
+ * @return a deep copy of this expression.
+ */
+ public Exp clone() {
+ try {
+ Exp other = (Exp) super.clone();
+ return other;
+ } catch (CloneNotSupportedException e) {
+ throw new InternalError();
+ }
+ }
+
+ /**
+ * Returns the prenex normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the prenex normal form of this expression.
+ */
+ public Exp toPrenexNormaForm() {
+ return this.standardize().moveQuantifierOutward();
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ return this.clone();
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public Exp toDisjunctiveNormalForm() {
+ return this.clone();
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public Exp toConjunctiveNormalForm() {
+ return this.clone();
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public Exp toNegativeNormalForm() {
+ return this.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java
new file mode 100644
index 00000000000..5956fdfebe9
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AndExp.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This abstract generic class is implemented by all conjunctive PDDL expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class AndExp extends ListExp {
+
+ /**
+ * The serial version if of the class.
+ */
+ private static final long serialVersionUID = -61659117952471061L;
+
+ /**
+ * Creates a new empty conjunctive expression.
+ */
+ public AndExp() {
+ super(ExpID.AND);
+ }
+
+ /**
+ * Creates a new list expression with a specific id and expressions.
+ *
+ * @param exps an expressions list.
+ */
+ public AndExp(Exp... exps) {
+ super(ExpID.AND, exps);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public AndExp apply(Substitution sigma) {
+ return (AndExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public AndExp standardize() {
+ return this.standardize(new HashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public AndExp standardize(Map<String, String> images) {
+ return (AndExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AndExp clone() {
+ return (AndExp) super.clone();
+ }
+
+ /**
+ * Returns the prenex normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the prenex normal form of this expression.
+ */
+ public Exp toPrenexNormaForm() {
+ return this.standardize().moveQuantifierOutward();
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ Exp qexp = null;
+ AndExp and = new AndExp();
+ Iterator<Exp> i = this.iterator();
+ while (i.hasNext()) {
+ Exp exp = i.next();
+ if (exp.getExpID().equals(ExpID.FORALL)) {
+ ForallExp forall = (ForallExp) exp;
+ if (!forall.exp.getExpID().equals(ExpID.WHEN)) {
+ ForallExp tmp = new ForallExp();
+ for (Variable var : forall) {
+ tmp.add(var.clone());
+ }
+ and.add(forall.getExp());
+ while (i.hasNext()) {
+ and.add(i.next());
+ }
+ tmp.setExp(and.moveQuantifierOutward());
+ qexp = tmp;
+ } else {
+ and.add(exp.moveQuantifierOutward());
+ }
+ }
+ else if (exp.getExpID().equals(ExpID.EXIST)) {
+ ExistsExp exists = (ExistsExp) exp;
+ if (!exists.exp.getExpID().equals(ExpID.WHEN)) {
+ ExistsExp tmp = new ExistsExp();
+ for (Variable var : exists) {
+ tmp.add(var.clone());
+ }
+ and.add(exists.getExp());
+ while (i.hasNext()) {
+ and.add(i.next());
+ }
+ tmp.setExp(and.moveQuantifierOutward());
+ qexp = tmp;
+ } else {
+ and.add(exp.moveQuantifierOutward());
+ }
+ } else {
+ and.add(exp);
+ }
+ }
+ return qexp == null ? and : qexp;
+ }
+
+ /**
+ * Returns <code>true</code> if this and expression is conditional, i.e.,
+ * if this expression contains a when expression.
+ *
+ * @return <code>true</code> if this and expression is conditional;
+ * <code>false</code> otherwise.
+ */
+ private boolean isConditional() {
+ boolean isConditional = false;
+ Iterator<Exp> i = this.iterator();
+ while (i.hasNext() && !isConditional) {
+ isConditional = i.next().getExpID().equals(ExpID.WHEN);
+ }
+ return isConditional;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public AndExp toConjunctiveNormalForm() {
+ AndExp nnf = this.toNegativeNormalForm();
+ AndExp cnf = new AndExp();
+ if (nnf.isConditional()) {
+ for (Exp elt : nnf) {
+ if (!elt.getExpID().equals(ExpID.WHEN)) {
+ for (Exp cnfi : cnf) {
+ if (cnfi.getExpID().equals(ExpID.WHEN)) {
+ WhenExp when = (WhenExp) cnfi;
+ AndExp effect = new AndExp();
+ effect.add(when.getEffect());
+ effect.add(elt);
+ when.setEffect(effect);
+ when = when.normalize();
+ }
+ }
+ } else {
+ WhenExp when = (WhenExp) elt;
+ cnf.add(when.normalize());
+ }
+ }
+ } else {
+ for (Exp elt : nnf) {
+ elt = elt.toConjunctiveNormalForm();
+ cnf.add(elt);
+ }
+ }
+ return cnf;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public OrExp toDisjunctiveNormalForm() {
+ AndExp nnf = this.toNegativeNormalForm();
+ OrExp dnf = new OrExp();
+ dnf.add(new AndExp());
+ for (Exp e : nnf) {
+ Exp ednf = e.toDisjunctiveNormalForm();
+ if (ednf.getExpID().equals(ExpID.OR)) {
+ OrExp or = (OrExp) ednf;
+ OrExp newDnf = new OrExp();
+ for (Exp oe : or) {
+ for (Exp and : dnf) {
+ AndExp other = (AndExp) and.clone();
+ other.add(oe);
+ newDnf.add(other);
+ }
+ }
+ dnf = newDnf;
+ } else {
+ for (Exp ex : dnf) {
+ ((AndExp) ex).add(ednf);
+ }
+ }
+ }
+ return dnf;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public AndExp toNegativeNormalForm() {
+ AndExp other = new AndExp();
+ for (Exp exp : this) {
+ other.add(exp.toNegativeNormalForm());
+ }
+ return other;
+ }
+
+ /**
+ * Returns a string representation of the conjunctive expression.
+ *
+ * @return a string representation of the conjunctive expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(and");
+ for (Exp elt : this.elements) {
+ str.append(" ");
+ str.append(elt.toString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the conjunctive expression.
+ *
+ * @return a typed string representation of the conjunctive expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(and");
+ for (Exp elt : this.elements) {
+ str.append(" ");
+ str.append(elt.toTypedString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java
new file mode 100644
index 00000000000..3b6dd89f5f6
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/AtomicFormula.java
@@ -0,0 +1,398 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements a atomic formula of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class AtomicFormula extends AbstractExp implements Literal {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -9015916938283328690L;
+
+ /**
+ * The predicate of the atomic formula.
+ */
+ private String predicate;
+
+ /**
+ * The list of arguments contained in the atomic formula.
+ */
+ private ArrayList<Term> arguments;
+
+ /**
+ * Creates a new atomic formula with a specific predicate.
+ *
+ * @param predicate the predicate of the atomic formula. The predicate must
+ * be a not null reference.
+ */
+ public AtomicFormula(String predicate) {
+ super(ExpID.ATOMIC_FORMULA);
+ this.predicate = predicate;
+ this.arguments = new ArrayList<Term>();
+ }
+
+ /**
+ * Sets a new predicate to this atomic formula.
+ *
+ * @param predicate the new predicate to set. The predicate must be a not
+ * null reference.
+ */
+ public final void setPredicate(String predicate) {
+ this.predicate = predicate;
+ }
+
+ /**
+ * Returns the predicate of this atomic formula.
+ *
+ * @return the predicate of this atomic formula.
+ */
+ public final String getPredicate() {
+ return this.predicate;
+ }
+
+ /**
+ * Adds a new term to this atomic formula.
+ *
+ * @param term the term to add. The term must be not null.
+ * @return <code>true</code> if the term was added; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean add(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.arguments.add(term);
+ }
+
+ /**
+ * Returns the arity of this atomic formula.
+ *
+ * @return the arity of this atomic formula.
+ */
+ public final int getArity() {
+ return this.arguments.size();
+ }
+
+ /**
+ * Returns an iterator over the terms of the atomic formula.
+ *
+ * @return an iterator over the terms of the atomic formula.
+ * @see java.lang.Iterable#iterator()
+ */
+ public final Iterator<Term> iterator() {
+ return this.arguments.iterator();
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this atomic formula.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this atomic formula;
+ * <code>false</code> otherwise.
+ */
+ public boolean occurs(Term term) {
+ return this.arguments.contains(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public final AtomicFormula apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ AtomicFormula other = new AtomicFormula(this.predicate);
+ for (Term arg : this) {
+ other.add(arg.apply(sigma));
+ }
+ return other;
+ }
+
+ /**
+ * Matches this atomic formula with an other specified atomic formula. Two
+ * atomic formulas match if they have the same predicate symbol and arity
+ * and each arguments are pairwise unifiable. Note, called match does not
+ * modify the parameters of this method.
+ *
+ * @param atom the atomic formula to match with.
+ * @return The substitution that defines the binding constraints needed to
+ * match this atomic formula with the other atomic formula or
+ * <code>null</code> if no binding constraints allows to match the
+ * two atomic formulas.
+ * @throws NullPointerException if <code>atom == null</code> or
+ * <code>sigma == null</code>.
+ * @see pddl4j.exp.term.Term#unify(Term, Substitution)
+ */
+ public final Substitution match(AtomicFormula atom) {
+ return this.match(atom, new Substitution());
+ }
+
+ /**
+ * Matches this atomic formula with an other specified atomic formula by
+ * taking into account a specified set of binding constraints. Two atomic
+ * formulas match if they have the same predicate symbol and arity and each
+ * arguments are pairwise unifiable. Note, called match does not modify the
+ * parameters of this method.
+ *
+ * @param atom the atomic formula to match with.
+ * @param sigma the substitution containing the binding constraints.
+ * @return The substitution that defines the binding constraints needed to
+ * match this atomic formula with the other atomic formula or
+ * <code>null</code> if no binding constraints allows to match the
+ * two atomic formulas.
+ * @throws NullPointerException if <code>atom == null</code> or
+ * <code>sigma == null</code>.
+ * @see pddl4j.exp.term.Term#unify(Term, Substitution)
+ */
+ public final Substitution match(AtomicFormula atom, Substitution sigma) {
+ if (this.predicate.equals(atom.predicate)
+ && this.getArity() == atom.getArity()) {
+ Substitution theta = sigma.clone();
+ int i = 0;
+ boolean failure = false;
+ while (i < this.getArity() && !failure) {
+ Term tthis = this.arguments.get(i);
+ Term tother = atom.arguments.get(i);
+ Substitution gamma = tthis.unify(tother, theta);
+ if (gamma == null) {
+ failure = true;
+ } else {
+ theta.compose(gamma);
+ }
+ i++;
+ }
+ return failure ? null : theta;
+ }
+ return null;
+
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AtomicFormula standardize() {
+ return this.standardize(new HashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public AtomicFormula standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ AtomicFormula other = new AtomicFormula(this.predicate);
+ for (Term arg : this.arguments) {
+ other.add(arg.standardize(images));
+ }
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ boolean isGround = true;
+ Iterator<Term> i = this.iterator();
+ while (i.hasNext() && isGround) {
+ isGround = i.next().isGround();
+ }
+ return isGround;
+ }
+
+ /**
+ * Returns <code>true</code> if this atomic formula is equals to an other
+ * object. This method return <code>true</code> if the object is a not
+ * null instance of the class <code>AtomicFormula</code> and both atomic
+ * formulas have the same predicate and arguments.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this atomic formula is equals to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof AtomicFormula) {
+ AtomicFormula other = (AtomicFormula) obj;
+ return this.predicate.equals(other.predicate)
+ && this.arguments.equals(other.arguments);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this atomic formula. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return the hash code value of this atomic formula.
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.predicate.hashCode() + this.arguments.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AtomicFormula clone() {
+ AtomicFormula other = (AtomicFormula) super.clone();
+ other.arguments = new ArrayList<Term>();
+ for (Term arg : this.arguments) {
+ other.arguments.add(arg.clone());
+ }
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public OrExp toDisjunctiveNormalForm() {
+ OrExp dnf = new OrExp();
+ dnf.add(this.clone());
+ return dnf;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public AndExp toConjunctiveNormalForm() {
+ AndExp cnf = new AndExp();
+ cnf.add(this.clone());
+ return cnf;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public AtomicFormula toNegativeNormalForm() {
+ return this.clone();
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new HashSet<Variable>();
+ for (Term arg : this) {
+ if (arg.getTermID().equals(TermID.VARIABLE)) {
+ vars.add((Variable) arg);
+ }
+ }
+ return vars;
+ }
+
+ /**
+ * Returns a string representation of this atomic formula.
+ *
+ * @return a string representation of this atomic formula.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(");
+ str.append(this.predicate);
+ for (Term t : this.arguments) {
+ str.append(" ");
+ str.append(t.toString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this atomic formula.
+ *
+ * @return a typed string representation of this atomic formula.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(");
+ str.append(this.predicate);
+ for (Term t : this.arguments) {
+ str.append(" ");
+ str.append(t.toTypedString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java
new file mode 100644
index 00000000000..9ce7c31253c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/DerivedPredicate.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements a derived predicate of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class DerivedPredicate extends AbstractExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 523481664576398238L;
+
+ /**
+ * The expression that defines the derived predicate.
+ */
+ private ImplyExp exp;
+
+ /**
+ * Creates a new derived predicate with a specific head and body.
+ *
+ * @param head the head of this derived predicate.
+ * @param body the body of this derived predicate
+ * @throws NullPointerException if <code>head == null || body == null</code>.
+ */
+ public DerivedPredicate(AtomicFormula head, Exp body) {
+ super(ExpID.DERIVED_PREDICATE);
+ if (head == null || body == null)
+ throw new NullPointerException();
+ this.exp = new ImplyExp(head, body);
+ }
+
+ /**
+ * Sets a new head to this derived predicate.
+ *
+ * @param head the new head of this implication expression. The new head of
+ * the derived predicate must be a not null reference to an
+ * instance of <code>AtomicFormula</code>.
+ * @throws NullPointerException if <code>head == null</code>.
+ */
+ public final void setHead(AtomicFormula head) {
+ if (head == null)
+ throw new NullPointerException();
+ this.exp.setHead(head);
+ }
+
+ /**
+ * Returns the head of the derived predicate.
+ *
+ * @return the head of the derived predicate.
+ */
+ public final AtomicFormula getHead() {
+ return (AtomicFormula) this.exp.getHead();
+ }
+
+ /**
+ * Sets a new body to this derived predicate.
+ *
+ * @param body the new body of this derived predicate. The new body of
+ * the derived predicate must be a not null reference to an
+ * instance of <code>Exp</code>.
+ * @throws NullPointerException if <code>body == null</code>.
+ */
+ public final void setBody(Exp body) {
+ if (body == null)
+ throw new NullPointerException();
+ this.setBody(body);
+ }
+
+ /**
+ * Returns the body of the derived predicate.
+ *
+ * @return the body of the derived predicate.
+ */
+ public final Exp getBody() {
+ return this.exp.getBody();
+ }
+
+ /**
+ * Returns <code>true</code> if a expression occurs in this derived predicate.
+ *
+ * @param term the expression to be tested.
+ * @return <code>true</code> if a expression occurs in this derived predicate;
+ * <code>false</code> otherwise.
+ */
+ public final boolean occurs(Term term) {
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public final Exp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ DerivedPredicate other = this.clone();
+ other.exp = this.exp.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public DerivedPredicate standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public DerivedPredicate standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ DerivedPredicate other = this.clone();
+ other.exp = this.exp.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+
+ /**
+ * Returns <code>true</code> if this derived predicate is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>DerivedPredicate</code> and both derived predicates
+ * have the same parameters and expression.
+ *
+ * @param obj - the reference object with which to compare.
+ * @return <code>true</code> if this derived predicate is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof DerivedPredicate) {
+ DerivedPredicate other = (DerivedPredicate) obj;
+ return this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the derived predicate. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the derived predicate.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.exp.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public DerivedPredicate clone() {
+ DerivedPredicate other = (DerivedPredicate) super.clone();
+ other.exp = exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ DerivedPredicate other = this.clone();
+ other.exp.body = this.exp.body.moveQuantifierOutward();
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public DerivedPredicate toDisjunctiveNormalForm() {
+ DerivedPredicate dnf = this.clone();
+ dnf.exp.body = this.exp.body.toDisjunctiveNormalForm();
+ return dnf;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public DerivedPredicate toConjunctiveNormalForm() {
+ DerivedPredicate cnf = this.clone();
+ cnf.exp.body = this.exp.body.toConjunctiveNormalForm();
+ return cnf;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public DerivedPredicate toNegativeNormalForm() {
+ DerivedPredicate nnf = this.clone();
+ nnf.exp.body = this.exp.body.toNegativeNormalForm();
+ return nnf;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ return this.exp.getFreeVariables();
+ }
+
+ /**
+ * Returns a string representation of the derived predicate.
+ *
+ * @return a string representation of the derived predicate.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:derived ");
+ str.append("(");
+ str.append(this.exp.toString());
+ str.append(")");
+ str.append(" ");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a string representation of the derived predicate.
+ *
+ * @return a string representation of the derived predicate.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:derived ");
+ str.append("(");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ str.append(" ");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java
new file mode 100644
index 00000000000..ee8eb83a7fc
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExistsExp.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements an existential expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class ExistsExp extends QuantifiedExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 509423923623946119L;
+
+ /**
+ * Creates a new existential expression with a specific list of bound
+ * variables and quantified expression.
+ *
+ * @param exp the quantified expression.
+ */
+ public ExistsExp(Exp exp) {
+ super(ExpID.EXIST, exp);
+ }
+
+ /**
+ * Creates a new existential expression with a specific list of bound
+ * variables and quantified expression.
+ */
+ public ExistsExp() {
+ super(ExpID.EXIST);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public ExistsExp standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public ExistsExp standardize(Map<String, String> images) {
+ return (ExistsExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ExistsExp clone() {
+ return (ExistsExp) super.clone();
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public ExistsExp toDisjunctiveNormalForm() {
+ ExistsExp dnf = this.clone();
+ dnf.exp = this.exp.toDisjunctiveNormalForm();
+ return dnf;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public ExistsExp toConjunctiveNormalForm() {
+ ExistsExp cnf = this.clone();
+ cnf.exp = this.exp.toConjunctiveNormalForm();
+ return cnf;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public ExistsExp toNegativeNormalForm() {
+ ExistsExp nnf = this.clone();
+ nnf.exp = this.exp.toNegativeNormalForm();
+ return nnf;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ ExistsExp exists = this.clone();
+ exists.exp = this.exp.moveQuantifierOutward();
+ if (exists.exp.getExpID().equals(ExpID.FORALL)) {
+ ForallExp forall = (ForallExp) exists.exp;
+ exists.setExp(forall.exp);
+ forall.setExp(exists);
+ return forall;
+ } else if (exists.exp.getExpID().equals(ExpID.EXIST)) {
+ ExistsExp other = (ExistsExp) exists.exp;
+ for (Variable var : other) {
+ exists.add(var);
+ }
+ exists.setExp(other.exp);
+ return exists;
+ } else if (exists.exp.getExpID().equals(ExpID.WHEN)) {
+ WhenExp when = (WhenExp) exists.exp;
+ exists.setExp(when.getCondition());
+ when.setCondition(exists);
+ return when;
+ }
+ return exists;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java
new file mode 100644
index 00000000000..1c6858e1124
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Exp.java
@@ -0,0 +1,254 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This interface is implemented by all expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface Exp extends Serializable, Cloneable {
+
+ /**
+ * Returns the id of the expression.
+ *
+ * @return the id of the expression.
+ */
+ ExpID getExpID();
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ */
+ boolean isGround();
+
+ /**
+ * Returns <code>true</code> if this expression is equal to an other
+ * object, i.e., if the object is a not null instance of the class of the
+ * expression and both expressions have the same content.
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this expression is equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns a hash code value for the expression. This method is supported
+ * for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the expression.
+ */
+ int hashCode();
+
+ /**
+ * Returns a string representation of the expression.
+ *
+ * @return a string representation of the expression.
+ */
+ String toString();
+
+ /**
+ * Returns <code>true</code> if a term occurs in this expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ boolean occurs(Term term);
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are bound in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ Exp apply(Substitution sigma);
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ Exp standardize();
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ */
+ Exp standardize(Map<String, String> images);
+
+ /**
+ * Returns a typed string of this expression.
+ *
+ * @return a typed string of this expression.
+ */
+ String toTypedString();
+
+ /**
+ * Returns a deep copy of this expression. Creates and returns a copy of
+ * this expression. The precise meaning of "copy" is as follow:
+ *
+ * <pre>
+ * x.clone() != x
+ * </pre>
+ *
+ * will be true, and that the expression:
+ *
+ * <pre>
+ * x.clone().getClass() == x.getClass()
+ * </pre>
+ *
+ * will be true. While it is the case that:
+ *
+ * <pre>
+ * x.clone().equals(x)
+ * </pre>
+ *
+ * will be true. Finally, note that except type of term expression are
+ * deeply copy.
+ *
+ * @return a deep copy of this expression.
+ * @see java.lang.Cloneable
+ */
+ Exp clone();
+
+ /**
+ * Returns the prenex normal form of this expression. Note, the expression
+ * returned is a copy. The expression is first standardized and it is placed
+ * in the prenex normal form by recursively moving quantifier inward with
+ * the existential quantifier first using the following rewriting rules
+ * (which are in fact equivalences):
+ * <ul>
+ * <li><code>(and (forall (x) A) B) => (forall (x) (and A B))</code></li>
+ * <li><code>(or (forall (x) A) B) => (forall (x) (or A B))</code></li>
+ * <li><code>(and (exists (x) A) B) => (exists (x) (and A B))</code></li>
+ * <li><code>(or (exists (x) A) B) => (exists (x) (or A B))</code></li>
+ * <li> <code>(not (exists (x) (A))) => (forall (x) (not A)) </code></li>
+ * <li> <code>(not (forall (x) (A))) => (exists (x) (not A)) </code></li>
+ * <li> <code>(imply A (forall (x) (B))) => (forall (x) (imply A B)) </code></li>
+ * <li> <code>(imply A (exists (x) (B))) => (exists (x) (imply A B)) </code></li>
+ * <li> <code>(imply (forall (x) (A)) B) => (exists (x) (imply A B)) </code></li>
+ * <li> <code>(imply (exists (x) (A)) B) => (forall (x) (imply A B)) </code></li>
+ * </ul>
+ *
+ * @return the prenex normal form of this expression.
+ */
+ Exp toPrenexNormaForm();
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first
+ * and in which all existential quantifiers precede all universal
+ * quantifiers
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ */
+ Exp moveQuantifierOutward();
+
+ /**
+ * Returns the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy. The expression is first converted into
+ * negative normal form and it is placed in the disjunctive normal form by
+ * recursively moving conjunctions inward and disjunctions outward using the
+ * following rewriting rules (which are in fact equivalences):
+ * <ul>
+ * <li><code>(and A (or B C)) => (or (and A B) (and A C))</code></li>
+ * <li><code>(and (or A B) C)) => (or (and A C) (and B C))</code></li>
+ * </ul>
+ *
+ * @return the disjunctive normal form of this expression.
+ */
+ Exp toDisjunctiveNormalForm();
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy. The expression is first converted into
+ * negative normal form and it is placed in the conjunctive normal form by
+ * recursively moving disjunction inward and conjunction outward using the
+ * following rewriting rules (which are in fact equivalences):
+ * <ul>
+ * <li><code>(or A (and B C)) => (and (or A B) (or A C))</code></li>
+ * <li><code>(or (and A B) C)) => (and (or A C) (or B C))</code></li>
+ * </ul>
+ *
+ * @return the disjunctive normal form of this expression.
+ */
+ Exp toConjunctiveNormalForm();
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy. The negative normal form is obtained by recursively
+ * replace formulas appearing on the left with formulas appearing on the
+ * right:
+ * <ul>
+ * <li> <code>(imply A B) => (or (not A) B) </code></li>
+ * <li> <code>(not (not F)) => F </code></li>
+ * <li> <code>(not (or A B)) => (and (not A) (not B)) </code></li>
+ * <li> <code>(not (and A B)) => (or (not A) (not B)) </code></li>
+ * <li> <code>(not (imply A B)) => (and A (not B)) </code></li>
+ * <li> <code>(not (exists (x) (F))) => (forall (x) (not F)) </code></li>
+ * <li> <code>(not (forall (x) (F))) => (exists (x) (not F)) </code></li>
+ * <li> default a copy of the expression where inner expressions are in
+ * negative normal form</li>
+ *
+ * @return the negative normal form of this expression.
+ */
+ Exp toNegativeNormalForm();
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ Set<Variable> getFreeVariables();
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java
new file mode 100644
index 00000000000..d9401ca3c53
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ExpID.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+/**
+ * This enumeration list all expression id used in the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum ExpID {
+ /**
+ * The compared function expression id.
+ */
+ F_COMP,
+ /**
+ * The assign operator expression id.
+ */
+ ASSIGN_OP,
+ /**
+ * The when expression id.
+ */
+ WHEN,
+ /**
+ * The and expression id.
+ */
+ AND,
+ /**
+ * The or expression id.
+ */
+ OR,
+ /**
+ * The imply expression id.
+ */
+ IMPLY,
+ /**
+ * The node expression id.
+ */
+ NOT,
+ /**
+ * The preference expression id.
+ */
+ PREFERENCE,
+ /**
+ * The existential expression id.
+ */
+ EXIST,
+ /**
+ * The universal expression id.
+ */
+ FORALL,
+ /**
+ * The atomic formula expression id.
+ */
+ ATOMIC_FORMULA,
+ /**
+ * The derived predicate expression id.
+ */
+ DERIVED_PREDICATE,
+ /**
+ * The term expression id.
+ */
+ TERM,
+ /**
+ * The optimization expression id.
+ */
+ METRIC_EXP,
+ /**
+ * The conditional expression id.
+ */
+ COND_EXP,
+ /**
+ * The timed expression id.
+ */
+ TIMED_EXP,
+
+ /**
+ * New--probabilistic
+ */
+ PROB_EXP,
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java
new file mode 100644
index 00000000000..9e3a3082d84
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ForallExp.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements an universal expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class ForallExp extends QuantifiedExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -6762523987177898777L;
+
+ /**
+ * Creates a new universal expression with a specific list of bound
+ * variables and quantified expression.
+ *
+ * @param exp the quantified expression.
+ */
+ public ForallExp(Exp exp) {
+ super(ExpID.FORALL, exp);
+ }
+
+ /**
+ * Creates a new universal expression with a specific list of bound
+ * variables and quantified expression.
+ *
+ */
+ public ForallExp() {
+ super(ExpID.FORALL, new AndExp());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public ForallExp standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public ForallExp standardize(Map<String, String> images) {
+ return (ForallExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ForallExp clone() {
+ return (ForallExp) super.clone();
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public ForallExp toDisjunctiveNormalForm() {
+ ForallExp dnf = this.clone();
+ dnf.exp = this.exp.toDisjunctiveNormalForm();
+ return dnf;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public ForallExp toConjunctiveNormalForm() {
+ ForallExp cnf = this.clone();
+ cnf.exp = this.exp.toConjunctiveNormalForm();
+ return cnf;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public ForallExp toNegativeNormalForm() {
+ ForallExp nnf = this.clone();
+ nnf.exp = this.exp.toNegativeNormalForm();
+ return nnf;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ Exp exp = null;
+ ForallExp forall = this.clone();
+ forall.exp = this.exp.moveQuantifierOutward();
+ if (forall.exp.getExpID().equals(ExpID.FORALL)) {
+ ForallExp other = (ForallExp) forall.exp;
+ for (Variable var : other) {
+ forall.add(var);
+ }
+ forall.setExp(other.exp);
+ exp = forall;
+ } else if (forall.exp.getExpID().equals(ExpID.WHEN)) {
+ WhenExp when = (WhenExp) forall.exp;
+ forall.setExp(when.getCondition());
+ when.setCondition(forall);
+ exp = when;
+ } else {
+ exp = forall;
+ }
+ return exp;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java
new file mode 100644
index 00000000000..afe024dd1a8
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ImplyExp.java
@@ -0,0 +1,367 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class is implemented by all implication expression of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class ImplyExp extends AbstractExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The head of the implication expression.
+ */
+ protected Exp head;
+
+ /**
+ * The body of the implication expression.
+ */
+ protected Exp body;
+
+ /**
+ * Creates a new empty implication expression with a specific head and body
+ * expressions.
+ *
+ * @param head the head the implication expression. The head of the imply
+ * expression must be a not null reference to an instance of
+ * <code>Exp</code>.
+ * @param body the body the implication expression. The body of the imply
+ * formula must be a not null reference to an instance of
+ * <code>Exp</code>.
+ */
+ public ImplyExp(Exp head, Exp body) {
+ super(ExpID.IMPLY);
+ this.head = head;
+ this.body = body;
+ }
+
+ /**
+ * Sets a new head to this implication expression.
+ *
+ * @param head the new head of this implication expression. The new head of
+ * the implication expression must be a not null reference to an
+ * instance of <code>Exp</code>.
+ * @throws NullPointerException if <code>head == null</code>.
+ */
+ public final void setHead(Exp head) {
+ if (head == null)
+ throw new NullPointerException();
+ this.head = head;
+ }
+
+ /**
+ * Returns the head of the implication expression.
+ *
+ * @return the head of the implication expression.
+ */
+ public final Exp getHead() {
+ return this.head;
+ }
+
+ /**
+ * Sets a new body to this implication expression.
+ *
+ * @param body the new body of this implication expression. The new body of
+ * the implication expression must be a not null reference to an
+ * instance of <code>Exp</code>.
+ * @throws NullPointerException if <code>body == null</code>.
+ */
+ public final void setBody(Exp body) {
+ if (body == null)
+ throw new NullPointerException();
+ this.body = body;
+ }
+
+ /**
+ * Returns the body of the implication expression.
+ *
+ * @return the body of the implication expression.
+ */
+ public final Exp getBody() {
+ return this.body;
+ }
+
+ /**
+ * Returns <code>true</code> if a exp occurs in this not
+ * expression.
+ *
+ * @param term the exp to be tested.
+ * @return <code>true</code> if a exp occurs in this not
+ * expression; <code>false</code> otherwise.
+ */
+ public final boolean occurs(Term term) {
+ return this.head.occurs(term) || this.body.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public final ImplyExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ return new ImplyExp(this.head.apply(sigma), this.body.apply(sigma));
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public ImplyExp standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public ImplyExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ return new ImplyExp(this.head.standardize(images),
+ this.body.standardize(images));
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.head.isGround() && this.body.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this implication expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>ImplyExp</code> and both implication expressions
+ * have the same head and body expressions.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this implication expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof ImplyExp) {
+ ImplyExp other = (ImplyExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.head.equals(other.head)
+ && this.body.equals(other.body);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the implication expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the implication expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.head.hashCode()
+ + this.body.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ImplyExp clone() {
+ ImplyExp other = (ImplyExp) super.clone();
+ other.head = this.head.clone();
+ other.body = this.body.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ Exp exp = null;
+ if (this.head.getExpID().equals(ExpID.EXIST)) {
+ ExistsExp exists = (ExistsExp) this.head;
+ ForallExp forall = new ForallExp();
+ for (Variable var : exists) {
+ forall.add(var.clone());
+ }
+ ImplyExp imply = new ImplyExp(exists.getExp(), this.body);
+ forall.setExp(imply.moveQuantifierOutward());
+ exp = forall.moveQuantifierOutward();
+ } else if (this.head.getExpID().equals(ExpID.FORALL)) {
+ ForallExp forall = (ForallExp) this.head;
+ ExistsExp exists = new ExistsExp();
+ for (Variable var : forall) {
+ exists.add(var.clone());
+ }
+ ImplyExp imply = new ImplyExp(forall.getExp(), this.body);
+ exists.setExp(imply.moveQuantifierOutward());
+ exp = exists.moveQuantifierOutward();
+ } else if (this.body.getExpID().equals(ExpID.EXIST)) {
+ ExistsExp exists = (ExistsExp) this.body;
+ ExistsExp tmp = new ExistsExp();
+ for (Variable var : exists) {
+ tmp.add(var.clone());
+ }
+ ImplyExp imply = new ImplyExp(this.head, exists.getExp());
+ tmp.setExp(imply.moveQuantifierOutward());
+ exp = tmp.moveQuantifierOutward();
+ } else if (this.body.getExpID().equals(ExpID.FORALL)) {
+ ForallExp forall = (ForallExp) this.body;
+ ForallExp tmp = new ForallExp();
+ for (Variable var : forall) {
+ tmp.add(var.clone());
+ }
+ ImplyExp imply = new ImplyExp(this.head, forall.getExp());
+ tmp.setExp(imply.moveQuantifierOutward());
+ exp = tmp.moveQuantifierOutward();
+ } else {
+ exp = this.clone();
+ }
+ return exp;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public OrExp toDisjunctiveNormalForm() {
+ return this.toNegativeNormalForm().toDisjunctiveNormalForm();
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public AndExp toConjunctiveNormalForm() {
+ return this.toNegativeNormalForm().toConjunctiveNormalForm();
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public OrExp toNegativeNormalForm() {
+ OrExp nnf = new OrExp();
+ nnf.add(new NotExp(this.head));
+ nnf.add(this.body);
+ return nnf.toNegativeNormalForm();
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.head.getFreeVariables());
+ vars.addAll(this.body.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns a string representation of the implication expression.
+ *
+ * @return a string representation of the implication expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(imply ");
+ str.append(this.head.toString());
+ str.append(" ");
+ str.append(this.body.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the implication expression.
+ *
+ * @return a typed string representation of the implication expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(imply ");
+ str.append(this.head.toTypedString());
+ str.append(" ");
+ str.append(this.body.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java
new file mode 100644
index 00000000000..09c22996ff4
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/InitEl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+/**
+ * This interface is implements by all expression that can be used in the PDDL
+ * language in the initial state description.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface InitEl extends Exp {
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java
new file mode 100644
index 00000000000..9a2ebdc31e3
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ListExp.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This abstract class implements the common part of the conjunctive and
+ * disjunctive expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class ListExp extends AbstractExp implements Iterable<Exp> {
+
+ /**
+ * The list of the elements contained in this list.
+ */
+ protected ArrayList<Exp> elements;
+
+ /**
+ * Creates a new empty list expression with a specific id.
+ *
+ * @param id The id of the list expression.
+ */
+ protected ListExp(ExpID id) {
+ super(id);
+ this.elements = new ArrayList<Exp>();
+ }
+
+ /**
+ * Creates a new list expression with a specific id and expressions.
+ *
+ * @param id The id of the list expression.
+ * @param exps an expressions list.
+ */
+ protected ListExp(ExpID id, Exp... exps) {
+ super(id);
+ for (Exp exp : exps) {
+ this.elements.add(exp);
+ }
+ }
+
+ /**
+ * Adds a new element to this to this list expression.
+ *
+ * @param elt the element to add. The element must be a not null reference.
+ * @return <code>true</code> if the element was added; <code>false</code>
+ * otherwise.
+ */
+ public final boolean add(Exp elt) {
+ boolean added = true;
+ if (elt.getExpID().equals(this.getExpID())) {
+ ListExp listExp = (ListExp) elt;
+ for (Exp exp : listExp) {
+ added &= this.elements.add(exp);
+ }
+ } else {
+ added = this.elements.add(elt);
+ }
+ return added;
+ }
+
+ /**
+ * Adds a new element to this to this list expression at a specified position.
+ *
+ * @param i the position where the element must be added.
+ * @param elt the element to add. The element must be a not null reference.
+ */
+ public final void add(int i, Exp elt) {
+ if (elt.getExpID().equals(this.getExpID())) {
+ ListExp listExp = (ListExp) elt;
+ int index = i;
+ for (Exp exp : listExp) {
+ this.elements.add(index, exp);
+ index++;
+ }
+ } else {
+ this.elements.add(i, elt);
+ }
+ }
+
+ /**
+ * Set a new element at a specified position.
+ *
+ * @param i the position where the element must be added.
+ * @param elt the element to add. The element must be a not null reference.
+ */
+ public final void set(int i, Exp elt) {
+ this.elements.set(i, elt);
+ }
+
+ /**
+ * Returns the element at a specified position.
+ *
+ * @param i the position of the element to be returned.
+ * @return the element at the specified position.
+ */
+ public final Exp get(int i) {
+ return this.elements.get(i);
+ }
+
+ /**
+ * Removes a specified elements of the list expression.
+ *
+ * @param elt the element to be removed.
+ * @return <code>true</code> if the element of the list expression was
+ * removed; <code>false</code> otherwise.
+ */
+ public final boolean remove(Exp elt) {
+ return this.elements.remove(elt);
+ }
+
+ /**
+ * Removes an elements of the list expression at a specified position.
+ *
+ * @param i the position of the element to be removed.
+ * @return the element removed.
+ */
+ public final Exp remove(int i) {
+ return this.elements.remove(i);
+ }
+
+ /**
+ * Returns an iterator over the elements contained in this list expression.
+ *
+ * @return an iterator over the elements contained in this list expression.
+ * @see java.lang.Iterable#iterator()
+ */
+ public final Iterator<Exp> iterator() {
+ return this.elements.iterator();
+ }
+
+ /**
+ * Returns <code>true</code> if an expression occurs in this list
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this list
+ * expression; <code>false</code> otherwise.
+ */
+ public final boolean occurs(Term term) {
+ boolean occurs = false;
+ Iterator<Exp> i = this.iterator();
+ while (i.hasNext() && !occurs) {
+ occurs = i.next().occurs(term);
+ }
+ return occurs;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding exp.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public ListExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ ListExp other = this.clone();
+ other.elements.clear();
+ for (Exp exp : this) {
+ other.add(exp.apply(sigma));
+ }
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ boolean isGround = true;
+ Iterator<Exp> i = this.iterator();
+ while (i.hasNext() && isGround) {
+ isGround = i.next().isGround();
+ }
+ return isGround;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public ListExp standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public ListExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ ListExp other = this.clone();
+ other.elements.clear();
+ for (Exp exp : this.elements) {
+ other.add(exp.standardize(images));
+ }
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ for (Exp exp : this) {
+ vars.addAll(exp.getFreeVariables());
+ }
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if this list expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>ListExp</code> and both conjunctive expressions have
+ * the same elements.
+ *
+ * @param obj - the reference object with which to compare.
+ * @return <code>true</code> if this list expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof ListExp) {
+ ListExp other = (ListExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.elements.equals(other.elements);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the list expression. This method is
+ * supported for the benefit of hashtables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the list expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.elements.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ListExp clone() {
+ ListExp other = (ListExp) super.clone();
+ other.elements = new ArrayList<Exp>();
+ for (Exp exp : this.elements) {
+ other.elements.add(exp.clone());
+ }
+ return other;
+ }
+
+ /**
+ * Returns the size of the list expression.
+ *
+ * @return the size of the list expression.
+ */
+ public final int size() {
+ return this.elements.size();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java
new file mode 100644
index 00000000000..3305e78ee5c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/Literal.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This interface defines a literal in the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface Literal extends InitEl, Iterable<Term> {
+
+ /**
+ * Returns the predicate of this literal.
+ *
+ * @return the predicate of this literal.
+ */
+ String getPredicate();
+
+ /**
+ * Adds a new term to this literal.
+ *
+ * @param term the term to add.
+ * @return <code>true</tt> if the term was added; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ boolean add(Term term);
+
+ /**
+ * Returns the arity of this literal.
+ *
+ * @return the arity of this literal.
+ */
+ int getArity();
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ Literal apply(Substitution sigma);
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java
new file mode 100644
index 00000000000..98678351733
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotAtomicFormula.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.Iterator;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements negative atomic formula of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class NotAtomicFormula extends NotExp implements Literal {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -1751696323200745754L;
+
+ /**
+ * Creates a new negative atomic formula with a specific atomic formula.
+ *
+ * @param atom the atomic formula contained in this negative atomic formula.
+ * @throws NullPointerException if <code>atom == null</code>.
+ */
+ public NotAtomicFormula(AtomicFormula atom) {
+ super(atom);
+ }
+
+ /**
+ * Sets a new predicate to this negative atomic formula.
+ *
+ * @param predicate the new predicate to set.
+ * @throws NullPointerException if <code>predicate == null</code>.
+ */
+ public final void setPredicate(String predicate) {
+ this.getExp().setPredicate(predicate);
+ }
+
+ /**
+ * Returns the predicate of this negative atomic formula.
+ *
+ * @return the predicate of this negative atomic formula.
+ */
+ public final String getPredicate() {
+ return this.getExp().getPredicate();
+ }
+
+ /**
+ * Adds a new term to this negative atomic formula.
+ *
+ * @param term the term to add.
+ * @return <code>true</tt> if the expression was added; <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean add(Term term) {
+ return this.getExp().add(term);
+ }
+
+ /**
+ * Returns the arity of this negative atomic formula.
+ *
+ * @return the arity of this negative atomic formula.
+ */
+ public final int getArity() {
+ return this.getExp().getArity();
+ }
+
+ /**
+ * Returns an iterator over the expression of this negative atomic formula.
+ *
+ * @return an iterator over the expression of this negative atomic formula.
+ * @see java.lang.Iterable#iterator()
+ */
+ public final Iterator<Term> iterator() {
+ return this.getExp().iterator();
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public final NotAtomicFormula apply(Substitution sigma) {
+ return new NotAtomicFormula((AtomicFormula) this.exp.apply(sigma));
+ }
+
+ /**
+ * Returns the negated expression of this expression.
+ *
+ * @return the negated expression of this expression.
+ */
+ public AtomicFormula getExp() {
+ return (AtomicFormula) super.getExp();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public NotAtomicFormula clone() {
+ return (NotAtomicFormula) super.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java
new file mode 100644
index 00000000000..0ebb4295112
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/NotExp.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class is implemented by all negative expression in the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class NotExp extends AbstractExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 4325921465416962373L;
+
+ /**
+ * The negative goal descriptions of this not formula.
+ */
+ protected Exp exp;
+
+ /**
+ * Creates a new empty negative expression from a specific expression.
+ *
+ * @param exp The negative expression.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public NotExp(Exp exp) {
+ super(ExpID.NOT);
+ if (exp == null)
+ throw new NullPointerException();
+ this.exp = exp;
+
+ }
+
+ /**
+ * Sets a new negative goal description to this not formula.
+ *
+ * @param exp the new negative expression to set.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public final void setExp(Exp exp) {
+ if (exp == null)
+ throw new NullPointerException();
+ this.exp = exp;
+ }
+
+ /**
+ * Returns the negative expression of expression.
+ *
+ * @return the negative expression of expression.
+ */
+ public Exp getExp() {
+ return this.exp;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this not expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this not expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public NotExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ return new NotExp(this.exp.apply(sigma));
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public NotExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public NotExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ return new NotExp(this.exp.standardize(images));
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this negative expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>NotExp</code> and both negative expressions have the
+ * same expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this negative expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof NotExp) {
+ NotExp other = (NotExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the negative expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the negative expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.exp.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public NotExp clone() {
+ NotExp other = (NotExp) super.clone();
+ other.exp = this.exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ Exp exp = null;
+ ExistsExp exists = null;
+ ForallExp forall = null;
+
+ switch(this.exp.getExpID()) {
+ case EXIST:
+ exists = (ExistsExp) this.exp;
+ forall = new ForallExp();
+ for (Variable var : exists) {
+ forall.add(var.clone());
+ }
+ forall.setExp(new NotExp(exists.getExp()).moveQuantifierOutward());
+ exp = forall.moveQuantifierOutward();
+ break;
+ case FORALL:
+ forall = (ForallExp) this.exp;
+ exists = new ExistsExp();
+ for (Variable var : forall) {
+ exists.add(var.clone());
+ }
+ exists.setExp(new NotExp(forall.getExp()).moveQuantifierOutward());
+ exp = exists.moveQuantifierOutward();
+ break;
+ default:
+ exp = this.clone();
+ }
+ return exp;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public OrExp toDisjunctiveNormalForm() {
+ Exp nnf = this.toNegativeNormalForm();
+ if (nnf.getExpID().equals(ExpID.NOT)) {
+ OrExp dnf = new OrExp();
+ dnf.add(new NotExp(this.exp.toDisjunctiveNormalForm()).toNegativeNormalForm());
+ return dnf;
+ }
+ return (OrExp) nnf.toDisjunctiveNormalForm();
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public AndExp toConjunctiveNormalForm() {
+ Exp nnf = this.toNegativeNormalForm();
+ if (nnf.getExpID().equals(ExpID.NOT)) {
+ AndExp cnf = new AndExp();
+ cnf.add(new NotExp(this.exp.toConjunctiveNormalForm()).toNegativeNormalForm());
+ return cnf;
+ }
+ return (AndExp) nnf.toConjunctiveNormalForm();
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public Exp toNegativeNormalForm() {
+ AndExp and = null;
+ OrExp or = null;
+ NotExp not = null;
+ ImplyExp imply = null;
+ ExistsExp exists = null;
+ ForallExp forall = null;
+
+ switch(this.exp.getExpID()) {
+ case AND:
+ and = (AndExp) this.exp;
+ or = new OrExp();
+ for (Exp e : and) {
+ not = new NotExp(e);
+ or.add(not.toNegativeNormalForm());
+ }
+ return or.size() == 1 ? or.get(0) : or;
+ case OR:
+ or = (OrExp) this.exp;
+ and = new AndExp();
+ for (Exp e : or) {
+ not = new NotExp(e);
+ and.add(not.toNegativeNormalForm());
+ }
+ return and.size() == 1 ? and.get(0) : and;
+ case NOT:
+ // return this.exp.toNegativeNormalForm();
+ return ((NotExp)this.exp).exp.toNegativeNormalForm();
+ case IMPLY:
+ imply = (ImplyExp) this.exp;
+ and = new AndExp();
+ and.add(imply.getHead());
+ and.add(new NotExp(imply.getBody()));
+ return and.toNegativeNormalForm();
+ case EXIST:
+ exists = (ExistsExp) this.exp;
+ forall = new ForallExp();
+ for (Variable var : exists) {
+ forall.add(var.clone());
+ }
+ forall.setExp(new NotExp(exists.getExp()).toNegativeNormalForm());
+ return forall;
+ case FORALL:
+ forall = (ForallExp) this.exp;
+ exists = new ExistsExp();
+ for (Variable var : forall) {
+ exists.add(var.clone());
+ }
+ exists.setExp(new NotExp(forall.getExp()).toNegativeNormalForm());
+ return exists;
+ default:
+ return this.clone();
+ }
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ return this.exp.getFreeVariables();
+ }
+
+ /**
+ * Returns a string representation of the negative expression.
+ *
+ * @return a string representation of the negative expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(not ");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the negative expression.
+ *
+ * @return a typed string representation of the negative expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(not ");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java
new file mode 100644
index 00000000000..af8f27d8449
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/OrExp.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This generic class is implemented by all disjunctive PDDL expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class OrExp extends ListExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 7735506016529447105L;
+
+ /**
+ * Creates a new empty disjunctive expression.
+ */
+ public OrExp() {
+ super(ExpID.OR);
+ }
+
+ /**
+ * Creates a new list expression with a specific id and expressions.
+ *
+ * @param exps an expressions list.
+ */
+ public OrExp(Exp... exps) {
+ super(ExpID.OR, exps);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public OrExp apply(Substitution sigma) {
+ return (OrExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return this expression.
+ */
+ public OrExp standardize() {
+ return this.standardize(new LinkedHashMap<String,String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return this expression.
+ * @throws IllegalArgumentException if <code>images == null || bound == null</code>.
+ */
+ public OrExp standardize(Map<String, String> images) {
+ return (OrExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public OrExp clone() {
+ return (OrExp) super.clone();
+ }
+
+ /**
+ * Returns the prenex normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the prenex normal form of this expression.
+ */
+ public Exp toPrenexNormaForm() {
+ return this.standardize().moveQuantifierOutward();
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ Exp qexp = null;
+ OrExp or = new OrExp();
+ Iterator<Exp> i = this.iterator();
+ while (i.hasNext()) {
+ Exp exp = i.next();
+ if (exp.getExpID().equals(ExpID.FORALL)) {
+ ForallExp forall = (ForallExp) exp;
+ ForallExp tmp = new ForallExp();
+ for (Variable var : forall) {
+ tmp.add(var);
+ }
+ or.add(forall.getExp());
+ while (i.hasNext()) {
+ or.add(i.next());
+ }
+ tmp.setExp(or.moveQuantifierOutward());
+ qexp = tmp;
+ }
+ else if (exp.getExpID().equals(ExpID.EXIST)) {
+ ExistsExp exists = (ExistsExp) exp;
+ ExistsExp tmp = new ExistsExp();
+ for (Variable var : exists) {
+ tmp.add(var);
+ }
+ or.add(exists.getExp());
+ while (i.hasNext()) {
+ or.add(i.next());
+ }
+ tmp.setExp(or.moveQuantifierOutward());
+ qexp = tmp;
+ } else {
+ or.add(exp);
+ }
+ }
+ return qexp == null ? or : qexp;
+
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public OrExp toNegativeNormalForm() {
+ OrExp other = new OrExp();
+ for (Exp exp : this) {
+ other.add(exp.toNegativeNormalForm());
+ }
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public OrExp toDisjunctiveNormalForm() {
+ OrExp nnf = this.toNegativeNormalForm();
+ OrExp dnf = new OrExp();
+ for (Exp i : nnf) {
+ Exp exp = i.toDisjunctiveNormalForm();
+ dnf.add(exp);
+ }
+ return dnf;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public AndExp toConjunctiveNormalForm() {
+ OrExp nnf = this.toNegativeNormalForm();
+ AndExp cnf = new AndExp();
+ cnf.add(new OrExp());
+ for (Exp e : nnf) {
+ Exp ecnf = e.toConjunctiveNormalForm();
+ if (ecnf.getExpID().equals(ExpID.AND)) {
+ AndExp and = (AndExp) ecnf;
+ AndExp newCnf = new AndExp();
+ for (Exp ae : and) {
+ for (Exp or : cnf) {
+ OrExp other = (OrExp) or.clone();
+ other.add(ae);
+ newCnf.add(other);
+ }
+ }
+ cnf = newCnf;
+ } else {
+ for (Exp ex : cnf) {
+ ((OrExp) ex).add(ecnf);
+ }
+ }
+ }
+ return cnf;
+ }
+
+ /**
+ * Returns a string representation of the disjunctive expression.
+ *
+ * @return a string representation of the disjunctive expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(or");
+ for (Exp elt : this.elements) {
+ str.append(" ");
+ str.append(elt.toString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the disjunctive expression.
+ *
+ * @return a typed string representation of the disjunctive expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(or");
+ for (Exp elt : this.elements) {
+ str.append(" ");
+ str.append(elt.toTypedString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java
new file mode 100644
index 00000000000..2127e4b9379
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/PrefExp.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements the common methods of all preference expressions of the
+ * PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class PrefExp extends AbstractExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 2518753354183976408L;
+
+ /**
+ * The name of this preference.
+ */
+ private String name;
+
+ /**
+ * The goal description of the preference.
+ */
+ private Exp exp;
+
+ /**
+ * Creates a new preference expression with a specific expression name and
+ * expression preference.
+ *
+ * @param name The name of the preference.
+ * @param exp The preference expression.
+ * @throws NullPointerException if <code>name == null</code> or
+ * <code>exp == null</code>.
+ */
+ public PrefExp(String name, Exp exp) {
+ super(ExpID.PREFERENCE);
+ if (name == null || exp == null)
+ throw new NullPointerException();
+ this.name = name;
+ this.exp = exp;
+ }
+
+ /**
+ * Creates a new preference expression with a specific expression
+ * preference.
+ *
+ * @param exp The preference expression.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public PrefExp(Exp exp) {
+ this(new String(), exp);
+ }
+
+ /**
+ * Returns the name of the preference expression.
+ *
+ * @return the name of the preference expression.
+ */
+ public final String getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets a new name to the preference expression.
+ *
+ * @param name the new name to set.
+ * @throws NullPointerException if <code>name == null</code>.
+ */
+ public final void setName(String name) {
+ if (name == null)
+ throw new NullPointerException();
+ this.name = name;
+ }
+
+ /**
+ * Returns the expression describing the preference.
+ *
+ * @return the expression describing the preference.
+ */
+ public final Exp getExp() {
+ return this.exp;
+ }
+
+ /**
+ * Sets a new expression describing the preference.
+ *
+ * @param exp the new expression describing the preference.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public final void setExp(Exp exp) {
+ if (exp == null)
+ throw new NullPointerException();
+ this.exp = exp;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this preference
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this preference
+ * expression; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public PrefExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ return new PrefExp(this.name, this.exp.apply(sigma));
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public PrefExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public PrefExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ return new PrefExp(this.exp.standardize(images));
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this preference expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>PrefExp</code> and both preference expressions have
+ * the name and expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this preference expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof PrefExp) {
+ PrefExp other = (PrefExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.name.equals(other.name)
+ && this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the preference expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the preference expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.name.hashCode()
+ + this.exp.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public PrefExp clone() {
+ PrefExp other = (PrefExp) super.clone();
+ other.exp = this.exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ return new PrefExp(this.name, this.exp.moveQuantifierOutward());
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public PrefExp toDisjunctiveNormalForm() {
+ return new PrefExp(this.name, this.exp.toDisjunctiveNormalForm());
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public PrefExp toConjunctiveNormalForm() {
+ return new PrefExp(this.name, this.exp.toConjunctiveNormalForm());
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public PrefExp toNegativeNormalForm() {
+ return new PrefExp(this.name, this.exp.toNegativeNormalForm());
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ return this.exp.getFreeVariables();
+ }
+
+ /**
+ * Returns a string representation of the preference expression.
+ *
+ * @return a string representation of the preference expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(preference ");
+ str.append(this.name.toString());
+ str.append(" ");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the preference expression.
+ *
+ * @return a typed string representation of the preference expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(preference ");
+ str.append(this.name.toString());
+ str.append(" ");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java
new file mode 100644
index 00000000000..029584d4074
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/ProbExp.java
@@ -0,0 +1,300 @@
+package pddl4j.exp;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+public class ProbExp extends AbstractExp{
+
+ protected Map<Exp, Double> terms;
+
+
+
+ public ProbExp() {
+ super(ExpID.PROB_EXP);
+
+ terms = new LinkedHashMap<Exp, Double>();
+ }
+
+ //TODO make this prettier. Maybe refactor to make a ListExp?
+ public void addExp(Exp exp, double prob){
+
+ if(exp.getExpID() == ExpID.PROB_EXP){
+
+ ProbExp prob_child = (ProbExp)exp;
+
+ Iterator<Exp> child_children = prob_child.iterator();
+
+ while(child_children.hasNext()){
+ Exp toAdd = child_children.next();
+ addExp(toAdd, (prob*prob_child.getProbability(toAdd)));
+ }
+ }
+ else if(exp.getExpID() == ExpID.AND){
+
+ AndExp and_child = (AndExp)exp;
+ if(and_child.size() == 1){
+ addExp(and_child.iterator().next(), prob);
+ }else if(and_child.size() == 0){
+
+ }else{
+ terms.put(exp, prob);
+ }
+ }
+ else{
+ terms.put(exp, prob);
+ }
+ }
+
+ public void removeExp(Exp exp){
+ terms.remove(exp);
+ }
+
+ public ProbExp apply(Substitution sigma) {
+
+ ProbExp p = new ProbExp();
+
+ for(Exp e: terms.keySet()){
+ p.addExp(e.clone().apply(sigma), terms.get(e));
+ }
+
+
+
+ return p;
+ }
+
+ @Override
+ public Set<Variable> getFreeVariables() {
+
+ Set<Variable> vars = new HashSet<Variable>();
+
+ for(Exp e: terms.keySet()){
+ for(Variable v: e.getFreeVariables()){
+ vars.add(v);
+ }
+ }
+
+ return vars;
+ }
+
+ @Override
+ public boolean isGround() {
+
+ for(Exp e: terms.keySet()){
+ if(!e.isGround()){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean occurs(Term term) {
+
+ for(Exp e: terms.keySet()){
+ if(e.occurs(term)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public Exp standardize() {
+
+
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ @Override
+ public Exp standardize(Map<String, String> images) {
+
+ ProbExp p = new ProbExp();
+
+ for(Exp e: terms.keySet()){
+ p.addExp(e.standardize(images), terms.get(e));
+ }
+
+ return p;
+ }
+
+ public String toString(){
+
+ String s = "(probabilistic ";
+ for(Exp e: terms.keySet()){
+ s+=terms.get(e)+" "+e.toString()+" ";
+ }
+
+ return s;
+ }
+
+ @Override
+ public String toTypedString() {
+
+ String s = "(probabilistic ";
+ for(Exp e: terms.keySet()){
+ s+=terms.get(e)+" "+e.toTypedString()+" ";
+ }
+
+ return s;
+ }
+
+ public Iterator<Exp> iterator(){
+ return terms.keySet().iterator();
+ }
+
+ public double getProbability(Exp e){
+ return terms.get(e);
+ }
+
+ public ProbExp clone(){
+
+ ProbExp clone = new ProbExp();
+
+ for(Exp e: terms.keySet()){
+ clone.addExp(e.clone(), terms.get(e));
+ }
+
+ return clone;
+ }
+
+ public int size(){
+ return terms.size();
+ }
+
+
+//
+// public final void setExp(Exp exp) {
+// if (exp == null)
+// throw new NullPointerException();
+// this.exp = exp;
+// }
+//
+// public Exp getExp() {
+// return this.exp;
+// }
+//
+// public final boolean occurs(Term term) {
+// if (term == null)
+// throw new NullPointerException();
+// return this.exp.occurs(term);
+// }
+//
+// public NotExp apply(Substitution sigma) {
+// if (sigma == null)
+// throw new NullPointerException();
+// return new NotExp(this.exp.apply(sigma));
+// }
+//
+// public NotExp standardize() {
+// return this.standardize(new LinkedHashMap<String, String>());
+// }
+//
+// public NotExp standardize(Map<String, String> images) {
+// if (images == null)
+// throw new NullPointerException();
+// return new NotExp(this.exp.standardize(images));
+// }
+//
+// public final boolean isGround() {
+// return this.exp.isGround();
+// }
+//
+// public boolean equals(Object obj) {
+// if (obj != null && obj instanceof ProbExp) {
+// ProbExp other = (ProbExp) obj;
+// return this.getExpID().equals(other.getExpID())
+// && this.exp.equals(other.exp)
+// && this.probability == other.probability;
+// }
+// return false;
+// }
+//
+// public int hashCode() {
+// return this.getExpID().hashCode() + this.exp.hashCode();
+// }
+//
+// public ProbExp clone() {
+// ProbExp other = (ProbExp) super.clone();
+// other.exp = this.exp.clone();
+// other.probability = this.probability;
+// return other;
+// }
+//
+// public Exp moveQuantifierOutward() {
+//// Exp exp = null;
+//// ExistsExp exists = null;
+//// ForallExp forall = null;
+////
+//// switch(this.exp.getExpID()) {
+//// case EXIST:
+//// exists = (ExistsExp) this.exp;
+//// forall = new ForallExp();
+//// for (Variable var : exists) {
+//// forall.add(var.clone());
+//// }
+//// forall.setExp(new NotExp(exists.getExp()).moveQuantifierOutward());
+//// exp = forall.moveQuantifierOutward();
+//// break;
+//// case FORALL:
+//// forall = (ForallExp) this.exp;
+//// exists = new ExistsExp();
+//// for (Variable var : forall) {
+//// exists.add(var.clone());
+//// }
+//// exists.setExp(new NotExp(forall.getExp()).moveQuantifierOutward());
+//// exp = exists.moveQuantifierOutward();
+//// break;
+//// default:
+//// exp = this.clone();
+//// }
+// return exp;
+// }
+//
+// public OrExp toDisjunctiveNormalForm() {
+// OrExp dnf = new OrExp();
+// dnf.add(this.clone());
+//
+// return dnf;
+// }
+//
+// public AndExp toConjunctiveNormalForm() {
+//
+// AndExp cnf = new AndExp();
+// cnf.add(this.clone());
+// return cnf;
+// }
+// public Exp toNegativeNormalForm() {
+// return this.clone();
+// }
+//
+// public Set<Variable> getFreeVariables() {
+// return this.exp.getFreeVariables();
+// }
+//
+// public String toString() {
+// StringBuffer str = new StringBuffer();
+// str.append("(probabilistic ");
+// str.append(this.probability+" ");
+// str.append(this.exp.toString());
+// str.append(")");
+// return str.toString();
+// }
+//
+// public String toTypedString() {
+// StringBuffer str = new StringBuffer();
+// str.append("(probabilistic ");
+// str.append(this.probability+" ");
+// str.append(this.exp.toTypedString());
+// str.append(")");
+// return str.toString();
+// }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java
new file mode 100644
index 00000000000..9c1549094e1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/QuantifiedExp.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This abstract class is extended by all quantified expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class QuantifiedExp extends AbstractExp implements
+ Iterable<Variable> {
+
+ /**
+ * The typed list of the quantified variables.
+ */
+ protected Set<Variable> vars;
+
+ /**
+ * The quantified expression.
+ */
+ protected Exp exp;
+
+ /**
+ * Creates a new quantified expression with a specific id, typed list of
+ * quantified variables and quantified expression.
+ *
+ * @param id The id of the list expression.
+ * @param vars The typed list of quantified variables.
+ * @param exp The quantified expression.
+ */
+ protected QuantifiedExp(ExpID id, Set<Variable> vars, Exp exp) {
+ super(id);
+ this.vars = vars;
+ this.exp = exp;
+ }
+
+ /**
+ * Creates a new quantified expression with a specific id, typed list of
+ * quantified variables and quantified expression.
+ *
+ * @param id The id of the list expression.
+ * @param exp The quantified expression.
+ */
+ protected QuantifiedExp(ExpID id, Exp exp) {
+ this(id, new LinkedHashSet<Variable>(), exp);
+ }
+
+ /**
+ * Creates a new quantified expression with a specific id, typed list of
+ * quantified variables and quantified expression.
+ *
+ * @param id The id of the list expression.
+ */
+ protected QuantifiedExp(ExpID id) {
+ this(id, new LinkedHashSet<Variable>(), new AndExp());
+ }
+
+ /**
+ * Adds a new quantified variable to this quantified expression.
+ *
+ * @param var the quantified variable to add.
+ * @return <code>true</code> if the quantified variable was added;
+ * <code>false</code> otherwise.
+ */
+ public boolean add(Variable var) {
+ return this.vars.add(var);
+ }
+
+ /**
+ * Sets the quantified goal description of this universal expression.
+ *
+ * @param exp the quantified expression. The goal description must be a not
+ * null reference.
+ */
+ public final void setExp(Exp exp) {
+ this.exp = exp;
+ }
+
+ /**
+ * Returns the quantified goal description of this universal expression.
+ *
+ * @return the quantified goal description of this universal expression.
+ */
+ public final Exp getExp() {
+ return this.exp;
+ }
+
+ /**
+ * Returns <code>true</code> if this quantified expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>QuantifiedExpression</code> and both quantified
+ * expressions have the list of bound variable and quantified expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this quantified expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof QuantifiedExp) {
+ QuantifiedExp other = (QuantifiedExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.vars.equals(other.vars)
+ && this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this quantified expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return the hash code value of this quantified expression.
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.vars.hashCode()
+ + this.exp.hashCode();
+ }
+
+ /**
+ * Returns an iterator over the bounded variables of the quantified
+ * expression.
+ *
+ * @return an iterator over the bounded variables of the quantified
+ * expression.
+ * @see java.lang.Iterable#iterator()
+ */
+ public final Iterator<Variable> iterator() {
+ return this.vars.iterator();
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * expression.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression if all bound variables are not instantiated; the
+ * quantified copy expression otherwise.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public final Exp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ QuantifiedExp other = this.clone();
+ other.exp = this.exp.apply(sigma);
+ Iterator<Variable> i = other.vars.iterator();
+ while (i.hasNext()) {
+ Variable var = i.next();
+ if (!other.exp.occurs(var)) {
+ i.remove();
+ }
+ }
+ return other.vars.isEmpty() ? other.exp : this;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public QuantifiedExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public QuantifiedExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ Map<String, String> newImages = new LinkedHashMap<String,String>(images);
+ QuantifiedExp other = this.clone();
+ other.vars.clear();
+ for (Variable var : this.vars) {
+ other.add(var.standardizeQuantifiedVariable(newImages));
+ }
+ other.exp = other.exp.standardize(newImages);
+ for (Map.Entry<String, String> e : newImages.entrySet()) {
+ if (!images.containsKey(e.getKey())) {
+ images.put(e.getKey(), Variable.getStandardizedImage(e.getValue()));
+ }
+ }
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this quantified
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this quantified
+ * expression; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+ /**
+ * Returns the prenex normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the prenex normal form of this expression.
+ */
+ public Exp toPrenexNormaForm() {
+ QuantifiedExp pnf = this.standardize();
+ pnf.exp = pnf.exp.moveQuantifierOutward();
+ return pnf;
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public QuantifiedExp clone() {
+ QuantifiedExp other = (QuantifiedExp) super.clone();
+ other.vars = new LinkedHashSet<Variable>();
+ for (Variable var : this.vars) {
+ other.vars.add(var.clone());
+ }
+ other.exp = this.exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.exp.getFreeVariables());
+ vars.removeAll(this.vars);
+ return vars;
+ }
+
+ /**
+ * Returns a string representation of the quantified expression.
+ *
+ * @return a string representation of the quantified expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(" + this.getExpID().toString().toLowerCase() + " ");
+ str.append("(");
+ if (!this.vars.isEmpty()) {
+ Iterator<Variable> i = this.iterator();
+ str.append(i.next().toString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toString());
+ }
+ }
+ str.append(")");
+ str.append(" ");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the quantified expression.
+ *
+ * @return a typed string representation of the quantified expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(" + this.getExpID().toString().toLowerCase() + " ");
+ str.append("(");
+ if (!this.vars.isEmpty()) {
+ Iterator<Variable> i = this.iterator();
+ str.append(i.next().toTypedString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toTypedString());
+ }
+ }
+ str.append(")");
+ str.append(" ");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java
new file mode 100644
index 00000000000..0489e16b208
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/WhenExp.java
@@ -0,0 +1,347 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements a conditional expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class WhenExp extends AbstractExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -1373199261710247868L;
+
+ /**
+ * The condition of the expression.
+ */
+ private Exp condition;
+
+ /**
+ * The effect of the conditional effect expression.
+ */
+ private Exp effect;
+
+ /**
+ * Creates a new conditional expression.
+ *
+ * @param condition The condition expression.
+ * @param effect The effect expression.
+ * @throws NullPointerException if <code>condition == null</code> or
+ * <code>effect == null</code>.
+ */
+ public WhenExp(Exp condition, Exp effect) {
+ super(ExpID.WHEN);
+ if (condition == null || effect == null)
+ throw new NullPointerException();
+ this.condition = condition;
+ this.effect = effect;
+ }
+
+ /**
+ * Creates a new conditional expression.
+ */
+ private WhenExp() {
+ super(ExpID.WHEN);
+ this.condition = null;
+ this.effect = null;
+ }
+
+ /**
+ * Returns the condition of this conditional expression.
+ *
+ * @return the condition of this conditional expression.
+ */
+ public final Exp getCondition() {
+ return this.condition;
+ }
+
+ /**
+ * Sets a new condition to this this conditional expression.
+ *
+ * @param condition the new condition to set.
+ * @throws NullPointerException if <code>condition == null</code>.
+ */
+ public final void setCondition(Exp condition) {
+ if (condition == null)
+ throw new NullPointerException();
+ this.condition = condition;
+ }
+
+ /**
+ * Returns the effect of this conditional expression.
+ *
+ * @return the effect of this conditional expression.
+ */
+ public final Exp getEffect() {
+ return this.effect;
+ }
+
+ /**
+ * Sets a new effect to this conditional expression.
+ *
+ * @param effect The effect to set.
+ * @throws NullPointerException if <code>condition == null</code>.
+ */
+ public final void setEffect(Exp effect) {
+ if (effect == null)
+ throw new NullPointerException();
+ this.effect = effect;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this when expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this when expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.condition.occurs(term) || this.effect.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public WhenExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ return new WhenExp(this.condition.apply(sigma),
+ this.effect.apply(sigma));
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ * @see pddl4j.exp.Exp#standardize()
+ */
+ public WhenExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public WhenExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ return new WhenExp(this.condition.standardize(images),
+ this.effect.standardize(images));
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.condition.isGround() && this.effect.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this conditional expression is equal to an
+ * other object, i.e., if the object is a not null reference to an instance
+ * of the class <code>WhenExp</code> and both conditional expressions have
+ * the same condition and effect.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this conditional expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof WhenExp) {
+ WhenExp other = (WhenExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.condition.equals(other.condition)
+ && this.effect.equals(other.effect);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the conditional expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the conditional expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.condition.hashCode()
+ + this.effect.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public WhenExp clone() {
+ WhenExp other = (WhenExp) super.clone();
+ other.condition = this.condition.clone();
+ other.effect = this.effect.clone();
+ return other;
+ }
+
+ /**
+ * Normalize this when expression. The condition is converted into
+ * disjunctive normal form and effect in conjunctive normal form.
+ *
+ * @return a normalize copy of this when expression.
+ */
+ public WhenExp normalize() {
+ return new WhenExp(this.condition.moveQuantifierOutward().toDisjunctiveNormalForm(),
+ this.effect.toConjunctiveNormalForm());
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ return new WhenExp(this.condition.moveQuantifierOutward(),
+ this.effect.moveQuantifierOutward());
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public WhenExp toDisjunctiveNormalForm() {
+ return new WhenExp(this.condition.toDisjunctiveNormalForm(),
+ this.effect.toDisjunctiveNormalForm());
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public WhenExp toConjunctiveNormalForm() {
+ return new WhenExp(this.condition.toConjunctiveNormalForm(),
+ this.effect.toConjunctiveNormalForm());
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public WhenExp toNegativeNormalForm() {
+ return new WhenExp(this.condition.toNegativeNormalForm(), this.effect
+ .toNegativeNormalForm());
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.condition.getFreeVariables());
+ vars.addAll(this.effect.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns a string representation of the conditional expression.
+ *
+ * @return a string representation of the conditional expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(when ");
+ str.append(this.condition.toString());
+ str.append(" ");
+ str.append(this.effect.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the conditional expression.
+ *
+ * @return a typed string representation of the conditional expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(when ");
+ str.append(this.condition.toTypedString());
+ str.append(" ");
+ str.append(this.effect.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java
new file mode 100644
index 00000000000..222a28391f5
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/AbstractActionDef.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.action;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the common structures and method shares by all PDDL
+ * action.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class AbstractActionDef implements ActionDef {
+
+ /**
+ * The action id.
+ */
+ private ActionID id;
+
+ /**
+ * The image of this action.
+ */
+ protected String name;
+
+ /**
+ * The parameters of the action.
+ */
+ protected List<Term> parameters;
+
+ /**
+ * Creates a new action with a specific image.
+ *
+ * @param id the kind of the action.
+ * @param name The name of the action. The image of an action must be a
+ * not null reference.
+ * @throws NullPointerException if <code>id == null || name == null<code>.
+ */
+ protected AbstractActionDef(ActionID id, String name) {
+ this.id = id;
+ this.setName(name);
+ this.parameters = new ArrayList<Term>();
+ }
+
+ /**
+ * Returns the action id of this action.
+ *
+ * @return the action id of this action.
+ * @see pddl4j.exp.action.ActionID
+ */
+ public final ActionID getActionID() {
+ return this.id;
+ }
+
+ /**
+ * Returns the image of the action.
+ *
+ * @return the image of this action.
+ */
+ public final String getName() {
+ return this.name;
+ }
+
+ /**
+ * Adds a parameter to this action.
+ *
+ * @param param the parameters to add.
+ * @return <code>true</code> if the parameter was added;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>param == null</code>.
+ */
+ public final boolean add(Term param) {
+ if (param == null)
+ throw new NullPointerException();
+ return this.parameters.add(param);
+ }
+
+ /**
+ * Returns the parameters of the action.
+ *
+ * @return the parameters of this action.
+ */
+ public final List<Term> getParameters() {
+ return this.parameters;
+ }
+
+ /**
+ * Sets a new image to this action.
+ *
+ * @param name The new name to set. The image of an action must be a not
+ * null reference.
+ * @throws NullPointerException if <code>name == null</code>.
+ */
+ public final void setName(String name) {
+ if (name == null)
+ throw new NullPointerException();
+ this.name = name;
+ }
+
+ /**
+ * Returns <code>true</code> if a specified expression occurs in the
+ * parameters of this action.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a specified expression occurs in the
+ * parameters of this action; <code>false</code> otherwise.
+ * @see pddl4j.exp.Exp#occurs(pddl4j.exp.term.Term)
+ */
+ public final boolean occurs(Term term) {
+ return this.parameters.contains(term);
+ }
+
+ /**
+ * Returns an iterator over the parameters of this action.
+ *
+ * @return an iterator over the parameters of this action.
+ */
+ public final Iterator<Term> iterator() {
+ return this.parameters.iterator();
+ }
+
+ /**
+ * Returns <code>true</code> if the abstract action is ground.
+ *
+ * @return <code>true</code> if the abstract action is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public boolean isGround() {
+ boolean gound = true;
+ Iterator<Term> i = this.parameters.iterator();
+ while (i.hasNext() && gound) {
+ gound = i.next().isGround();
+ }
+ return gound;
+ }
+
+ /**
+ * Returns <code>true</code> if this action is equal to an other
+ * object, i.e., if the object is a not null instance of the class
+ * <code>Action</code> and both action have the same name.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if this action is equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ public final boolean equals(Object obj) {
+ if (obj != null && obj instanceof ActionDef) {
+ Action other = (Action) obj;
+ return this.getName().equals(other.getName());
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the action. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the strips action.
+ */
+ public final int hashCode() {
+ return this.getName().hashCode();
+ }
+
+ /**
+ * Returns a deep copy of this abstract action.
+ *
+ * @return a deep copy of this abstract action.
+ * @see pddl4j.exp.AbstractExp#clone()
+ */
+ public AbstractActionDef clone() {
+ AbstractActionDef other = null;
+ try {
+ other = (AbstractActionDef) super.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ other.parameters = new ArrayList<Term>();
+ for (Term param : this.parameters) {
+ other.parameters.add(param.clone());
+ }
+ return other;
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java
new file mode 100644
index 00000000000..b0fc2d953be
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/Action.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.action;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Iterator;
+
+import pddl4j.exp.AndExp;
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements a strips action of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class Action extends AbstractActionDef {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -991066278473010044L;
+
+ /**
+ * The preconditions of the action.
+ */
+ private Exp precondition;
+
+ /**
+ * The effect of the action.
+ */
+ private Exp effect;
+
+ /**
+ * Creates a new strips action with a specific image. By default the
+ * precondition is set to an empty conjunctive precondition goal description
+ * and the effect to an empty proposition effect.
+ *
+ * @param name - the name of the action. The image musts be a not reference
+ * to a string.
+ * @throws NullPointerException if <code>name == null<code>.
+ */
+ public Action(String name) {
+ super(ActionID.ACTION, name);
+ this.precondition = new AndExp();
+ this.effect = new AndExp();
+ }
+
+ /**
+ * Returns the precondition of the action.
+ *
+ * @return the precondition of the action.
+ */
+ public final Exp getPrecondition() {
+ return this.precondition;
+ }
+
+ /**
+ * Sets the new precondition of the action.
+ *
+ * @param pre the new precondition of the action.
+ * @throws NullPointerException if <code>pre == null</code>.
+ */
+ public final void setPrecondition(Exp pre) {
+ if (pre == null)
+ throw new NullPointerException();
+ this.precondition = pre;
+ }
+
+ /**
+ * Returns the effect of the action.
+ *
+ * @return the effect of the action.
+ * @throws NullPointerException if <code>effect == null</code>.
+ */
+ public final Exp getEffect() {
+ return this.effect;
+ }
+
+ /**
+ * Sets the new effect of the action.
+ *
+ * @param effect the new effect of the action.
+ */
+ public final void setEffect(Exp effect) {
+ if (effect == null)
+ throw new NullPointerException();
+ this.effect = effect;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Action standardize() {
+ Map<String,String> images = new LinkedHashMap<String, String>();
+ Action other = this.clone();
+ other.parameters.clear();
+ for (Term param : this.parameters) {
+ other.add(param.standardize(images));
+ }
+ other.precondition = this.precondition.standardize(images);
+ other.effect = this.effect.standardize(images);
+ return other;
+ }
+
+ /**
+ * Normalize this action. This method returns a copy of this action where:
+ * <ul>
+ * <li> each variable is standardized,</li>
+ * <li> precondition expression is convert into disjunctive prenex normal
+ * form and</li>
+ * <li> effect expression is is convert into conjunctive prenex normal form.</li>
+ * <ul>
+ *
+ * @return a normalize copy of this action.
+ * @see pddl4j.exp.Exp#toPrenexNormaForm()
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public Action normalize() {
+ Action other = (Action) this.standardize();
+ other.precondition = other.precondition.moveQuantifierOutward()
+ .toDisjunctiveNormalForm();
+ other.effect = other.effect.moveQuantifierOutward()
+ .toConjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the action is ground.
+ *
+ * @return <code>true</code> if the action is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public boolean isGround() {
+ return super.isGround() && this.precondition.isGround()
+ && this.effect.isGround();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Action clone() {
+ Action other = (Action) super.clone();
+ other.precondition = this.precondition.clone();
+ other.effect = this.effect.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of the action.
+ *
+ * @return a string representation of the action.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:action ");
+ str.append(this.getName().toString());
+ str.append("\n");
+ str.append(" :parameters ");
+ str.append("(");
+ if (!this.parameters.isEmpty()) {
+ Iterator<Term> i = this.parameters.iterator();
+ Term param = i.next();
+ str.append(param.toTypedString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toTypedString());
+ }
+ }
+ str.append(")");
+ str.append("\n :precondition ");
+ str.append(this.precondition.toString());
+ str.append("\n :effect ");
+ str.append(this.effect.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the action.
+ *
+ * @return a typed string representation of the action.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:action ");
+ str.append(this.getName().toString());
+ str.append("\n");
+ str.append(" :parameters ");
+ str.append("(");
+ if (!this.parameters.isEmpty()) {
+ Iterator<Term> i = this.parameters.iterator();
+ str.append(i.next().toTypedString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toTypedString());
+ }
+ }
+ str.append(")");
+ str.append("\n :precondition ");
+ str.append(this.precondition.toTypedString());
+ str.append("\n :effect ");
+ str.append(this.effect.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java
new file mode 100644
index 00000000000..41b7132a3bd
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionDef.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.action;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import pddl4j.exp.term.Term;
+
+/**
+ * This interface is implemented by all type of action defined in the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface ActionDef extends Iterable<Term>, Serializable, Cloneable {
+
+ /**
+ * Returns the action id of this action.
+ *
+ * @return the action id of this action.
+ * @see pddl4j.exp.action.ActionID
+ */
+ ActionID getActionID();
+
+ /**
+ * Returns the image of the action.
+ *
+ * @return the image of this action.
+ */
+ String getName();
+
+ /**
+ * Returns the parameters of the action.
+ *
+ * @return the parameters of the action.
+ */
+ List<Term> getParameters();
+
+ /**
+ * Adds a parameter to this action.
+ *
+ * @param param the parameters to add.
+ * @return <code>true</code> if the parameter was added;
+ * <code>false</code> otherwise.
+ */
+ boolean add(Term param);
+
+ /**
+ * Returns an iterator over the parameters of the action.
+ *
+ * @return an iterator over the parameters of the action.
+ */
+ Iterator<Term> iterator();
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ */
+ boolean isGround();
+
+ /**
+ * Returns <code>true</code> if this expression is equal to an other
+ * object, i.e., if the object is a not null instance of the class of the
+ * expression and both expressions have the same content.
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this expression is equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns a hash code value for the expression. This method is supported
+ * for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the expression.
+ */
+ int hashCode();
+
+ /**
+ * Returns a string representation of the expression.
+ *
+ * @return a string representation of the expression.
+ */
+ String toString();
+
+ /**
+ * Returns <code>true</code> if a term occurs in the parameters of this action.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ boolean occurs(Term term);
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ ActionDef standardize();
+
+ /**
+ * Normalize this action. This method returns a copy of this action where:
+ * <ul>
+ * <li> each variable is standardized,</li>
+ * <li> precondition expression is convert into disjunctive prenex normal
+ * form and</li>
+ * <li> effect expression is is convert into conjunctive prenex normal form.</li>
+ * <ul>
+ *
+ * @return a normalize copy of this action.
+ * @see pddl4j.exp.Exp#toPrenexNormaForm()
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ ActionDef normalize();
+
+ /**
+ * Returns a deep copy of this action. Creates and returns a copy of this
+ * action. The precise meaning of "copy" is as follow:
+ *
+ * <pre>
+ * x.clone() != x
+ * </pre>
+ *
+ * will be true, and that the expression:
+ *
+ * <pre>
+ * x.clone().getClass() == x.getClass()
+ * </pre>
+ *
+ * will be true. While it is the case that:
+ *
+ * <pre>
+ * x.clone().equals(x)
+ * </pre>
+ *
+ * will be true. Finally, note that except type of term expression are
+ * deeply copy.
+ *
+ * @return a deep copy of this expression.
+ * @see java.lang.Cloneable
+ */
+ ActionDef clone();
+
+ /**
+ * Returns a typed string of this action.
+ *
+ * @return a typed string of this action.
+ */
+ String toTypedString();
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java
new file mode 100644
index 00000000000..54a246bb5a1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/ActionID.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.action;
+
+/**
+ * This enumeration list all action id used in the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum ActionID {
+ /**
+ * The action expression id.
+ */
+ ACTION,
+ /**
+ * The durative action expression id.
+ */
+ DURATIVE_ACTION,
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java
new file mode 100644
index 00000000000..035f4ff2cf0
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/DurativeAction.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.action;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Iterator;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements a durative action of the PDDl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class DurativeAction extends AbstractActionDef {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 7123555664571927698L;
+
+ /**
+ * The duration constraint of the action.
+ */
+ private Exp constraint;
+
+ /**
+ * The condition of the durative action.
+ */
+ private Exp condition;
+
+ /**
+ * The effect of the durative action.
+ */
+ private Exp effect;
+
+ /**
+ * Creates a new durative action with a specific name.
+ *
+ * @param name the name of the durative action. The name must a not null
+ * reference.
+ * @throws NullPointerException if <code>name == null</code>.
+ */
+ public DurativeAction(String name) {
+ super(ActionID.DURATIVE_ACTION, name);
+ }
+
+ /**
+ * Returns the duration constraint of the durative action.
+ *
+ * @return the duration constraint of the durative action.
+ */
+ public final Exp getConstraint() {
+ return this.constraint;
+ }
+
+ /**
+ * Sets the new duration constraint of the durative action.
+ *
+ * @param cons the new duration constraint of the durative action.
+ * @throws NullPointerException if <code>cons == null</code>.
+ */
+ public final void setConstraint(Exp cons) {
+ if (cons == null)
+ throw new NullPointerException();
+ this.constraint = cons;
+ }
+
+ /**
+ * Returns the condition of the durative action.
+ *
+ * @return the condition of the durative action.
+ */
+ public final Exp getCondition() {
+ return this.condition;
+ }
+
+ /**
+ * Sets the new condition of the durative action.
+ *
+ * @param cond the new condition of the durative action.
+ * @throws NullPointerException if <code>cond == null</code>.
+ */
+ public final void setCondition(Exp cond) {
+ if (cond == null)
+ throw new NullPointerException();
+ this.condition = cond;
+ }
+
+ /**
+ * Returns the effect of the durative action.
+ *
+ * @return the effect of the durative action.
+ */
+ public final Exp getEffect() {
+ return this.effect;
+ }
+
+ /**
+ * Sets the new effect of the durative action.
+ *
+ * @param effect the new effect of the durative action.
+ * @throws NullPointerException if <code>effect == null</code>.
+ */
+ public final void setEffect(Exp effect) {
+ if (effect == null)
+ throw new NullPointerException();
+ this.effect = effect;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. a standardized copy of this expression.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public DurativeAction standardize() {
+ Map<String,String> images = new LinkedHashMap<String, String>();
+ DurativeAction other = this.clone();
+ other.parameters.clear();
+ for (Term param : this.parameters) {
+ other.add(param.standardize(images));
+ }
+ other.constraint = this.constraint.standardize(images);
+ other.condition = this.condition.standardize(images);
+ other.effect = this.effect.standardize(images);
+ return other;
+ }
+
+ /**
+ * Normalize this action. This method returns a copy of this action where:
+ * <ul>
+ * <li> each variable is standardized,</li>
+ * <li> duration constraints expression is convert into conjunctive prenex
+ * normal form and</li>
+ * <li> condition expression is convert into disjunctive prenex normal form
+ * and</li>
+ * <li> effect expression is is convert into conjunctive prenex normal form.</li>
+ * <ul>
+ *
+ * @return a normalize copy of this action.
+ * @see pddl4j.exp.Exp#toPrenexNormaForm()
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public DurativeAction normalize() {
+ DurativeAction other = (DurativeAction) this.standardize();
+ other.constraint = other.constraint.moveQuantifierOutward()
+ .toConjunctiveNormalForm();
+ other.condition = other.condition.moveQuantifierOutward()
+ .toDisjunctiveNormalForm();
+ other.effect = other.effect.moveQuantifierOutward()
+ .toConjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public boolean isGround() {
+ return super.isGround() && this.constraint.isGround()
+ && this.condition.isGround()
+ && this.effect.isGround();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public DurativeAction clone() {
+ DurativeAction other = (DurativeAction) super.clone();
+ other.constraint = this.constraint.clone();
+ other.condition = this.condition.clone();
+ other.effect = this.effect.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of the durative action.
+ *
+ * @return a string representation of the durative action.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:durative-action ");
+ str.append(this.getName());
+ str.append(":parameters ");
+ str.append("(");
+ if (!this.parameters.isEmpty()) {
+ Iterator<Term> i = this.parameters.iterator();
+ str.append(i.next().toString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toString());
+ }
+ }
+ str.append(")");
+ str.append("\n:duration ");
+ str.append(this.constraint.toString());
+ str.append("\n:condition ");
+ str.append(this.condition.toString());
+ str.append("\n:effect ");
+ str.append(this.effect.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of the durative action.
+ *
+ * @return a typed string representation of the durative action.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:durative-action ");
+ str.append(this.getName());
+ str.append(":parameters ");
+ str.append("(");
+ if (!this.parameters.isEmpty()) {
+ Iterator<Term> i = this.parameters.iterator();
+ str.append(i.next().toTypedString());
+ while (i.hasNext()) {
+ str.append(" " + i.next().toTypedString());
+ }
+ }
+ str.append(")");
+ str.append("\n:duration ");
+ str.append(this.constraint.toTypedString());
+ str.append("\n:condition ");
+ str.append(this.condition.toTypedString());
+ str.append("\n:effect ");
+ str.append(this.effect.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html
new file mode 100644
index 00000000000..96b6a93e464
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/action/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to the PDDL action expressions.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java
new file mode 100644
index 00000000000..1f2bebb7eec
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Assign.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the assign operation "assign" of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Assign extends AssignOpExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 303729525987701084L;
+
+ /**
+ * Creates a new "assign" operation with two arguments.
+ *
+ * @param arg1 the first argument of the "assign" operation.
+ * @param arg2 the second argument of the "assign" operation.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public Assign(Term arg1, Term arg2) {
+ super(AssignOp.ASSIGN, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public Assign apply(Substitution sigma) {
+ return (Assign) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Assign standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public Assign standardize(Map<String, String> images) {
+ return (Assign) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Assign clone() {
+ return (Assign) super.clone();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java
new file mode 100644
index 00000000000..49c13e4d000
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOp.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+/**
+ * This enumeration defined all the assign operation that can be used in effect
+ * expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum AssignOp {
+ /**
+ * The assign operator.
+ */
+ ASSIGN,
+ /**
+ * The scale up operator.
+ */
+ SCALE_UP,
+ /**
+ * The scale down operator.
+ */
+ SCALE_DOWN,
+ /**
+ * The increase operator.
+ */
+ INCREASE,
+ /**
+ * The decrease operator.
+ */
+ DECREASE;
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java
new file mode 100644
index 00000000000..c996c08d329
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/AssignOpExp.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements an assign operation of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class AssignOpExp extends AbstractExp {
+
+ /**
+ * The assign operator of this operation.
+ */
+ private AssignOp op;
+
+ /**
+ * The first argument of the operation.
+ */
+ private Term arg1;
+
+ /**
+ * The second argument of the operation.
+ */
+ private Term arg2;
+
+ /**
+ * Creates a new assign operation.
+ *
+ * @param op the assign operator of the operation.
+ * @param arg1 the first argument of the assign operation.
+ * @param arg2 the second argument of the assign operation.
+ * @throws NullPointerException if <code>op == null</code> or
+ * <code>arg1 == null</code> or <code>arg2 == null</code>.
+ */
+ public AssignOpExp(AssignOp op, Term arg1, Term arg2) {
+ super(ExpID.ASSIGN_OP);
+ if (op == null || arg1 == null || arg2 == null)
+ throw new NullPointerException();
+ this.op = op;
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ }
+
+ /**
+ * Sets a new operator of this assign operation.
+ *
+ * @param op the new operator of this assign operation.
+ * @throws NullPointerException if <code>op == null</code>.
+ */
+ public final void setOp(AssignOp op) {
+ if (op == null)
+ throw new NullPointerException();
+ this.op = op;
+ }
+
+ /**
+ * Returns the operator of this assign operation.
+ *
+ * @return the operator of this assign operation.
+ */
+ public final AssignOp getOp() {
+ return this.op;
+ }
+
+ /**
+ * Sets the first argument of this assign operation.
+ *
+ * @param arg1 the new first argument of this assign operation to set.
+ * @throws NullPointerException if <code>arg1 == null</code>.
+ */
+ public final void setArg1(Term arg1) {
+ if (arg1 == null)
+ throw new NullPointerException();
+ this.arg1 = arg1;
+ }
+
+ /**
+ * Returns the first argument of the assign operation.
+ *
+ * @return the first argument of the assign operation.
+ */
+ public final Term getArg1() {
+ return this.arg1;
+ }
+
+ /**
+ * Sets the second argument of this assign operation.
+ *
+ * @param arg2 the new second argument of this assign operation to set.
+ * @throws NullPointerException if <code>arg2 == null</code>.
+ */
+ public final void setArg2(Term arg2) {
+ if (arg2 == null)
+ throw new NullPointerException();
+ this.arg2 = arg2;
+ }
+
+ /**
+ * Returns the second argument of the assign operation.
+ *
+ * @return the second argument of the assign operation.
+ */
+ public final Term getArg2() {
+ return this.arg2;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this assign op
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this assign op
+ * expression; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.arg1.occurs(term) || this.arg2.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public AssignOpExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ AssignOpExp other = this.clone();
+ other.arg1 = this.arg1.apply(sigma);
+ other.arg2 = this.arg2.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AssignOpExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public AssignOpExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ AssignOpExp other = this.clone();
+ other.arg1 = this.arg1.standardize(images);
+ other.arg2 = this.arg2.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.arg1.isGround() && this.arg2.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this "assign" operation is equals to an
+ * other object, i.e., if the object is a not null instance of the class
+ * <code>AssignOpExp</code> and both operation have the same arguments.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this "assign" operation is equals to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof AssignOpExp) {
+ AssignOpExp other = (AssignOpExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.getOp().equals(other.op)
+ && this.arg1.equals(other.arg1)
+ && this.arg2.equals(other.arg2);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this "assign" operation.
+ *
+ * @return the hash code value of this "assign" operation.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.op.hashCode()
+ + this.arg1.hashCode() + this.arg2.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AssignOpExp clone() {
+ AssignOpExp other = (AssignOpExp) super.clone();
+ other.arg1 = this.arg1.clone();
+ other.arg2 = this.arg2.clone();
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ if (this.arg1.getTermID().equals(TermID.VARIABLE)) {
+ vars.add((Variable) this.arg1);
+ }
+ if (this.arg2.getTermID().equals(TermID.VARIABLE)) {
+ vars.add((Variable) this.arg2);
+ }
+ return vars;
+ }
+
+ /**
+ * Returns a string representation of this assign operation.
+ *
+ * @return a string representation of this assign operation.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(" + this.op.toString().toLowerCase() + " ");
+ str.append(this.getArg1().toString());
+ str.append(" ");
+ str.append(this.getArg2().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this assign operation.
+ *
+ * @return a typed string representation of this assign operation.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(" + this.op.toString().toLowerCase() + " ");
+ str.append(this.getArg1().toTypedString());
+ str.append(" ");
+ str.append(this.getArg2().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java
new file mode 100644
index 00000000000..2ae1d491a2b
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Decrease.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the assign operation "decrease" of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Decrease extends AssignOpExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5208581275117162064L;
+
+ /**
+ * Creates a new "decrease" assign operation with two arguments.
+ *
+ * @param arg1 the first argument of the "decrease" operation.
+ * @param arg2 the second argument of the "decrease" operation.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public Decrease(Term arg1, Term arg2) {
+ super(AssignOp.DECREASE, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public Decrease apply(Substitution sigma) {
+ return (Decrease) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Decrease standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public Decrease standardize(Map<String, String> images) {
+ return (Decrease) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Decrease clone() {
+ return (Decrease) super.clone();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java
new file mode 100644
index 00000000000..7c7c611ca68
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/Increase.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the assign operation "increase" of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Increase extends AssignOpExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5208581275117162064L;
+
+ /**
+ * Creates a new "increase" assign operation with two arguments.
+ *
+ * @param arg1 the first argument of the "increase" operation.
+ * @param arg2 the second argument of the "increase" operation.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public Increase(Term arg1, Term arg2) {
+ super(AssignOp.INCREASE, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public Increase apply(Substitution sigma) {
+ return (Increase) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Increase standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public Increase standardize(Map<String, String> images) {
+ return (Increase) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Increase clone() {
+ return (Increase) super.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java
new file mode 100644
index 00000000000..9afee9a4f53
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleDown.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the assign operation "scale down" of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class ScaleDown extends AssignOpExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5208581275117162064L;
+
+ /**
+ * Creates a new "scale down" assign operation with two arguments.
+ *
+ * @param arg1 the first argument of the "scale down" operation.
+ * @param arg2 the second argument of the "scale down" operation.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public ScaleDown(Term arg1, Term arg2) {
+ super(AssignOp.SCALE_DOWN, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public ScaleDown apply(Substitution sigma) {
+ return (ScaleDown) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public ScaleDown standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public ScaleDown standardize(Map<String, String> images) {
+ return (ScaleDown) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ScaleDown clone() {
+ return (ScaleDown) super.clone();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java
new file mode 100644
index 00000000000..8c0c6da23f6
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/ScaleUp.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.assign;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements the assign operation "scale" of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class ScaleUp extends AssignOpExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5208581275117162064L;
+
+ /**
+ * Creates a new "scale up" assign operation with two arguments.
+ *
+ * @param arg1 the first argument of the "scale up" operation.
+ * @param arg2 the second argument of the "scale up" operation.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public ScaleUp(Term arg1, Term arg2) {
+ super(AssignOp.SCALE_UP, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public ScaleUp apply(Substitution sigma) {
+ return (ScaleUp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public ScaleUp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public ScaleUp standardize(Map<String, String> images) {
+ return (ScaleUp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public ScaleUp clone() {
+ return (ScaleUp) super.clone();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html
new file mode 100644
index 00000000000..0653e5cd926
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/assign/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to assign expressions of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java
new file mode 100644
index 00000000000..113b522388e
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysExp.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "always" conditional expression of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class AlwaysExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -118526516823423737L;
+
+ /**
+ * Creates a new conditional "always" expression with a specific expression.
+ *
+ * @param arg the expression. The expression must be a not null
+ * reference.
+ */
+ public AlwaysExp(Exp arg) {
+ super(Condition.ALWAYS, arg);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public AlwaysExp apply(Substitution sigma) {
+ return (AlwaysExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AlwaysExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public AlwaysExp standardize(Map<String, String> images) {
+ return (AlwaysExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AlwaysExp clone() {
+ return (AlwaysExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "always" conditional expression.
+ *
+ * @return a string representation of this "always" conditional expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(always ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "always" conditional expression.
+ *
+ * @return a typed string representation of this "always" conditional expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(always ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java
new file mode 100644
index 00000000000..5a1696d588e
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AlwaysWithinExp.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "always-within" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class AlwaysWithinExp extends BinaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -8736698454531582219L;
+
+ /**
+ * The time stamp.
+ */
+ private Number ts;
+
+ /**
+ * Creates a new conditional "always-within" expression with two specific
+ * expression arguments.
+ *
+ * @param arg1 the first expression argument. The expression must be a not
+ * null reference.
+ * @param arg2 the second expression argument. The expression must be a not
+ * null reference.
+ * @param ts the new time stamp to this this "always-within" conditional
+ * expression. The time stamp must be a not null reference and
+ * its value must be greater than 0.
+ */
+ public AlwaysWithinExp(Exp arg1, Exp arg2, Number ts) {
+ super(Condition.ALWAYS_WITHIN, arg1, arg2);
+ this.ts = ts;
+ }
+
+ /**
+ * Sets a new time stamp to this this "always-within" conditional
+ * expression.
+ *
+ * @param ts the new time stamp to this this "always-within" conditional
+ * expression. The time stamp must be a not null reference and
+ * its value must be greater than 0.
+ */
+ public final void setTimeStamp(Number ts) {
+ this.ts = ts;
+ }
+
+ /**
+ * Returns the time stamp to this this "always-within" conditional
+ * expression.
+ *
+ * @return the time stamp to this this "always-within" conditional
+ * expression.
+ */
+ public final Number getTimeStamp() {
+ return this.ts;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public AlwaysWithinExp apply(Substitution sigma) {
+ return (AlwaysWithinExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AlwaysWithinExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public AlwaysWithinExp standardize(Map<String, String> images) {
+ return (AlwaysWithinExp) super.standardize(images);
+ }
+
+ /**
+ * Returns <code>true</code> if this "always-within" conditional
+ * expression is equal to an other object, i.e., if the object is a not null
+ * reference to an instance of the class <code>AlwaysWithinExp</code> and
+ * both "always-within" conditional expressions have the same two expression
+ * arguments and the same time stamp.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this "always-within" conditional
+ * expression is equal to an other object; <code>false</code>
+ * otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof AlwaysWithinExp) {
+ AlwaysWithinExp other = (AlwaysWithinExp) obj;
+ return super.equals(obj) && this.ts.equals(other.ts);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this "always-within" conditional
+ * expression.
+ *
+ * @return the hash code value of this "always-within" conditional
+ * expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.getArg1().hashCode()
+ + this.getArg2().hashCode() + this.ts.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AlwaysWithinExp clone() {
+ AlwaysWithinExp other = (AlwaysWithinExp) super.clone();
+ other.ts = this.ts.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this "always-within" conditional
+ * expression.
+ *
+ * @return a string representation of this "always-within" conditional
+ * expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(always-within ");
+ str.append(this.ts.toString());
+ str.append(" ");
+ str.append(this.getArg1().toString());
+ str.append(" ");
+ str.append(this.getArg2().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "always-within" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "always-within" conditional
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(always-within ");
+ str.append(this.ts.toTypedString());
+ str.append(" ");
+ str.append(this.getArg1().toTypedString());
+ str.append(" ");
+ str.append(this.getArg2().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java
new file mode 100644
index 00000000000..684db6df5bf
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/AtMostOnceExp.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes This
+ * software is governed by the CeCILL license under French law and abiding by
+ * the rules of distribution of free software. You can use, modify and/ or
+ * redistribute the software under the terms of the CeCILL license as circulated
+ * by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a
+ * counterpart to the access to the source code and rights to copy, modify and
+ * redistribute granted by the license, users are provided only with a limited
+ * warranty and the software's author, the holder of the economic rights, and
+ * the successive licensors have only limited liability. In this respect, the
+ * user's attention is drawn to the risks associated with loading, using,
+ * modifying and/or developing or reproducing the software by the user in light
+ * of its specific status of free software, that may mean that it is complicated
+ * to manipulate, and that also therefore means that it is reserved for
+ * developers and experienced professionals having in-depth computer knowledge.
+ * Users are therefore encouraged to load and test the software's suitability as
+ * regards their requirements in conditions enabling the security of their
+ * systems and/or data to be ensured and, more generally, to use and operate it
+ * in the same conditions as regards security. The fact that you are presently
+ * reading this means that you have had knowledge of the CeCILL license and that
+ * you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "at-most-once" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class AtMostOnceExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -118526516823423737L;
+
+ /**
+ * Creates a new conditional "at-most-once" expression with a specific
+ * expression.
+ *
+ * @param arg the expression. The expression must be a not null reference.
+ */
+ public AtMostOnceExp(Exp arg) {
+ super(Condition.AT_MOST_ONCE, arg);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public AtMostOnceExp apply(Substitution sigma) {
+ return (AtMostOnceExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AtMostOnceExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public AtMostOnceExp standardize(Map<String, String> images) {
+ return (AtMostOnceExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AtMostOnceExp clone() {
+ return (AtMostOnceExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "at-most-once" conditional
+ * expression.
+ *
+ * @return a string representation of this "at-most-once" conditional
+ * expression. description.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at-most-once ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "at-most-once" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "at-most-once" conditional
+ * expression. description.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at-most-once ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java
new file mode 100644
index 00000000000..d8fb43b043f
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/BinaryCondExp.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements a binary conditional expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class BinaryCondExp extends CondExp {
+
+ /**
+ * The first expression argument of this conditional binary expression.
+ */
+ private Exp arg1;
+
+ /**
+ * The second expression argument of this conditional binary expression.
+ */
+ private Exp arg2;
+
+ /**
+ * Creates a new binary conditional expression with a specific expression.
+ *
+ * @param cond The condition of the binary conditional expression.
+ * @param arg1 the first expression argument.
+ * @param arg2 the second expression argument.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code>arg1 == null</code> or <code>arg2 == null</code>.
+ */
+ public BinaryCondExp(Condition cond, Exp arg1, Exp arg2) {
+ super(cond);
+ if (arg1 == null || arg2 == null)
+ throw new NullPointerException();
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ }
+
+ /**
+ * Sets the new first expression argument of this binary conditional
+ * expression.
+ *
+ * @param arg1 the first expression argument.
+ * @throws NullPointerException if <code>arg1 == null</code>.
+ */
+ public final void setArg1(Exp arg1) {
+ if (arg1 == null)
+ throw new NullPointerException();
+ this.arg1 = arg1;
+ }
+
+ /**
+ * Returns the first expression argument of this binary conditional
+ * expression.
+ *
+ * @return the first expression argument of this binary conditional
+ * expression.
+ */
+ public final Exp getArg1() {
+ return this.arg1;
+ }
+
+ /**
+ * Sets the new second expression argument of this binary conditional
+ * expression.
+ *
+ * @param arg2 the second expression argument.
+ * @throws NullPointerException if <code>arg2 == null</code>.
+ */
+ public final void setArg2(Exp arg2) {
+ this.arg2 = arg2;
+ }
+
+ /**
+ * Returns the second expression argument of this binary conditional
+ * expression.
+ *
+ * @return the second expression argument of this binary conditional
+ * expression.
+ */
+ public final Exp getArg2() {
+ return this.arg2;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this binary conditional
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this binary conditional
+ * expression; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.arg1.occurs(term) || this.arg2.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public BinaryCondExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ BinaryCondExp other = this.clone();
+ other.arg1 = this.arg1.apply(sigma);
+ other.arg2 = this.arg2.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public BinaryCondExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public BinaryCondExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ BinaryCondExp other = this.clone();
+ other.arg1 = this.arg1.standardize(images);
+ other.arg2 = this.arg2.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.arg1.getFreeVariables());
+ vars.addAll(this.arg2.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.arg1.isGround() && this.arg2.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this binary conditional expression is
+ * equal to an other object, i.e., if the object is a not null reference to
+ * an instance of the class <code>BinaryCondExp</code> and both binary
+ * conditional expressions have the same two expression arguments and the
+ * same time stamp.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this conditional expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof BinaryCondExp) {
+ BinaryCondExp other = (BinaryCondExp) obj;
+ return super.equals(obj) && this.arg1.equals(other.arg1)
+ && this.arg2.equals(other.arg2);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this binary conditional expression.
+ *
+ * @return the hash code value of this binary conditional expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.arg1.hashCode() + this.arg2.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public BinaryCondExp clone() {
+ BinaryCondExp other = (BinaryCondExp) super.clone();
+ other.arg1 = this.arg1.clone();
+ other.arg2 = this.arg2.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public BinaryCondExp moveQuantifierOutward() {
+ BinaryCondExp other = (BinaryCondExp) super.clone();
+ other.arg1 = this.arg1.moveQuantifierOutward();
+ other.arg2 = this.arg2.moveQuantifierOutward();
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public BinaryCondExp toDisjunctiveNormalForm() {
+ BinaryCondExp other = this.clone();
+ other.arg1 = this.arg1.toDisjunctiveNormalForm();
+ other.arg2 = this.arg2.toDisjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public BinaryCondExp toConjunctiveNormalForm() {
+ BinaryCondExp other = this.clone();
+ other.arg1 = this.arg1.toConjunctiveNormalForm();
+ other.arg2 = this.arg2.toConjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public BinaryCondExp toNegativeNormalForm() {
+ BinaryCondExp other = this.clone();
+ other.arg1 = this.arg1.toNegativeNormalForm();
+ other.arg2 = this.arg2.toNegativeNormalForm();
+ return other;
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java
new file mode 100644
index 00000000000..2c08c850bf3
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/CondExp.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.ExpID;
+
+/**
+ * This abstract class defines a conditional expression of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class CondExp extends AbstractExp {
+
+ /**
+ * The condition of this conditional expression.
+ */
+ private Condition condition;
+
+ /**
+ * Creates a new conditional expression with a specified condition.
+ *
+ * @param cond the condition of this expression.
+ * @throws NullPointerException if <code>condition == null</code>.
+ */
+ protected CondExp(Condition cond) {
+ super(ExpID.COND_EXP);
+ this.condition = cond;
+ }
+
+ /**
+ * Returns the condition of this conditional expression.
+ *
+ * @return the condition of this conditional expression.
+ */
+ public final Condition getCondition() {
+ return this.condition;
+ }
+
+ /**
+ * Returns <code>true</code> if this conditional expression is equal to an
+ * other object. This method returns <code>true</code> if the object is a
+ * not null instance of the class <code>CondExp</code> and both
+ * conditional expression have the same condition.
+ *
+ * @param obj the object to be compared.
+ * @return <code>true</code> if this conditional expression is equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof CondExp) {
+ CondExp other = (CondExp) obj;
+ return this.condition.equals(other.condition);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the conditional expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the conditional expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.condition.hashCode();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java
new file mode 100644
index 00000000000..96e9caaa78a
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/Condition.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+/**
+ * This enumeration defines all condition that can be express with pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum Condition {
+
+ /**
+ * The always condition.
+ */
+ ALWAYS,
+ /**
+ * The sometime condition.
+ */
+ SOMETIME,
+ /**
+ * The whithin condition.
+ */
+ WITHIN,
+ /**
+ * The at most once condition.
+ */
+ AT_MOST_ONCE,
+ /**
+ * The some time after condition.
+ */
+ SOMETIME_AFTER,
+ /**
+ * The sometime before condition.
+ */
+ SOMETIME_BEFORE,
+ /**
+ * The always within condition.
+ */
+ ALWAYS_WITHIN,
+ /**
+ * The hold during condition.
+ */
+ HOLD_DURING,
+ /**
+ * The hold after econdition.
+ */
+ HOLD_AFTER,
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java
new file mode 100644
index 00000000000..78e93d44702
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldAfterExp.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements a "hold-after" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class HoldAfterExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -5875541478330858782L;
+
+ /**
+ * The time stamp.
+ */
+ private Number ts;
+
+ /**
+ * Creates a new conditional "hold-after" expression with a specific
+ * expression.
+ *
+ * @param arg the expression. The expression must be a not null reference.
+ * @param ts the time stamp to this this "hold-after" conditional
+ * expression. The time stamp must be a not null reference.
+ */
+ public HoldAfterExp(Exp arg, Number ts) {
+ super(Condition.HOLD_AFTER, arg);
+ this.ts = ts;
+ }
+
+ /**
+ * Sets a new time stamp to this this "hold-after" conditional expression.
+ *
+ * @param ts the new time stamp to this this "hold-after" conditional
+ * expression. The time stamp must be a not null reference.
+ */
+ public final void setTimeStamp(Number ts) {
+ this.ts = ts;
+ }
+
+ /**
+ * Returns the time stamp to this this "hold-after" conditional expression.
+ *
+ * @return the time stamp to this this "hold-after" conditional expression.
+ */
+ public final Number getTimeStamp() {
+ return this.ts;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public HoldAfterExp apply(Substitution sigma) {
+ return (HoldAfterExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public HoldAfterExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public HoldAfterExp standardize(Map<String, String> images) {
+ return (HoldAfterExp) super.standardize(images);
+ }
+
+ /**
+ * Returns <code>true</code> if this "hold-after" conditional expression
+ * is equal to an other object, i.e., if the object is a not null reference
+ * to an instance of the class <code>HoldAfterExp</code> and both
+ * "hold-after" conditional expressions have the same expression and time
+ * stamp.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this "hold-after" conditional expression
+ * is equal to an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof HoldAfterExp) {
+ HoldAfterExp other = (HoldAfterExp) obj;
+ return super.equals(obj) && this.ts.equals(other.ts);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this "hold-after" conditional expression.
+ *
+ * @return the hash code value of this "hold-after" conditional expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.ts.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public HoldAfterExp clone() {
+ HoldAfterExp other = (HoldAfterExp) super.clone();
+ other.ts = this.ts.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this "hold-after" conditional
+ * expression.
+ *
+ * @return a string representation of this "hold-after" conditional
+ * expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(hold-after ");
+ str.append(this.ts.toString());
+ str.append(" ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "hold-after" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "hold-after" conditional
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(hold-after ");
+ str.append(this.ts.toTypedString());
+ str.append(" ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java
new file mode 100644
index 00000000000..72a2c2c9f30
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/HoldDuringExp.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "hold-during" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class HoldDuringExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -8736698454531582219L;
+
+ /**
+ * The lower bound of the time interval.
+ */
+ private Number lts;
+
+ /**
+ * The upper bound of the time interval.
+ */
+ private Number uts;
+
+ /**
+ * Creates a new conditional "hold-during" expression holding in a specific
+ * time interval.
+ *
+ * @param lts the lower bound of the time interval. The time stamp must be a
+ * not null reference and its value must be greater than 0.
+ * @param uts the upper bound of the time interval. The time stamp must be a
+ * not null reference and its value must be greater than 0.
+ * @param arg the expression. The expression must be a not null reference.
+ */
+ public HoldDuringExp(Number lts, Number uts, Exp arg) {
+ super(Condition.HOLD_DURING, arg);
+ this.lts = lts;
+ this.uts = uts;
+ }
+
+ /**
+ * Sets a new lower time stamp bound of this this "hold-during" conditional
+ * expression.
+ *
+ * @param lts the lower new time stamp bound of this this "hold-during"
+ * conditional expression to set. The time stamp must be a not
+ * null reference and its value must be greater than 0.
+ */
+ public final void setLowerTimeStamp(Number lts) {
+ this.lts = lts;
+ }
+
+ /**
+ * Returns the lower time stamp bound of this this "hold-during" conditional
+ * expression.
+ *
+ * @return the lower time stamp bound of this this "hold-during" conditional
+ * expression.
+ */
+ public final Number getLowerTimeStamp() {
+ return this.lts;
+ }
+
+ /**
+ * Sets a new upper time stamp bound of this this "hold-during" conditional
+ * expression.
+ *
+ * @param uts the upper new time stamp bound of this this "hold-during"
+ * conditional expression to set. The time stamp must be a not
+ * null reference and its value must be greater than 0.
+ */
+ public final void setUpperTimeStamp(Number uts) {
+ this.uts = uts;
+ }
+
+ /**
+ * Returns the upper time stamp bound of this this "hold-during" conditional
+ * expression.
+ *
+ * @return the upper time stamp bound of this this "hold-during" conditional
+ * expression.
+ */
+ public final Number getUpperTimeStamp() {
+ return this.uts;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public HoldDuringExp apply(Substitution sigma) {
+ return (HoldDuringExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public HoldDuringExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public HoldDuringExp standardize(Map<String, String> images) {
+ return (HoldDuringExp) super.standardize(images);
+ }
+
+ /**
+ * Returns <code>true</code> if this "hold-during" conditional expression
+ * is equal to an other object, i.e., if the object is a not null reference
+ * to an instance of the class <code>HoldDuringExp</code> and both
+ * "hold-during" conditional expressions have the same expression and the
+ * same time stamp interval.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this "hold-during" conditional expression
+ * is equal to an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof HoldDuringExp) {
+ HoldDuringExp other = (HoldDuringExp) obj;
+ return super.equals(obj)
+ && this.lts.equals(other.lts)
+ && this.uts.equals(other.uts);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this "hold-during" conditional expression.
+ *
+ * @return the hash code value of this "hold-during" conditional expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.lts.hashCode() + this.uts.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public HoldDuringExp clone() {
+ HoldDuringExp other = (HoldDuringExp) super.clone();
+ other.lts = this.lts.clone();
+ other.uts = this.uts.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this "hold-during" conditional
+ * expression.
+ *
+ * @return a string representation of this "hold-during" conditional
+ * expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(hold-during ");
+ str.append(this.lts.toString());
+ str.append(" ");
+ str.append(this.uts.toString());
+ str.append(" ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "hold-during" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "hold-during" conditional
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(hold-during ");
+ str.append(this.lts.toTypedString());
+ str.append(" ");
+ str.append(this.uts.toTypedString());
+ str.append(" ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java
new file mode 100644
index 00000000000..478be53813c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeAfterExp.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "sometime-after" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class SometimeAfterExp extends BinaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -118526516823423737L;
+
+ /**
+ * Creates a new conditional "sometime-after" expression with two specific
+ * expression arguments.
+ *
+ * @param arg1 the first expression argument. The expression must be a not
+ * null reference.
+ * @param arg2 the second expression argument. The expression must be a not
+ * null reference.
+ */
+ public SometimeAfterExp(Exp arg1, Exp arg2) {
+ super(Condition.SOMETIME_AFTER, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public SometimeAfterExp apply(Substitution sigma) {
+ return (SometimeAfterExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public SometimeAfterExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public SometimeAfterExp standardize(Map<String, String> images) {
+ return (SometimeAfterExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public SometimeAfterExp clone() {
+ return (SometimeAfterExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "sometime-after" conditional
+ * expression.
+ *
+ * @return a string representation of this "sometime-after" conditional
+ * expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime-after ");
+ str.append(this.getArg1().toString());
+ str.append(" ");
+ str.append(this.getArg2().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "sometime-after" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "sometime-after" conditional
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime-after ");
+ str.append(this.getArg1().toTypedString());
+ str.append(" ");
+ str.append(this.getArg2().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java
new file mode 100644
index 00000000000..dc2d29d0a3f
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeBeforeExp.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "sometime-before" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class SometimeBeforeExp extends BinaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -2826334757834212540L;
+
+ /**
+ * Creates a new conditional "sometime-before" expression with two specific
+ * expression arguments.
+ *
+ * @param arg1 the first expression argument. The expression must be a not
+ * null reference.
+ * @param arg2 the second expression argument. The expression must be a not
+ * null reference.
+ */
+ public SometimeBeforeExp(Exp arg1, Exp arg2) {
+ super(Condition.SOMETIME_BEFORE, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public SometimeBeforeExp apply(Substitution sigma) {
+ return (SometimeBeforeExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public SometimeBeforeExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public SometimeBeforeExp standardize(Map<String, String> images) {
+ return (SometimeBeforeExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public SometimeBeforeExp clone() {
+ return (SometimeBeforeExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "sometime-before" conditional
+ * expression.
+ *
+ * @return a string representation of this "sometime-before" conditional
+ * expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime-before ");
+ str.append(this.getArg1().toString());
+ str.append(" ");
+ str.append(this.getArg2().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "sometime-before" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "sometime-before" conditional
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime-before ");
+ str.append(this.getArg1().toTypedString());
+ str.append(" ");
+ str.append(this.getArg2().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java
new file mode 100644
index 00000000000..52ff4c14ce6
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/SometimeExp.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "sometime" conditional expression of the PDDL
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class SometimeExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -118526516823423737L;
+
+ /**
+ * Creates a new conditional "sometime" expression with a specific
+ * expression.
+ *
+ * @param arg the expression. The expression must be a not null reference.
+ */
+ public SometimeExp(Exp arg) {
+ super(Condition.SOMETIME, arg);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public SometimeExp apply(Substitution sigma) {
+ return (SometimeExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public SometimeExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public SometimeExp standardize(Map<String, String> images) {
+ return (SometimeExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public SometimeExp clone() {
+ return (SometimeExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "sometime" conditional
+ * expression.
+ *
+ * @return a string representation of this "sometime" conditional
+ * expression.goal description.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "sometime" conditional
+ * expression.
+ *
+ * @return a typed string representation of this "sometime" conditional
+ * expression.goal description.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(sometime ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java
new file mode 100644
index 00000000000..2a0f1be0338
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/UnaryCondExp.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements an unary conditional expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class UnaryCondExp extends CondExp {
+
+ /**
+ * The goal description of the unary conditional expression.
+ */
+ private Exp arg;
+
+ /**
+ * Creates a new unary conditional expression with a specific expression.
+ *
+ * @param cond The condition of the unary conditional expression.
+ * @param arg the expression.
+ * @throws NullPointerException if <code>cond == null</code> or <code>arg == null</code>.
+ */
+ public UnaryCondExp(Condition cond, Exp arg) {
+ super(cond);
+ if (arg == null)
+ throw new NullPointerException();
+ this.arg = arg;
+ }
+
+ /**
+ * Sets a new goal description to the unary conditional expression
+ *
+ * @param arg the new expression to set.
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ public final void setArg(Exp arg) {
+ if (arg == null)
+ throw new NullPointerException();
+ this.arg = arg;
+ }
+
+ /**
+ * Returns the expression of the unary conditional expression.
+ *
+ * @return the expression of the unary conditional expression.
+ */
+ public final Exp getArg() {
+ return this.arg;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this binary conditional
+ * expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this binary conditional
+ * expression; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.arg.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public UnaryCondExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ UnaryCondExp other = this.clone();
+ other.arg = this.arg.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public UnaryCondExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public UnaryCondExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ UnaryCondExp other = this.clone();
+ other.arg = this.arg.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.arg.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.arg.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if this unary conditional expression is
+ * equal to an other object, i.e., if the object is a not null reference to
+ * an instance of the class <code>UnaryConExp</code> and both
+ * conditional expressions have the same expression.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this unary conditional expression is
+ * equal to an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof UnaryCondExp) {
+ UnaryCondExp other = (UnaryCondExp) obj;
+ return super.equals(obj) && this.arg.equals(other.arg);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this unary conditional expression.
+ *
+ * @return the hash code value of this unary conditional expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.arg.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public UnaryCondExp clone() {
+ UnaryCondExp other = (UnaryCondExp) super.clone();
+ other.arg = this.arg.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public UnaryCondExp moveQuantifierOutward() {
+ UnaryCondExp other = (UnaryCondExp) super.clone();
+ other.arg = this.arg.moveQuantifierOutward();
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public UnaryCondExp toDisjunctiveNormalForm() {
+ UnaryCondExp other = this.clone();
+ other.arg = this.arg.toDisjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public UnaryCondExp toConjunctiveNormalForm() {
+ UnaryCondExp other = this.clone();
+ other.arg = this.arg.toConjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public UnaryCondExp toNegativeNormalForm() {
+ UnaryCondExp other = this.clone();
+ other.arg = this.arg.toNegativeNormalForm();
+ return other;
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java
new file mode 100644
index 00000000000..e2ef78fe6e0
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/WithinExp.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.cond;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.term.Substitution;
+
+/**
+ * This class implements an "within" conditional expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class WithinExp extends UnaryCondExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -118526516823423737L;
+
+ /**
+ * The time stamp.
+ */
+ private Number ts;
+
+ /**
+ * Creates a new conditional "within" expression with a specific expression.
+ *
+ * @param arg the expression. The expression must be a not null reference.
+ * @param ts the time stamp to this this "within" conditional expression.
+ * The time stamp must be a not null reference.
+ */
+ public WithinExp(Exp arg, Number ts) {
+ super(Condition.WITHIN, arg);
+ this.ts = ts;
+ }
+
+ /**
+ * Sets a new time stamp to this this "within" conditional expression.
+ *
+ * @param ts the new time stamp to this this "within" conditional
+ * expression. The time stamp must be a not null reference.
+ */
+ void setTimeStamp(Number ts) {
+ this.ts = ts;
+ }
+
+ /**
+ * Returns the time stamp to this this "within" conditional expression.
+ *
+ * @return the time stamp to this this "within" conditional expression.
+ */
+ public Number getTimeStamp() {
+ return this.ts;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public WithinExp apply(Substitution sigma) {
+ return (WithinExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public WithinExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public WithinExp standardize(Map<String, String> images) {
+ return (WithinExp) super.standardize(images);
+ }
+
+ /**
+ * Returns <code>true</code> if this "within" conditional expression is
+ * equal to an other object, i.e., if the object is a not null reference to
+ * an instance of the class <code>WithinExp</code> and both "within"
+ * conditional expressions have the same expression and time stamp.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this "within" conditional expression is
+ * equal to an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof WithinExp) {
+ WithinExp other = (WithinExp) obj;
+ return super.equals(obj) && this.ts.equals(other.ts);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this "within" conditional expression.
+ *
+ * @return the hash code value of this "within" conditional expression.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.getArg().hashCode()
+ + this.ts.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public WithinExp clone() {
+ WithinExp other = (WithinExp) super.clone();
+ other.ts = this.ts.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this "within" conditional expression.
+ *
+ * @return a string representation of this "within" conditional expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(within ");
+ str.append(this.ts.toString());
+ str.append(" ");
+ str.append(this.getArg().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "within" conditional expression.
+ *
+ * @return a typed string representation of this "within" conditional expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(within ");
+ str.append(this.ts.toTypedString());
+ str.append(" ");
+ str.append(this.getArg().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html
new file mode 100644
index 00000000000..a5eb1ae3169
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/cond/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to conditional expressions of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java
new file mode 100644
index 00000000000..4232cb3d2da
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/Comp.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+/**
+ * This enumeration defined the different kinds of the binary comparaison operator used in PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum Comp {
+
+ /**
+ * The greater binary comparaison operator.
+ */
+ GREATER(">"),
+ /**
+ * The greater or equal binary comparaison operator.
+ */
+ GEQUAL(">="),
+ /**
+ * The less binary comparaison operator.
+ */
+ LESS("<"),
+ /**
+ * The less or equal binary comparaison operator.
+ */
+ LEQUAL("<="),
+ /**
+ * The equal binary comparaison operator.
+ */
+ EQUAL("=");
+
+ /**
+ * The image of the binary comparaison operator in the PDDL langage.
+ */
+ private String image;
+
+ /**
+ * Creates a new binary comparaison operator with a specific image.
+ *
+ * @param image the image of the the binary comparaison operator in the PDDL langage.
+ */
+ private Comp(String image) {
+ this.image = image;
+ }
+
+ /**
+ * Returns a string representation of this binary comparaison operator.
+ *
+ * @return a string representation of this binary comparaison operator.
+ */
+ public String toString() {
+ return this.image;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java
new file mode 100644
index 00000000000..e818673093c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/EqualComp.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.InitEl;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the equality comparaison function add of the pddl
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class EqualComp extends FCompExp implements InitEl {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -8369304517135857251L;
+
+ /**
+ * Creates a new empty equality compared function with two arguments.
+ *
+ * @param arg1 the first argument of the equality compared function.
+ * @param arg2 the second argument of the equality compared function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public EqualComp(Term arg1, Term arg2) {
+ super(Comp.EQUAL, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public EqualComp apply(Substitution sigma) {
+ return (EqualComp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public EqualComp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public EqualComp standardize(Map<String, String> images) {
+ return (EqualComp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public EqualComp clone() {
+ return (EqualComp) super.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this compared expression is evaluable.
+ * In the general case, an compared expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * aritmetic function. In the case of the equality, a compared expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this compared expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ return super.isEvaluable() ? true :
+ this.getArg1().getTermID().equals(TermID.CONSTANT)
+ && this.getArg2().getTermID().equals(TermID.CONSTANT);
+ }
+
+ /**
+ * Evaluates this compared expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the compared expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public boolean evaluate() throws EvaluationException {
+ if (super.isEvaluable()) {
+ Number op1 = null;
+ if (this.getArg1().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ op1 = func.evaluate();
+ } else {
+ op1 = (Number) this.getArg1();
+ }
+ Number op2 = null;
+ if (this.getArg2().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ op2 = func.evaluate();
+ } else {
+ op2 = (Number) this.getArg1();
+ }
+ return op1.equals(op2);
+ } else if (this.getArg1().getTermID().equals(TermID.CONSTANT)
+ && this.getArg2().getTermID().equals(TermID.CONSTANT)) {
+ Constant op1 = (Constant) this.getArg1();
+ Constant op2 = (Constant) this.getArg2();
+ return op1.equals(op2);
+ } else {
+ throw new EvaluationException("comparaison function "
+ + this.toString() + ": is not evaluable");
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java
new file mode 100644
index 00000000000..95156071a36
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/FCompExp.java
@@ -0,0 +1,358 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This class implements a compared function.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class FCompExp extends AbstractExp {
+
+ /**
+ * The binary operator compared of this compared function.
+ */
+ private Comp op;
+
+ /**
+ * The first argument of the compared function.
+ */
+ private Term arg1;
+
+ /**
+ * The second argument of the compared function.
+ */
+ private Term arg2;
+
+ /**
+ * Creates a new compared function.
+ *
+ * @param op the compared operator of the function.
+ * @param arg1 the first argument of the compared function.
+ * @param arg2 the second argument of the compared function.
+ * @throws NullPointerException if <code>op == null</code> or arg1 == null</code>
+ * or <code>arg2 == null</code>.
+ */
+ protected FCompExp(Comp op, Term arg1, Term arg2) {
+ super(ExpID.F_COMP);
+ if (op == null || arg1 == null || arg2 == null)
+ throw new NullPointerException();
+ this.op = op;
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ }
+
+ /**
+ * Sets a new binary compared operator of this compared function.
+ *
+ * @param op the new binary compared operator of this compared
+ * function.
+ * @throws NullPointerException if <code>op == null</code>.
+ */
+ public final void setOp(Comp op) {
+ if (op == null)
+ throw new NullPointerException();
+ this.op = op;
+ }
+
+ /**
+ * Returns the binary compared operator of this compared function.
+ *
+ * @return the binary compared operator of this compared function.
+ */
+ public final Comp getOp() {
+ return this.op;
+ }
+
+ /**
+ * Sets the first argument of this compared function.
+ *
+ * @param arg1 The new first argument of this compared function to set.
+ * @throws NullPointerException if <code>arg1 == null</code>.
+ */
+ public final void setArg1(Term arg1) {
+ if (arg1 == null)
+ throw new NullPointerException();
+ this.arg1 = arg1;
+ }
+
+ /**
+ * Returns the first argument of the compared function.
+ *
+ * @return the first argument of the compared function.
+ */
+ public final Term getArg1() {
+ return this.arg1;
+ }
+
+ /**
+ * Sets the second argument of this compared function.
+ *
+ * @param arg - the new second argument of this compared function to set.
+ * @throws NullPointerException if <code>arg2 == null</code>.
+ */
+ public final void setArg2(Term arg) {
+ if (arg2 == null)
+ throw new NullPointerException();
+ this.arg2 = arg;
+ }
+
+ /**
+ * Returns the second argument of the compared function.
+ *
+ * @return the second argument of the compared function.
+ */
+ public final Term getArg2() {
+ return this.arg2;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this compared
+ * function.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this compared
+ * function; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.arg1.occurs(term) || this.arg2.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public FCompExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ FCompExp other = this.clone();
+ other.arg1 = this.arg1.apply(sigma);
+ other.arg2 = this.arg2.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public FCompExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ FCompExp other = this.clone();
+ other.arg1 = this.arg1.standardize(images);
+ other.arg2 = this.arg2.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.arg1.getFreeVariables());
+ vars.addAll(this.arg2.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.arg1.isGround() && this.arg2.isGround();
+ }
+
+ /**
+ * Evaluates this compared expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the compared expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public abstract boolean evaluate() throws EvaluationException;
+
+ /**
+ * Returns <code>true</code> if this compared expression is evaluable.
+ * In the general case, an compared expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * arithmetic function. In the case of the equality, a compared expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this compared expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ boolean evaluable = this.isGround();
+ ArrayList<Term> arguments = new ArrayList<Term>();
+ arguments.add(this.arg1);
+ arguments.add(this.arg2);
+ Iterator<Term> i = arguments.iterator();
+ while (i.hasNext() && evaluable) {
+ Term arg = i.next();
+ if (arg.getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) arg;
+ evaluable = func.isEvaluable();
+ } else if (arg.getTermID().equals(TermID.NUMBER)) {
+ evaluable = true;
+ } else {
+ evaluable = false;
+ }
+ }
+ return evaluable;
+ }
+
+ /**
+ * Returns <code>true</code> if this compared function is
+ * equals to an other object, i.e., if the object is a not null instance of
+ * the class <code>FCompExp</code> and both function have the same
+ * arguments.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this compared function is
+ * equals to an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof FCompExp) {
+ FCompExp other = (FCompExp) obj;
+ return super.equals(other)
+ && this.getOp().equals(other.getOp())
+ && this.arg1.equals(other.arg1)
+ && this.arg2.equals(other.arg2);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this compared function.
+ *
+ * @return the hash code value of this compared function.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.getOp().hashCode()
+ + this.arg1.hashCode() + this.arg2.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public FCompExp clone() {
+ FCompExp other = (FCompExp) super.clone();
+ other.arg1 = this.arg1.clone();
+ other.arg2 = this.arg2.clone();
+ return other;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public FCompExp toNegativeNormalForm() {
+ return this.clone();
+ }
+
+ /**
+ * Returns a string representation of this compared function.
+ *
+ * @return a string representation of compared function.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(");
+ str.append(this.getOp().toString().toLowerCase());
+ str.append(" ");
+ str.append(this.getArg1().toString());
+ str.append(" ");
+ str.append(this.getArg2().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of compared function.
+ *
+ * @return a typed string representation of compared function.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(");
+ str.append(this.getOp().toString().toLowerCase());
+ str.append(" ");
+ str.append(this.getArg1().toTypedString());
+ str.append(" ");
+ str.append(this.getArg2().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java
new file mode 100644
index 00000000000..6dbc7f616a1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GEqualComp.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the greater or equal compared function add of the
+ * pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class GEqualComp extends FCompExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5536231350872149827L;
+
+ /**
+ * Creates a new greater or equal compared function with two arguments.
+ *
+ * @param arg1 the first argument of the greater or equal compared
+ * function.
+ * @param arg2 the second argument of the greater or equal compared
+ * function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public GEqualComp(Term arg1, Term arg2) {
+ super(Comp.GEQUAL, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public GEqualComp apply(Substitution sigma) {
+ return (GEqualComp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public GEqualComp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public GEqualComp standardize(Map<String, String> images) {
+ return (GEqualComp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public GEqualComp clone() {
+ return (GEqualComp) super.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this compared expression is evaluable.
+ * In the general case, an compared expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * arithmetic function. In the case of the equality, a compared expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this compared expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ return super.isEvaluable();
+ }
+
+ /**
+ * Evaluates this compared expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the compared expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public boolean evaluate() throws EvaluationException {
+ if (this.isEvaluable()) {
+ Number op1 = null;
+ if (this.getArg1().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ op1 = func.evaluate();
+ } else {
+ op1 = (Number) this.getArg1();
+ }
+ Number op2 = null;
+ if (this.getArg2().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ op2 = func.evaluate();
+ } else {
+ op2 = (Number) this.getArg1();
+ }
+ return op1.getValue() >= op2.getValue();
+ } else {
+ throw new EvaluationException("comparaison function "
+ + this.toString() + ": is not evaluable");
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java
new file mode 100644
index 00000000000..e92b2b84d7f
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/GreaterComp.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the greater compared function add of the pddl
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class GreaterComp extends FCompExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -478025774168437367L;
+
+ /**
+ * Creates a new greater compared function with two arguments.
+ *
+ * @param arg1 the first argument of the greater compared function.
+ * @param arg2 the second argument of the greater compared function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public GreaterComp(Term arg1, Term arg2) {
+ super(Comp.GREATER, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public GreaterComp apply(Substitution sigma) {
+ return (GreaterComp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public GreaterComp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public GreaterComp standardize(Map<String, String> images) {
+ return (GreaterComp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public GreaterComp clone() {
+ return (GreaterComp) super.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this comparaison expression is evaluable.
+ * In the general case, an comparaison expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * aritmetic function. In the case of the equality, a comparaison expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this comparaison expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ return super.isEvaluable();
+ }
+
+ /**
+ * Evaluates this comparaison expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the comparaison expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public boolean evaluate() throws EvaluationException {
+ if (this.isEvaluable()) {
+ Number op1 = null;
+ if (this.getArg1().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ op1 = func.evaluate();
+ } else {
+ op1 = (Number) this.getArg1();
+ }
+ Number op2 = null;
+ if (this.getArg2().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ op2 = func.evaluate();
+ } else {
+ op2 = (Number) this.getArg1();
+ }
+ return op1.getValue() > op2.getValue();
+ } else {
+ throw new EvaluationException("comparaison function "
+ + this.toString() + ": is not evaluable");
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java
new file mode 100644
index 00000000000..4dec09389c4
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LEqualComp.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the less or equal compared function add of the pddl
+ * language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class LEqualComp extends FCompExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 5536231350872149827L;
+
+ /**
+ * Creates a new less or equal compared function with two arguments.
+ *
+ * @param arg1 the first argument of the less or equal compared function.
+ * @param arg2 the second argument of the less or equal compared
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public LEqualComp(Term arg1, Term arg2) {
+ super(Comp.LEQUAL, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public LEqualComp apply(Substitution sigma) {
+ return (LEqualComp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public LEqualComp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public LEqualComp standardize(Map<String, String> images) {
+ return (LEqualComp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public LEqualComp clone() {
+ return (LEqualComp) super.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this compared expression is evaluable.
+ * In the general case, an compared expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * arithmetic function. In the case of the equality, a compared expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this compared expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ return super.isEvaluable();
+ }
+
+ /**
+ * Evaluates this compared expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the compared expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public boolean evaluate() throws EvaluationException {
+ if (this.isEvaluable()) {
+ Number op1 = null;
+ if (this.getArg1().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ op1 = func.evaluate();
+ } else {
+ op1 = (Number) this.getArg1();
+ }
+ Number op2 = null;
+ if (this.getArg2().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ op2 = func.evaluate();
+ } else {
+ op2 = (Number) this.getArg1();
+ }
+ return op1.getValue() <= op2.getValue();
+ } else {
+ throw new EvaluationException("comparaison function "
+ + this.toString() + ": is not evaluable");
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java
new file mode 100644
index 00000000000..b788a319022
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/LessComp.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fcomp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.fexp.OpExp;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the less compared function add of the pddl language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class LessComp extends FCompExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 3352652575004530974L;
+
+ /**
+ * Creates a new less compared function with two arguments.
+ *
+ * @param arg1 the first argument of the less compared function.
+ * @param arg2 the second argument of the less compared function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public LessComp(Term arg1, Term arg2) {
+ super(Comp.LESS, arg1, arg2);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public LessComp apply(Substitution sigma) {
+ return (LessComp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public LessComp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public LessComp standardize(Map<String, String> images) {
+ return (LessComp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public LessComp clone() {
+ return (LessComp) super.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this compared expression is evaluable.
+ * In the general case, an compared expression is evaluable if it is
+ * ground and its arguments are recursively either a number either a
+ * arithmetic function. In the case of the equality, a compared expression
+ * is also evaluable if the arguments of the expression are constant
+ * terms.
+ *
+ * @return <code>true</code> if this compared expression is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public boolean isEvaluable() {
+ return super.isEvaluable();
+ }
+
+ /**
+ * Evaluates this compared expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the compared expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.`
+ * @see pddl4j.exp.fcomp.FCompExp#isEvaluable()
+ */
+ public boolean evaluate() throws EvaluationException {
+ if (this.isEvaluable()) {
+ Number op1 = null;
+ if (this.getArg1().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ op1 = func.evaluate();
+ } else {
+ op1 = (Number) this.getArg1();
+ }
+ Number op2 = null;
+ if (this.getArg2().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ op2 = func.evaluate();
+ } else {
+ op2 = (Number) this.getArg1();
+ }
+ return op1.getValue() < op2.getValue();
+ } else {
+ throw new EvaluationException("comparaison function "
+ + this.toString() + ": is not evaluable");
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html
new file mode 100644
index 00000000000..8e2f83001cc
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fcomp/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to compared functions expressions of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java
new file mode 100644
index 00000000000..6e6e97dbf29
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryAdd.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the add arithmetic function.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class BinaryAdd extends BinaryOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -7132824733656820244L;
+
+ /**
+ * Creates a new add arithmetic function with two specified arguments.
+ *
+ * @param arg1 the first argument of the add function.
+ * @param arg2 the second argument of the add function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public BinaryAdd(Term arg1, Term arg2) {
+ super(Op.ADD, arg1, arg2);
+ }
+
+ /**
+ * Return a deep copy of this binary add arithmetic function.
+ *
+ * @return a deep copy of this binary add arithmetic function.
+ * @see pddl4j.exp.term.Term#clone()
+ */
+ public BinaryAdd clone() {
+ return (BinaryAdd) super.clone();
+ }
+
+ /**
+ * Evaluates this binary add arithmetic function.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ Number arg1 = null;
+ if (this.getArg1().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ arg1 = func.evaluate();
+ } else if (this.getArg1().getTermID().equals(TermID.NUMBER)) {
+ arg1 = (Number) this.getArg1();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg1()
+ + " is not evaluable");
+ }
+ Number arg2 = null;
+ if (this.getArg2().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ arg2 = func.evaluate();
+ } else if (this.getArg2().getTermID().equals(TermID.NUMBER)) {
+ arg2 = (Number) this.getArg2();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg2()
+ + " is not evaluable");
+ }
+ return new Number(arg1.getValue() + arg2.getValue());
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java
new file mode 100644
index 00000000000..bc730552be7
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryDivide.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the divide arithmetic function.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class BinaryDivide extends BinaryOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 8265356137201795002L;
+
+ /**
+ * Creates a new divide arithmetic function with two arguments.
+ *
+ * @param arg1 the first argument of the divide function.
+ * @param arg2 the second argument of the divide function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ public BinaryDivide(Term arg1, Term arg2) {
+ super(Op.DIVIDE, arg1, arg2);
+ }
+
+ /**
+ * Return a deep copy of this binary divide arithmetic function.
+ *
+ * @return a deep copy of this binary divide arithmetic function.
+ * @see pddl4j.exp.term.Term#clone()
+ */
+ public BinaryDivide clone() {
+ return (BinaryDivide) super.clone();
+ }
+
+ /**
+ * Evaluates this binary divide arithmetic function.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ Number arg1 = null;
+ if (this.getArg1().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ arg1 = func.evaluate();
+ } else if (this.getArg1().getTermID().equals(TermID.NUMBER)) {
+ arg1 = (Number) this.getArg1();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg1()
+ + " is not evaluable");
+ }
+ Number arg2 = null;
+ if (this.getArg2().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ arg2 = func.evaluate();
+ } else if (this.getArg2().getTermID().equals(TermID.NUMBER)) {
+ arg2 = (Number) this.getArg2();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg2()
+ + " is not evaluable");
+ }
+ return new Number(arg1.getValue() / arg2.getValue());
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java
new file mode 100644
index 00000000000..41ecc924e30
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryMultiply.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the numeric operation multiply of the pddl langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class BinaryMultiply extends BinaryOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 7717661917841761928L;
+
+ /**
+ * Creates a new multiply numeric operation with two arguements.
+ *
+ * @param arg1 the first argument of the multiply operation. The arguement
+ * must be a not null reference.
+ * @param arg2 the second argument of the multiply operation. The arguement
+ * must be a not null reference.
+ */
+ public BinaryMultiply(final Term arg1, final Term arg2) {
+ super(Op.MULTIPLY, arg1, arg2);
+ }
+
+ /**
+ * Return a deep copy of this binary operation.
+ *
+ * @return a deep copy of this binary operation.
+ * @see pddl4j.exp.term.Term#clone()
+ */
+ public BinaryMultiply clone() {
+ return (BinaryMultiply) super.clone();
+ }
+
+ /**
+ * Evaluates this binary multiply arithmetic expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ Number arg1 = null;
+ if (this.getArg1().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ arg1 = func.evaluate();
+ } else if (this.getArg1().getTermID().equals(TermID.NUMBER)) {
+ arg1 = (Number) this.getArg1();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg1()
+ + " is not evaluable");
+ }
+ Number arg2 = null;
+ if (this.getArg2().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ arg2 = func.evaluate();
+ } else if (this.getArg2().getTermID().equals(TermID.NUMBER)) {
+ arg2 = (Number) this.getArg2();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg2()
+ + " is not evaluable");
+ }
+ return new Number(arg1.getValue() * arg2.getValue());
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java
new file mode 100644
index 00000000000..9d3bd298267
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinaryOp.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements an binary arithmetic function.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class BinaryOp extends OpExp {
+
+ /**
+ * Creates a new binary arithemtic function with a specified operator and two arguments.
+ *
+ * @param op The arthemitic operator of the function.
+ * @param arg1 The first argument of the function.
+ * @param arg2 The second argument of the function.
+ * @throws NullPointerException if <code>arg1 == null</code> or
+ * <code>arg2 == null</code>.
+ */
+ protected BinaryOp(Op op, Term arg1, Term arg2) {
+ super(op);
+ super.add(arg1);
+ super.add(arg2);
+ }
+
+ /**
+ * Sets the fisrt argument of this arithmetic operation.
+ *
+ * @param arg1 the new fisrt argument of this arithmetic function.
+ * @throws NullPointerException if <code>arg1 == null</code>.
+ */
+ public final void setArg1(Term arg1) {
+ super.set(0, arg1);
+ }
+
+ /**
+ * Returns the fisrt argument of the arithmetic operation.
+ *
+ * @return the fisrt argument of the arithmetic operation.
+ */
+ public final Term getArg1() {
+ return super.get(0);
+ }
+
+ /**
+ * Sets the second argument of this arithmetic operation.
+ *
+ * @param arg2 the new second argument of this arithmetic function.
+ * @throws NullPointerException if <code>arg2 == null</code>.
+ */
+ public final void setArg2(Term arg2) {
+ super.set(1, arg2);
+ }
+
+ /**
+ * Returns the second argument of the arithmetic function.
+ *
+ * @return the second argument of the arithmetic function.
+ */
+ public final Term getArg2() {
+ return super.get(1);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java
new file mode 100644
index 00000000000..b9fd2d3382f
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/BinarySubstract.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the numeric operation substract of the pddl langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class BinarySubstract extends BinaryOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 7499736600667370526L;
+
+ /**
+ * Creates a new substract numeric operation with two arguements.
+ *
+ * @param arg1 the first argument of the substract operation. The arguement
+ * must be a not null reference.
+ * @param arg2 the second argument of the substract operation. The arguement
+ * must be a not null reference.
+ */
+ public BinarySubstract(Term arg1, Term arg2) {
+ super(Op.SUBSTRACT, arg1, arg2);
+ }
+
+ /**
+ * Return a deep copy of this binary operation.
+ *
+ * @return a deep copy of this binary operation.
+ * @see pddl4j.exp.term.Term#clone()
+ */
+ public BinarySubstract clone() {
+ return (BinarySubstract) super.clone();
+ }
+
+ /**
+ * Evaluates this binary substract arithmetic expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ Number arg1 = null;
+ if (this.getArg1().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg1();
+ arg1 = func.evaluate();
+ } else if (this.getArg1().getTermID().equals(TermID.NUMBER)) {
+ arg1 = (Number) this.getArg1();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg1()
+ + " is not evaluable");
+ }
+ Number arg2 = null;
+ if (this.getArg2().getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) this.getArg2();
+ arg2 = func.evaluate();
+ } else if (this.getArg2().getTermID().equals(TermID.NUMBER)) {
+ arg2 = (Number) this.getArg2();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + this.getArg2()
+ + " is not evaluable");
+ }
+ return new Number(arg1.getValue() - arg2.getValue());
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java
new file mode 100644
index 00000000000..cb540b60b17
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FExp.java
@@ -0,0 +1,394 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.AbstractTerm;
+import pddl4j.exp.term.BindingException;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.term.Variable;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements a function expression in the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class FExp extends AbstractTerm implements Iterable<Term> {
+
+ /**
+ * The serial version id of this class.
+ */
+ private static final long serialVersionUID = -2343417682285770327L;
+
+ /**
+ * The list of the arguments of this function head.
+ */
+ private ArrayList<Term> arguments;
+
+ /**
+ * Create an empty function with a specific functor.
+ *
+ * @param id the term id of this function.
+ * @param functor The function functor.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code>functor == null</code> or <code>type == null</code>.
+ */
+ protected FExp(TermID id, String functor) {
+ super(id, functor);
+ this.arguments = new ArrayList<Term>();
+ }
+
+ /**
+ * Create an empty function with a specific functor.
+ *
+ * @param id the term id of this function.
+ * @param functor The function functor.
+ * @param type the type of this function.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code>functor == null</code> or <code>type == null</code>.
+ */
+ protected FExp(TermID id, String functor, TypeSet type) {
+ super(id, functor, type);
+ this.arguments = new ArrayList<Term>();
+ }
+
+ /**
+ * Adds a new argument to this function.
+ *
+ * @param arg The argument to add.
+ * @return <code>true</code> if the arg was added; <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ protected boolean add(Term arg) {
+ return this.arguments.add(arg);
+ }
+
+ /**
+ * Returns the argument at the specified position in this function.
+ *
+ * @param index index of the argument to return.
+ * @return the argument at the specified position in this function.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (<code>index < 0 || index >= getArity()</code>).
+ */
+ protected Term get(int index) {
+ return this.arguments.get(index);
+ }
+
+ /**
+ * Replaces the argument at the specified position in this function with the
+ * specified term.
+ *
+ * @param index index of the argument to replace.
+ * @param arg argument to be stored at the specified position.
+ * @return the argument previously at the specified position.
+ * @throws IndexOutOfBoundsException if the index is out of range (<code>index < 0 || index >= getArity()</code>).
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ protected Term set(int index, Term arg) {
+ return this.arguments.set(index, arg);
+ }
+
+ /**
+ * Returns the arity of this function.
+ *
+ * @return the arity of this function.
+ */
+ public final int getArity() {
+ return this.arguments.size();
+ }
+
+ /**
+ * Returns <code>true</code> if a expression occurs in this function.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a expression occurs in this function;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ boolean occurs = false;
+ Iterator<Term> i = this.iterator();
+ while (i.hasNext() && !occurs) {
+ occurs = i.next().occurs(term);
+ }
+ return occurs;
+ }
+
+ /**
+ * Returns <code>true</code> if this function expression is ground.
+ *
+ * @return <code>true</code> if this function expression is ground;
+ * <code>false</code> otherwise.
+ */
+ public final boolean isGround() {
+ boolean ground = true;
+ Iterator<Term> i = this.iterator();
+ while (i.hasNext() && ground) {
+ ground = i.next().isGround();
+ }
+ return ground;
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this term and
+ * that are bound in the substitution by its binding term. This method
+ * modify the content of the term on which it is applied.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ * @throws EvaluationException if a ground arithmetic function occurs in
+ * this function expression and its evaluation fails.
+ */
+ public Term apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ FExp other = this.clone();
+ other.arguments.clear();
+ for (Term arg : this.arguments) {
+ other.add(arg.apply(sigma));
+ }
+ return other;
+ }
+
+ /**
+ * Standardizes this function expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public FExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized.Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public FExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ FExp other = this.clone();
+ other.arguments.clear();
+ for (Term arg : this.arguments) {
+ other.add(arg.standardize(images));
+ }
+ return other;
+ }
+
+ /**
+ * Returns an iterator over a set of arguments contained in this function.
+ *
+ * @return an iterator over a set of arguments contained in this function.
+ */
+ public final Iterator<Term> iterator() {
+ return this.arguments.iterator();
+ }
+
+ /**
+ * Unify this term with an other specified term. Note, call unify does not modify
+ * the parameters of this method.
+ *
+ * @param term the term to unify with.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ * @see pddl4j.exp.term.Term#unify(Term, Substitution)
+ * @throws BindingException if the term to unify with this function is a
+ * function with the same symbol and the same arity and has an
+ * incompatible type, i.e.,
+ * <code>!this.getTypeSet().getSubTypes().containsAll(term.getTypeSet().getSubTypes())</code>.
+ */
+ public final Substitution unify(Term term) {
+ return this.unify(term, new Substitution());
+ }
+
+ /**
+ * Unify this term with an other specified term by taking into account a
+ * specified set of binding constraints. Note, call unify does not modify
+ * the parameters of this method.
+ *
+ * @param term the term to unify with.
+ * @param sigma the substitution containing the binding constraints.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ * @throws BindingException if the term to unify with this function is a
+ * function with the same symbol and the same arity and has an
+ * incompatible type, i.e.,
+ * <code>!this.getTypeSet().getSubTypes().containsAll(term.getTypeSet().getSubTypes())</code>.
+ */
+ public final Substitution unify(Term term, Substitution sigma) {
+ if (term.getTermID().equals(TermID.VARIABLE)) {
+ return term.unify(this, sigma);
+ } else {
+ FExp func = (FExp) term;
+ if (func.getImage().equals(this.getImage())
+ && func.getArity() == this.getArity()) {
+ if (this.getTypeSet().getSubTypes().containsAll(
+ func.getTypeSet().getSubTypes())) {
+ Substitution theta = sigma.clone();
+ int i = 0;
+ boolean failure = false;
+ while (i < this.getArity() && !failure) {
+ Term tthis = this.arguments.get(i);
+ Term tother = func.arguments.get(i);
+ Substitution gamma = tthis.unify(tother, theta);
+ if (gamma == null) {
+ failure = true;
+ } else {
+ theta.compose(gamma);
+ }
+ i++;
+ }
+ return failure ? null : theta;
+ } else {
+ throw new BindingException("cannot bind "
+ + this.toTypedString() + " with "
+ + term.toTypedString() + ": imcompatible type");
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ for (Term arg : this) {
+ vars.addAll(arg.getFreeVariables());
+ }
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if this function is equals to an other
+ * object, i.e., if the object is a not null instance of the class
+ * <code>FExp</code> and both function have the same functor and the
+ * same arguments.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this function head is equals to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(final Object obj) {
+ if (obj != null && obj instanceof FExp) {
+ final FExp other = (FExp) obj;
+ return super.equals(obj) && this.arguments.equals(other.arguments);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this function head.
+ *
+ * @return the hash code value of this function head.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.arguments.hashCode();
+ }
+
+ /**
+ * Return a deep copy of this function.
+ *
+ * @return a deep copy of this function.
+ * @see pddl4j.exp.term.AbstractTerm#clone()
+ */
+ public FExp clone() {
+ FExp other = (FExp) super.clone();
+ other.arguments = new ArrayList<Term>();
+ for (Term arg : this.arguments) {
+ other.arguments.add(arg.clone());
+ }
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this function.
+ *
+ * @return a string representation of this function
+ */
+ public String toString() {
+ final StringBuilder str = new StringBuilder();
+ str.append("(");
+ str.append(this.getImage().toString());
+ for (Term t : this.arguments) {
+ str.append(" " + t.toString());
+ }
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns typed string representation of this function.
+ *
+ * @return typed string representation of this function.
+ */
+ public String toTypedString() {
+ final StringBuilder str = new StringBuilder();
+ str.append("(");
+ str.append(this.getImage());
+ for (Term t : this.arguments) {
+ str.append(" " + t.toTypedString());
+ }
+ str.append(")");
+ str.append(" - ");
+ str.append(this.getTypeSet().toString());
+ return str.toString();
+ }
+
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java
new file mode 100644
index 00000000000..642374998ba
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/FHead.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements a function head of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class FHead extends FExp {
+
+ /**
+ * The serial version id of this class.
+ */
+ private static final long serialVersionUID = -2343417682285770327L;
+
+ /**
+ * Create an empty function head with a specific functor.
+ *
+ * @param functor the function functor.
+ * @param type the type of this function.
+ * @throws NullPointerException if <code>functor == null</code> or
+ * <code>type == null</code>.
+ */
+ public FHead(String functor, TypeSet type) {
+ super(TermID.FUNCTION, functor, type);
+ }
+
+ /**
+ * Create an empty function head with a specific functor.
+ *
+ * @param functor the function functor.
+ * @param type the type of this function head.
+ * @throws NullPointerException if <code>functor == null</code>
+ */
+ public FHead(String functor, Type type) {
+ super(TermID.FUNCTION, functor, new TypeSet(type));
+ }
+
+ /**
+ * Adds a new argument to this function.
+ *
+ * @param arg The argument to add.
+ * @return <code>true</code> if the arg was added; <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ public boolean add(Term arg) {
+ return super.add(arg);
+ }
+
+ /**
+ * Returns the argument at the specified position in this function.
+ *
+ * @param index index of the argument to return.
+ * @return the argument at the specified position in this function.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (<code>index < 0 || index >= getArity()</code>).
+ */
+ public Term get(int index) {
+ return super.get(index);
+ }
+
+ /**
+ * Replaces the argument at the specified position in this function with the
+ * specified term.
+ *
+ * @param index index of the argument to replace.
+ * @param arg argument to be stored at the specified position.
+ * @return the argument previously at the specified position.
+ * @throws IndexOutOfBoundsException if the index is out of range (<code>index < 0</code>
+ * or <code>index >= getArity()</code>).
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ public Term set(int index, Term arg) {
+ return super.set(index, arg);
+ }
+
+ /**
+ * Sets a new type of this function.
+ *
+ * @param type the type to set.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public void setTypeSet(TypeSet type) {
+ super.setTypeSet(type);
+ }
+
+
+ /**
+ * Standardizes all occurences of the variables that occur in this
+ * term.
+ *
+ * @return this term.
+ */
+ public FHead standardize() {
+ return (FHead) super.standardize();
+ }
+
+ /**
+ * Returns a deep copy of this arithmetic function.
+ *
+ * @return a deep copy of this arithmetic function.
+ * @see pddl4j.exp.AbstractExp#clone()
+ */
+ public FHead clone() {
+ return (FHead) super.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java
new file mode 100644
index 00000000000..56e4608dbf5
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityAdd.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the n-arity arithmetic function add.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class NArityAdd extends NArityOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 2899553544531715200L;
+
+ /**
+ * Creates a new divide numeric function without arguments.
+ */
+ public NArityAdd() {
+ super(Op.ADD);
+ }
+
+ /**
+ * Return a deep copy of this function.
+ *
+ * @return a shallow copy of this function.
+ * @see pddl4j.exp.term.AbstractTerm#clone()
+ */
+ public NArityAdd clone() {
+ return (NArityAdd) super.clone();
+ }
+
+ /**
+ * Evaluates this add arithmetic expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ double result = 0;
+ for (Term arg : this) {
+ if (arg.getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) arg;
+ result += func.evaluate().getValue();
+ } else if (arg.getTermID().equals(TermID.NUMBER)) {
+ result += ((Number) arg).getValue();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + arg
+ + " is not evaluable");
+ }
+ }
+ return new Number(result);
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java
new file mode 100644
index 00000000000..d495e6f0383
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityMultiply.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+
+/**
+ * This class implements the n-arity arithmetic function multiply.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class NArityMultiply extends NArityOp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 2899553544531715200L;
+
+ /**
+ * Creates a new divide numeric function without arguments.
+ */
+ public NArityMultiply() {
+ super(Op.MULTIPLY);
+ }
+
+ /**
+ * Return a deep copy of this function.
+ *
+ * @return a deep copy of this function.
+ * @see pddl4j.exp.term.Term#clone()
+ */
+ public NArityMultiply clone() {
+ return (NArityMultiply) super.clone();
+ }
+
+ /**
+ * Evaluates this multiply arithmetic expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the function is not evaluable or if an
+ * arithmetic error occurs during the evaluation.
+ * @see pddl4j.exp.fexp.OpExp#isEvaluable()
+ */
+ public Number evaluate() throws EvaluationException {
+ if (!this.isGround())
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + " not ground");
+ try {
+ double result = 1;
+ for (Term arg : this) {
+ if (arg.getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) arg;
+ result *= func.evaluate().getValue();
+ } else if (arg.getTermID().equals(TermID.NUMBER)) {
+ result *= ((Number) arg).getValue();
+ } else {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": argument " + arg
+ + " is not evaluable");
+ }
+ }
+ return new Number(result);
+ } catch (ArithmeticException e) {
+ throw new EvaluationException("arithmetic function "
+ + this.toString() + ": " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java
new file mode 100644
index 00000000000..a207ed08135
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/NArityOp.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements an numeric function od arity n of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class NArityOp extends OpExp {
+
+ /**
+ * Creates a new arithmetic expression.
+ *
+ * @param op the arithmetic operator.
+ * @throws NullPointerException if <code>op == null</code>.
+ */
+ protected NArityOp(Op op) {
+ super(op);
+ }
+
+ /**
+ * Adds a new argument to this function.
+ *
+ * @param arg The argument to add.
+ * @return <code>true</code> if the arg was added; <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ public final boolean add(Term arg) {
+ return super.add(arg);
+ }
+
+ /**
+ * Returns the argument at the specified position in this function.
+ *
+ * @param index index of the argument to return.
+ * @return the argument at the specified position in this function.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (<code>index < 0 || index >= getArity()</code>).
+ */
+ public final Term get(int index) {
+ return super.get(index);
+ }
+
+ /**
+ * Replaces the argument at the specified position in this function with the
+ * specified term.
+ *
+ * @param index index of the argument to replace.
+ * @param arg argument to be stored at the specified position.
+ * @return the argument previously at the specified position.
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (<code>index < 0 || index >= getArity()</code>).
+ * @throws NullPointerException if <code>arg == null</code>.
+ */
+ public final Term set(int index, Term arg) {
+ return super.set(index, arg);
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java
new file mode 100644
index 00000000000..6ade360dafa
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Number.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements a number in the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Number extends FExp implements Comparable<Number> {
+
+ /**
+ * The serial version id of this class.
+ */
+ private static final long serialVersionUID = 6081884046144807572L;
+
+ /**
+ * Create a new number with a specific value.
+ *
+ * @param value the value set to this number.
+ */
+ public Number(double value) {
+ super(TermID.NUMBER, String.valueOf(value), new TypeSet(Type.NUMBER));
+ }
+
+ /**
+ * Create a new number with a default value set to 0.0.
+ */
+ public Number() {
+ this(0.0);
+ }
+
+ /**
+ * Returns the double value of this number.
+ *
+ * @return the double value of this number.
+ * @throws NumberFormatException if the constant is not numeric.
+ */
+ public double getValue() {
+ return Double.parseDouble(this.getImage());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Number standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public Number standardize(Map<String, String> images) {
+ return (Number) super.standardize(images);
+ }
+
+ /**
+ * Compares this number with the specified number for order. Returns a
+ * negative integer, zero, or a positive integer as this number is less
+ * than, equal to, or greater than the specified number.
+ *
+ * @param num the number to be compared.
+ * @return a negative integer, zero, or a positive integer as this number is
+ * less than, equal to, or greater than the specified object.
+ */
+ public int compareTo(Number num) {
+ return new Double(this.getValue()).compareTo(new Double(num.getValue()));
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Number clone() {
+ return (Number) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this number.
+ *
+ * @return a string representation of this number.
+ */
+ public String toString() {
+ return this.getImage();
+ }
+
+ /**
+ * Returns a types string representation of this number.
+ *
+ * @return a typed string representation of this number.
+ */
+ public String toTypedString() {
+ return this.getImage() + " - " + this.getTypeSet();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java
new file mode 100644
index 00000000000..50b17f79d09
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/Op.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+/**
+ * This enumeration defines the different operator of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum Op {
+ /**
+ * The add operator.
+ */
+ ADD("+"),
+ /**
+ * The substract operator.
+ */
+ SUBSTRACT("-"),
+ /**
+ * The multiply operator.
+ */
+ MULTIPLY("*"),
+ /**
+ * The divide operator.
+ */
+ DIVIDE("/");
+
+ /**
+ * The image of the operator of the PDDL langage.
+ */
+ private String image;
+
+ /**
+ * Creates a new operator with a specific image.
+ *
+ * @param image the image of the the operator in the PDDL langage.
+ */
+ private Op(String image) {
+ this.image = image;
+ }
+
+ /**
+ * Returns a string representation of this operator.
+ *
+ * @return a string representation of this operator.
+ */
+ public String toString() {
+ return this.image;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java
new file mode 100644
index 00000000000..f3b4e7718ee
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/OpExp.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.fexp;
+
+import java.util.Iterator;
+
+import pddl4j.EvaluationException;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.TermID;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements an arithmetic function.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class OpExp extends FExp {
+
+ /**
+ * The operator of this arithmetic function.
+ */
+ private Op op;
+
+ /**
+ * Creates a new arithmetic function with a specified operator.
+ *
+ * @param op The arithmetic operator of the function.
+ * @throws NullPointerException if <code>op == null</code>.
+ */
+ protected OpExp(Op op) {
+ super(TermID.ARITHMETIC_FUNCTION, op.toString(), new TypeSet(Type.NUMBER));
+ this.setOp(op);
+ }
+
+ /**
+ * Returns the operator of this arithmetic function.
+ *
+ * @return the operator of this arithmetic function.
+ */
+ public final Op getOp() {
+ return this.op;
+ }
+
+ /**
+ * Sets a new operator to this arithmetic function.
+ *
+ * @param op the new op to set.
+ * @throws NullPointerException if <code>op == null</code.
+ */
+ protected void setOp(Op op) {
+ if (op == null)
+ throw new NullPointerException();
+ this.op = op;
+ }
+
+ /**
+ * Returns a deep copy of this arithmetic function.
+ *
+ * @return a deep copy of this arithmetic function.
+ * @see pddl4j.exp.AbstractExp#clone()
+ */
+ public OpExp clone() {
+ return (OpExp) super.clone();
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this term and
+ * that are bound in the substitution by its binding term. This method
+ * modify the content of the term on which it is applied.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ * @throws EvaluationException if this arithmetic function is ground after
+ * applying the substitution and its evaluation fails.
+ */
+ public Term apply(Substitution sigma) {
+ OpExp other = (OpExp) super.apply(sigma);
+ return other.isEvaluable() ? other.evaluate() : other;
+ }
+
+ /**
+ * Returns <code>true</code> if this arithmetic function is evaluable.
+ * Specially, an arithmetic function is evaluable if it is gound and its
+ * arguments are recursively either a number either a aritmetic function.
+ *
+ * @return <code>true</code> if this arithmetic function is evaluable;
+ * <code>false</code> otherwise.
+ */
+ public final boolean isEvaluable() {
+ boolean evaluable = this.isGround();
+ Iterator<Term> i = this.iterator();
+ while (i.hasNext() && evaluable) {
+ Term arg = i.next();
+ if (arg.getTermID().equals(TermID.ARITHMETIC_FUNCTION)) {
+ OpExp func = (OpExp) arg;
+ evaluable = func.isEvaluable();
+ } else if (arg.getTermID().equals(TermID.NUMBER)) {
+ evaluable = true;
+ } else {
+ evaluable = false;
+ }
+ }
+ return evaluable;
+ }
+
+ /**
+ * Evaluates this arithmetic expression.
+ *
+ * @return the result of the evaluation.
+ * @throws EvaluationException if the arithemtic expression is not ground or
+ * if an numeric error occurs during the evaluation of an
+ * numeric error.
+ */
+ public abstract Number evaluate() throws EvaluationException;
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html
new file mode 100644
index 00000000000..75b38d40ba1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/fexp/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to functions expressions of the PDDL langage.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java
new file mode 100644
index 00000000000..9505fc1df03
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MaximizeExp.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.metric;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class defines the maximize expression used in metric
+ * specification of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class MaximizeExp extends MetricExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 4996915242134602557L;
+
+ /**
+ * Creates a new maximize expression.
+ *
+ * @param exp the term expression to maximize.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public MaximizeExp(Term exp) {
+ super(Optimization.MAXIMIZE, exp);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public MaximizeExp apply(Substitution sigma) {
+ return (MaximizeExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public MaximizeExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public MaximizeExp standardize(Map<String, String> images) {
+ return (MaximizeExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public MaximizeExp clone() {
+ return (MaximizeExp) super.clone();
+ }
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java
new file mode 100644
index 00000000000..9b1ae08d94e
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MetricExp.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.metric;
+
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * This abstract class defines the optimization expression used in metric
+ * specification of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class MetricExp extends AbstractExp {
+
+ /**
+ * The optimization.
+ */
+ private Optimization optimization;
+
+ /**
+ * The term expression to optimize.
+ */
+ private Term exp;
+
+ /**
+ * Creates a new optimization expression.
+ *
+ * @param optimization the optimization of the expression.
+ * @param exp the function to optimize.
+ * @throws NullPointerException if <code>optimization == null</code> or
+ * <code>exp == null</code>.
+ */
+ public MetricExp(Optimization optimization, Term exp) {
+ super(ExpID.METRIC_EXP);
+ if (optimization == null || exp == null)
+ throw new NullPointerException();
+ this.optimization = optimization;
+ this.exp = exp;
+ }
+
+ /**
+ * Returns the term expression to optimize.
+ *
+ * @return the term expression to optimize.
+ */
+ public final Optimization getOptimization() {
+ return this.optimization;
+ }
+
+ /**
+ * Returns the term expression to optimize.
+ *
+ * @return the term expression to optimize.
+ */
+ public final Term getExp() {
+ return this.exp;
+ }
+
+ /**
+ * Sets a new term expression to optimize.
+ *
+ * @param exp the new term expression to optimize.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public final void setExp(Term exp) {
+ if (exp == null)
+ throw new NullPointerException();
+ this.exp = exp;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this metric expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this metric expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public MetricExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ MetricExp other = this.clone();
+ other.exp = this.exp.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null</code>.
+ */
+ public MetricExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ MetricExp other = this.clone();
+ other.exp = this.exp.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.exp.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if the maximize expression is equal to
+ * an other object, i.e., if the object is a not null reference to an
+ * instance of the class <code>MaximizeExp</code> and both maximize
+ * expressions contain the same expression to maximize.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if the maximize expression equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof MetricExp) {
+ MetricExp other = (MetricExp) obj;
+ return this.getExpID().equals(other.getExpID())
+ && this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the maximize expression. This method
+ * is supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the effect goal description.
+ */
+ public int hashCode() {
+ return this.getExpID().hashCode() + this.exp.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public MetricExp clone() {
+ MetricExp other = (MetricExp) super.clone();
+ other.exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this metric expression.
+ *
+ * @return a string representation of this metric expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:metric " + this.optimization.toString().toLowerCase() + " ");
+ str.append(this.getExp().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this metric expression.
+ *
+ * @return a typed string representation of this metric expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(:metric " + this.optimization.toString().toLowerCase() + " ");
+ str.append(this.getExp().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java
new file mode 100644
index 00000000000..2a65d7c0786
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/MinimizeExp.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.metric;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class defines the minimize expression used in metric
+ * specification of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class MinimizeExp extends MetricExp {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 3422169319365697377L;
+
+ /**
+ * Creates a new minimize expression with a specified function.
+ *
+ * @param exp the term expression to minimize.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public MinimizeExp(Term exp) {
+ super(Optimization.MINIMIZE, exp);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public MinimizeExp apply(Substitution sigma) {
+ return (MinimizeExp) super.apply(sigma);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public MinimizeExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public MinimizeExp standardize(Map<String, String> images) {
+ return (MinimizeExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public MinimizeExp clone() {
+ return (MinimizeExp) super.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java
new file mode 100644
index 00000000000..4060e2f1532
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/Optimization.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.metric;
+
+/**
+ * This enumeration defines all the types of optimization of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum Optimization {
+ /**
+ * The maximize optimization.
+ */
+ MAXIMIZE,
+ /**
+ * The minimize optimization.
+ */
+ MINIMIZE,
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html
new file mode 100644
index 00000000000..b66480321fe
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/metric/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to metric expressions used in PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html
new file mode 100644
index 00000000000..2f6b5cb5018
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to the PDDL expressions.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java
new file mode 100644
index 00000000000..f013d3ecb76
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/AbstractTerm.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This abstract class implements the common part of all term used in PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class AbstractTerm extends AbstractExp implements Term {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 4052803386962040209L;
+
+ /**
+ * The image of the term.
+ */
+ private String image;
+
+ /**
+ * The type of the term.
+ */
+ private TypeSet type;
+
+ /**
+ * The term id of this term.
+ */
+ private TermID id;
+
+ /**
+ * Creates a new term with a specified term id, image type and gound flag
+ * property.
+ *
+ * @param id The id expression of this term.
+ * @param image the image of the term.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code>image == null</code> or <code>type == null</code>.
+ */
+ protected AbstractTerm(TermID id, String image) {
+ super(ExpID.TERM);
+ this.id = id;
+ this.setImage(image);
+ Map<String, Set<String>> type = new LinkedHashMap<String,Set<String>>();
+ type.put(Type.OBJECT_SYMBOL, new LinkedHashSet<String>());
+ this.setTypeSet(new TypeSet(new Type(Type.OBJECT_SYMBOL, type)));
+ }
+
+ /**
+ * Creates a new term with a specified term id, image type and ground flag
+ * property.
+ *
+ * @param id The id expression of this term.
+ * @param image the image of the term.
+ * @param type the type of this term.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code>image == null</code> or <code>type == null</code>.
+ */
+ protected AbstractTerm(TermID id, String image, TypeSet type) {
+ super(ExpID.TERM);
+ this.id = id;
+ this.setImage(image);
+ this.setTypeSet(type);
+ }
+
+ /**
+ * Returns the term id of this term.
+ *
+ * @return the expression id of this term.
+ */
+ public final TermID getTermID() {
+ return this.id;
+ }
+
+ /**
+ * Returns the image of this term.
+ *
+ * @return the image of this term.
+ */
+ public final String getImage() {
+ return this.image;
+ }
+
+ /**
+ * Sets a new image to this term.
+ *
+ * @param image the new image of the term.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ protected void setImage(String image) {
+ if (image == null)
+ throw new NullPointerException();
+ this.image = image;
+ }
+
+ /**
+ * Returns the type of the term.
+ *
+ * @return the type of the term.
+ */
+ public final TypeSet getTypeSet() {
+ return this.type;
+ }
+
+ /**
+ * Sets a new type to this term.
+ *
+ * @param type the new type to set to this term.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ protected void setTypeSet(TypeSet type) {
+ if (type == null)
+ throw new NullPointerException();
+ this.type = type;
+ }
+
+ /* /**
+ * Returns <code>true</code> if this term is an instance of a specified
+ * type. Specially, this method returns <code>true</code> if the type
+ * of this term is the equal to the specified type or if the type of this
+ * term is a subtype of the specified type.
+ *
+ * @param type the type.
+ * @return <code>true</code> if this type is an instance of a specified
+ * type; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ /* public boolean isInstanceOf(Type type) {
+ if (type == null)
+ throw new NullPointerException();
+ return this.gequals(type) || type.getAllSubTypes().contains(this);
+ }*/
+
+ /**
+ * Returns a deep copy of this term.
+ *
+ * @return a deep copy of this term.
+ * @see java.lang.Cloneable
+ */
+ public AbstractTerm clone() {
+ AbstractTerm other = (AbstractTerm) super.clone();
+ other.type = this.type.clone();
+ return other;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public Term toNegativeNormalForm() {
+ return this.clone();
+ }
+
+ /**
+ * Returns <code>true</code> if this term is equals to an other object,
+ * i.e., if the object is a not null instance of the class
+ * <code>AbstractTerm</code> and both term have the same image.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this function head is equals to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(final Object obj) {
+ if (obj != null && obj instanceof AbstractTerm) {
+ final AbstractTerm other = (AbstractTerm) obj;
+ return super.equals(other) && this.id.equals(other.id)
+ && this.getImage().equals(other.getImage());
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this term. This method is supported
+ * for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return the hash code value of this term.
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return super.hashCode() + this.id.hashCode() + this.getImage().hashCode();
+ }
+
+ /**
+ * Returns <code>true</code> if this term is numeric.
+ *
+ * @return <code>true</code> if this term is numeric; <code>false</code>
+ * otherwise.
+ */
+ /*public final boolean isNumeric() {
+ return this.type.isNumber();
+ }*/
+}
+ \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java
new file mode 100644
index 00000000000..c0c05fcee10
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/BindingException.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+/**
+ * BindingException is thrown if an attempt is made to bind a exp to a symbolic
+ * or numeric constant.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class BindingException extends RuntimeException {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -4600701161512855951L;
+
+ /**
+ * Creates a new binding exception. with null as its detail message. The
+ * cause is not initialized, and may subsequently be initialized by a call
+ * to <code>Throwable.initCause(java.lang.Throwable)</code>.
+ */
+ public BindingException() {
+ super();
+ }
+
+ /**
+ * Creates a new binding exception with the specified detail message and
+ * cause.
+ *
+ * @param message the detail message (which is saved for later retrieval by
+ * the <code>Throwable.getMessage() method</code>).
+ * @param cause the cause (which is saved for later retrieval by the
+ * <code>Throwable.getCause()</code> method). (A
+ * <code>null</code> value is permitted, and indicates that the
+ * cause is nonexistent or unknown.)
+ */
+ public BindingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a new binding exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by a call
+ * to <code>Throwable.initCause(java.lang.Throwable)</code>.
+ *
+ * @param message the detail message (which is saved for later retrieval by
+ * the Throwable.getMessage() method).
+ */
+ public BindingException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new binding exception with the specified cause and a detail
+ * message of <code>(cause==null ? null : cause.toString())</code> (which
+ * typically contains the class and detail message of cause). This
+ * constructor is useful for exceptions that are little more than wrappers
+ * for other throwables (for example, <code>PrivilegedActionException</code>).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * <code>Throwable.getCause()</code> method). (A
+ * <code>null</code> value is permitted, and indicates that the
+ * cause is nonexistent or unknown.)
+ */
+ public BindingException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java
new file mode 100644
index 00000000000..1427fa29aac
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Constant.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.fexp.FExp;
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements a constant.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Constant extends FExp implements Comparable<Constant> {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -8580834206648477520L;
+
+ /**
+ * Creates a new constant of type object with a specified image.
+ *
+ * @param image the image of the constant.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ public Constant(String image) {
+ super(TermID.CONSTANT, image);
+ }
+
+ /**
+ * Creates a new constant of type object with a specified image.
+ *
+ * @param image the image of the constant.
+ * @param type the type of this constant.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ public Constant(String image, Type type) {
+ super(TermID.CONSTANT, image, new TypeSet(type));
+ }
+
+ /**
+ * Creates a new constant with a specified image and type.
+ *
+ * @param image the image of the constant.
+ * @param type the type of this constant.
+ * @throws NullPointerException if <code>image == null</code> or
+ * <code>type == null</code>.
+ */
+ public Constant(String image, TypeSet type) {
+ super(TermID.CONSTANT, image, type);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * term. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public Constant standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * term. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this term.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ */
+ public Constant standardize(Map<String, String> images) {
+ return (Constant) super.standardize(images);
+ }
+
+ /**
+ * Returns a string representation of this constant.
+ *
+ * @return a string representation of this constant.
+ */
+ public String toString() {
+ return this.getImage();
+ }
+
+ /**
+ * Returns a typed string representation of this constant.
+ *
+ * @return a typed string representation of this constant.
+ */
+ public String toTypedString() {
+ return this.getImage() + " - " + this.getTypeSet();
+ }
+
+ /**
+ * Compares this constant with the specified constant for order. Returns a
+ * negative integer, zero, or a positive integer as this constant is less
+ * than, equal to, or greater than the specified constant according to the
+ * lexicographic order.
+ *
+ * @param cst the constant to be compared.
+ * @return a negative integer, zero, or a positive integer as this number is
+ * less than, equal to, or greater than the specified object.
+ * @throws NullPointerException if <code>cst == null</code>.
+ */
+ public int compareTo(Constant cst) {
+ return this.getImage().compareTo(cst.getImage());
+ }
+
+ /**
+ * Sets a new type of this constant.
+ *
+ * @param type the type to set.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public void setTypeSet(TypeSet type) {
+ super.setTypeSet(type);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public Constant clone() {
+ return (Constant) super.clone();
+ }
+
+
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java
new file mode 100644
index 00000000000..e544ee419cc
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Substitution.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.term.Substitution.Binding;
+
+
+/**
+ * This class implements a substitution.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Substitution implements Serializable, Cloneable, Iterable<Binding> {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 419929317756003422L;
+
+ /**
+ * The list of binding contained in the substitution.
+ */
+ private Map<Variable, Term> binding;
+
+ /**
+ * Creates a new substitution.
+ */
+ public Substitution() {
+ this.binding = new LinkedHashMap<Variable, Term>();
+ }
+
+ /**
+ * Bind a specified variable to an other term in this substitution. If the
+ * substitution previously contained a mapping term for the variable, the
+ * old term value is replaced.
+ *
+ * @param var the variable to bind.
+ * @param term the term to be bound to <code>var</code>.
+ * @return the previous term value associated with <code>var</code>,
+ * or <tt>null</tt> if there was no mapping term for <code>var</code>.
+ * @throws NullPointerException if <code>var == null || term == null</code>.
+ */
+ public Term bind(final Variable var, final Term term) {
+ if (var == null || term == null)
+ throw new NullPointerException();
+ /*if (!var.getTypeSet().getSubTypes().containsAll(term.getTypeSet().getSubTypes())) {
+ throw new BindingException("\"" + var.toTypedString() + "\" with \"" + term.toTypedString() + "\"");
+ }*/
+ Term oldBinding = this.binding.get(var);
+ this.binding.put(var, term);
+ return oldBinding;
+ }
+
+ /**
+ * Returns <code>true</code> if a specified variable occurs in this
+ * substitution.
+ *
+ * @param var the variable to be tested.
+ * @return <code>true</code> if a specified variable occurs in this
+ * substitution; <code>false</code> otherwise.
+ */
+ public boolean occurs(Variable var) {
+ return this.binding.get(var) != null;
+ }
+
+ /**
+ * Composes this substitution with an other one.
+ *
+ * @param sigma the substitution to compose.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public void compose(final Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ for (Map.Entry<Variable, Term> e : this.binding.entrySet()) {
+ this.binding.put(e.getKey(), e.getValue().apply(sigma));
+ }
+ this.binding.putAll(sigma.binding);
+ }
+
+ /**
+ * Returns the term to which a specific variable is bound.
+ *
+ * @param var the exp bound.
+ * @return <tt>null</tt> if the variable is not bound or the binding exp.
+ * @throws NullPointerException if <code>var == null</code>.
+ */
+ public Term getBinding(final Variable var) {
+ if (var == null)
+ throw new NullPointerException();
+ return this.binding.get(var);
+ }
+
+ /**
+ * Returns a deep copy of the subtitution.
+ *
+ * @return a deep copy of the subtitution.
+ */
+ public Substitution clone() {
+ try {
+ Substitution other = (Substitution) super.clone();
+ other.binding = new LinkedHashMap<Variable, Term>();
+ for (Map.Entry<Variable, Term> e : this.binding.entrySet()) {
+ other.binding.put(e.getKey().clone(), e.getValue().clone());
+ }
+ return other;
+ } catch (CloneNotSupportedException e) {
+ throw new Error();
+ }
+ }
+
+ /**
+ * Returns a string representation of the substitution.
+ *
+ * @return a string representation of the substitution.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("[");
+ if (!this.binding.isEmpty()) {
+ Iterator<Map.Entry<Variable, Term>> i = this.binding.entrySet().iterator();
+ Map.Entry<Variable, Term> e = i.next();
+ str.append(e.getKey() + "/" + e.getValue().toString());
+ while (i.hasNext()) {
+ e = i.next();
+ str.append(", " + e.getKey() + "/" + e.getValue().toString());
+ }
+ }
+ str.append("]");
+ return str.toString();
+
+ }
+
+ /**
+ * Returns a typed string representation of the substitution.
+ *
+ * @return a typed string representation of the substitution.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("[");
+ if (!this.binding.isEmpty()) {
+ Iterator<Map.Entry<Variable, Term>> i = this.binding.entrySet().iterator();
+ Map.Entry<Variable, Term> e = i.next();
+ str.append(e.getKey() + ":" + e.getKey().getTypeSet() + "/"
+ + e.getValue().toString() + ":"
+ + e.getValue().getTypeSet());
+ while (i.hasNext()) {
+ e = i.next();
+ str.append(", " + e.getKey() + ":" + e.getKey().getTypeSet() + "/"
+ + e.getValue().toString() + ":"
+ + e.getValue().getTypeSet());
+ }
+ }
+ str.append("]");
+ return str.toString();
+
+ }
+
+ /**
+ * Returns the size of the substitution.
+ *
+ * @return the size of the substitution.
+ */
+ public int size() {
+ return this.binding.size();
+ }
+
+ /**
+ * Returns an iterator over the binding of the substitution.
+ *
+ * @return an iterator over the binding of the substitution.
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator<Binding> iterator() {
+ Set<Binding> bindings = new LinkedHashSet<Binding>();
+ for (Map.Entry<Variable, Term> e : this.binding.entrySet()) {
+ bindings.add(new Binding(e.getKey(), e.getValue()));
+ }
+ return bindings.iterator();
+ }
+
+ /**
+ * This inner class defines a binding between a variable and a term.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+ public final class Binding implements Serializable {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -3705403616252264846L;
+
+ /**
+ * The variable.
+ */
+ private Variable var;
+
+ /**
+ * The term.
+ */
+ private Term term;
+
+ /**
+ * Creates a new binding term.
+ *
+ * @param var the binding variable.
+ * @param term the binding value.
+ * @throws NullPointerException if <code>var == null || term == null</code.
+ */
+ private Binding(Variable var, Term term) {
+ this.var = var;
+ this.term = term;
+ }
+
+ /**
+ * Returns the binding variable.
+ *
+ * @return the binding variable.
+ */
+ public Variable getVariable() {
+ return this.var;
+ }
+
+ /**
+ * Returns the binding term value.
+ *
+ * @return the binding term value.
+ */
+ public Term getTerm() {
+ return this.term;
+ }
+
+ /**
+ * Returns <code>true</code> if this binding is equal to a other
+ * object. This method return <code>true</code> if the object is a not
+ * <code>null</code> instance of the class <code>Binding</code> and
+ * the both attribute of the class are equal.
+ *
+ * @param obj the object to be tested.
+ * @return <code>true</code> if this binding is equal to a other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj.getClass().equals(this.getClass())) {
+ Binding other = (Binding) obj;
+ return this.var.equals(other.var)
+ && this.term.equals(other.term);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value this binding.
+ *
+ * @return the hash code value this binding.
+ */
+ public int hashCode() {
+ return this.var.hashCode() + this.term.hashCode();
+ }
+
+ /**
+ * Returns a string representation of this binding.
+ *
+ * @return a string representation od this binding.
+ */
+ public String toString() {
+ return this.var.toString() + "/" + this.term.toString();
+ }
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java
new file mode 100644
index 00000000000..216695b3d7c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Term.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+import java.util.Map;
+
+import pddl4j.exp.Exp;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This interface define all the method applicable to a PDDL term.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public interface Term extends Exp, Cloneable {
+
+ /**
+ * Return the image of this term.
+ *
+ * @return the image of this term.
+ */
+ String getImage();
+
+ /**
+ * Returns the type of this term.
+ *
+ * @return the type of this term.
+ */
+ TypeSet getTypeSet();
+
+ /**
+ * Returns a typed representation of this term.
+ *
+ * @return a typed representation of this term.
+ */
+ String toTypedString();
+
+ /**
+ * Unify this term with an other specified term. Note, call unify does not
+ * modify the parameters of this method.
+ *
+ * @param term the term to unify with.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ */
+ Substitution unify(final Term term);
+
+ /**
+ * Unify this term with an other specified term by taking into account a
+ * specified set of binding constraints. Note, call unify does not modify
+ * the parameters of this method.
+ *
+ * @param term the term to unify with.
+ * @param sigma the substitution containing the binding constraints.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ */
+ Substitution unify(final Term term, final Substitution sigma);
+
+ /**
+ * Creates and returns a copy of this term expression.
+ *
+ * @return a clone of this term expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ Term clone();
+
+ /**
+ * Returns the term id of this term.
+ *
+ * @return the term id of this term.
+ * @see pddl4j.exp.term.TermID
+ */
+ TermID getTermID();
+
+ /**
+ * Returns <code>true</code> if this term is numeric.
+ *
+ * @return <code>true</code> if this term is numeric; <code>false</code>
+ * otherwise.
+ */
+ //boolean isNumeric();
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * term and that are bound in the substitution by its binding term.
+ * This method modify the content of the term on which it is applied.
+ *
+ * @param sigma the substitution.
+ * @return the substituted term.
+ */
+ public Term apply(Substitution sigma);
+
+ /**
+ * Returns <code>true</code> if a term occurs in this term.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this expression;
+ * <code>false</code> otherwise.
+ */
+ boolean occurs(Term term);
+
+ /**
+ * Returns <code>true</code> if the term is ground.
+ *
+ * @return <code>true</code> if the term is ground;
+ * <code>false</code>otherwise.
+ */
+ boolean isGround();
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * term.
+ *
+ * @return this term.
+ */
+ Term standardize();
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * term. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables. a
+ * standardized copy of this expression. Remember that free variables are
+ * existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this term.
+ */
+ Term standardize(Map<String, String> images);
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java
new file mode 100644
index 00000000000..5d82eaeca9d
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/TermID.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+/**
+ * This enumeration defined all the type of terms.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum TermID {
+ /**
+ * The constant term id.
+ */
+ CONSTANT,
+ /**
+ * The variable term id.
+ */
+ VARIABLE,
+ /**
+ * The function term id.
+ */
+ FUNCTION,
+ /**
+ * The number term id.
+ */
+ NUMBER,
+ /**
+ * The arithmetic function term id.
+ */
+ ARITHMETIC_FUNCTION,
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java
new file mode 100644
index 00000000000..6b632624884
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/Variable.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.term;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.type.Type;
+import pddl4j.exp.type.TypeSet;
+
+/**
+ * This class implements a variable.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class Variable extends AbstractTerm {
+
+ /**
+ * The default class version id.
+ */
+ private static final long serialVersionUID = -6404872183241547003L;
+
+ /**
+ * Creates a new variable of type object with a specified image.
+ *
+ * @param image the image of the variable.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ public Variable(String image) {
+ super(TermID.VARIABLE, "?" + image);
+ }
+
+ /**
+ * Creates a new variable of type object with a specified image.
+ *
+ * @param image the image of the variable.
+ * @param type the type of the variable.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ public Variable(String image, Type type) {
+ super(TermID.VARIABLE, "?" + image, new TypeSet(type));
+ }
+
+ /**
+ * Creates a new variable with a specified image and type.
+ *
+ * @param image the image of the variable.
+ * @param type the type of this variable.
+ * @throws NullPointerException if <code>image == null</code> or
+ * <code>type == null</code>.
+ */
+ public Variable(String image, TypeSet type) {
+ super(TermID.VARIABLE, "?" + image, type);
+ }
+
+ /**
+ * Returns the binding term to this variable in the specified substitution
+ * or this variable is the variable is not bind the substitution.
+ *
+ * @param sigma the substitution.
+ * @return the substituted term or a copy of this variable if there is no
+ * binding term for this variable in the substitution.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public Term apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ Term value = sigma.getBinding(this);
+ return value != null ? value : this.clone();
+ }
+
+ /**
+ * Sets a new type of this variable.
+ *
+ * @param type the type to set.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public void setTypeSet(TypeSet type) {
+ super.setTypeSet(type);
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this term. This method
+ * returns <code>true</code> if and only if the term is equal to this
+ * variable.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if and only if the term is equal to this
+ * variable; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.equals(term);
+ }
+
+ /**
+ * Returns <code>true</code> if this variable is ground.
+ *
+ * @return <code>true</code> if this variable is ground; <code>false</code>
+ * otherwise.
+ */
+ public boolean isGround() {
+ return false;
+ }
+
+ /**
+ * Unify this variable with an other specified term. Note, called unify does
+ * not modify the parameters of this method.
+ *
+ * @param term the term to unify with.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ * @throws BindingException if the term to unify with this variable is a
+ * variable with the same symbol as this variable and has an
+ * incompatible type, i.e.,
+ * <code>!this.getTypeSet().getSubTypes().containsAll(term.getTypeSet().getSubTypes())</code>.
+ * @see pddl4j.exp.term.Term#unify(Term, Substitution)
+ */
+ public Substitution unify(Term term) {
+ return this.unify(term, new Substitution());
+ }
+
+ /**
+ * Unify this variable with an other specified term by taking into account a
+ * specified set of binding constraints. Note, called unify does not modify
+ * the parameters of this method.
+ *
+ * @param term the term to unify with this variable.
+ * @param sigma the substitution containing the binding constraints.
+ * @return The substitution that defines the binding constraints needed to
+ * unify this term with the other term or <code>null</code> if no
+ * binding constraints allows to unify the two terms.
+ * @throws BindingException if the term to unify with this variable is a
+ * variable with the same symbol as this variable and has an
+ * incompatible type, i.e.,
+ * <code>!this.getTypeSet().getSubTypes().containsAll(term.getTypeSet().getSubTypes())</code>.
+ */
+ public Substitution unify(final Term term, final Substitution sigma) {
+ Substitution theta = sigma.clone();
+ Term binding = theta.getBinding(this);
+ if (binding != null) {
+ return binding.unify(term, sigma);
+ } else {
+ if (term.getTermID().equals(TermID.VARIABLE)) {
+ if (term.getImage().equals(this.getImage())) {
+ if (this.getTypeSet().getSubTypes().containsAll(
+ term.getTypeSet().getSubTypes())) {
+ return theta;
+ } else {
+ throw new BindingException("cannot bind "
+ + this.toTypedString() + " with "
+ + term.toTypedString()
+ + ": imcompatible type");
+ }
+ } else {
+ TypeSet infinum = this.getTypeSet().infimum(
+ term.getTypeSet());
+ if (!infinum.isEmpty()) {
+ Variable var = (Variable) term.clone();
+ var.setTypeSet(infinum);
+ theta.bind(this, var);
+ return theta;
+ }
+ }
+ } else {
+ if (!term.occurs(this)) {
+ if (this.getTypeSet().getSubTypes().containsAll(
+ term.getTypeSet().getSubTypes())) {
+ theta.bind(this, term);
+ return theta;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Standardize this variable.
+ *
+ * @return this expression.
+ */
+ public Variable standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes a quantified variable.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public Variable standardizeQuantifiedVariable(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ String newImage = images.get(this.getImage());
+ if (newImage == null) {
+ String oldImage = this.getImage();
+ newImage = Variable.getStandardizedImage(oldImage);
+ images.put(oldImage, newImage);
+ } else {
+ String oldImage = newImage;
+ newImage = Variable.getStandardizedImage(oldImage);
+ images.put(this.getImage(), newImage);
+ }
+ Variable var = this.clone();
+ var.setImage(newImage);
+ return var;
+ }
+
+ /**
+ * Standardizes this variable.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ */
+ public Variable standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ String newImage = images.get(this.getImage());
+ if (newImage == null) {
+ String oldImage = this.getImage();
+ newImage = Variable.getStandardizedImage(oldImage);
+ images.put(oldImage, newImage);
+ }
+ Variable var = this.clone();
+ var.setImage(newImage);
+ return var;
+ }
+
+ /**
+ * Returns the standardized name of a variable from its specified image.
+ *
+ * @param image the image.
+ * @return the standardized name of a variable from its specified image.
+ */
+ public static String getStandardizedImage(String image) {
+ String newImage = new String();
+ String[] str = image.split("_");
+ if (str.length == 2) {
+ long index = Long.parseLong(str[1]);
+ index++;
+ newImage = str[0] + "_" + index;
+
+ } else {
+ newImage = str[0] + "_0";
+ }
+ return newImage;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.add(this);
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if this variable is equals to an other
+ * object. This method return <code>true</code> if the object is a not
+ * null instance of the class <code>Variable</code> and both variable have
+ * the same image.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this variable is equals to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(final Object obj) {
+ if (obj != null && obj instanceof Variable) {
+ return super.equals(obj);
+ }
+ return false;
+ }
+
+ /**
+ * Return a deep copy of this variable.
+ *
+ * @return a deep copy of this variable.
+ * @see pddl4j.exp.term.AbstractTerm#clone()
+ */
+ public Variable clone() {
+ return (Variable) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this variable.
+ *
+ * @return a string representation of this variable.
+ */
+ public String toString() {
+ return this.getImage();
+ }
+
+ /**
+ * Returns typed string representation of this variable.
+ *
+ * @return typed string representation of this variable.
+ */
+ public final String toTypedString() {
+ return this.getImage() + " - " + this.getTypeSet().toString();
+ }
+
+ /**
+ * The timed variable symbol.
+ */
+ public static final String DURATIVE_VARIABLE = "duration";
+
+ /**
+ * The continus variable symbol.
+ */
+ public static final String CONTINOUS_VARIABLE = "#t";
+
+ /**
+ * The metric variable symbol.
+ */
+ public static final String TOTAL_TIME = "?total-time";
+
+ /**
+ * The violated preference variable symbol.
+ */
+ public static final String VIOLATED_PREF_VARIABLE = "?violated-pref-";
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html
new file mode 100644
index 00000000000..7a5385cd2e4
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/term/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to term expressions of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java
new file mode 100644
index 00000000000..749bfb2a40c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtEndTimedExp.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.Exp;
+
+/**
+ * This class implements a "at end" timed expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class AtEndTimedExp extends AtTimedExp {
+
+ /**
+ * The serial id version of the class.
+ */
+ private static final long serialVersionUID = 6680338005108742999L;
+
+ /**
+ * Creates a new "at end" timed expression with a specific expression.
+ *
+ * @param exp The timed expression.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public AtEndTimedExp(Exp exp) {
+ super(TimeSpecifier.END, exp);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AtEndTimedExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public AtEndTimedExp standardize(Map<String, String> images) {
+ return (AtEndTimedExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AtEndTimedExp clone() {
+ return (AtEndTimedExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "at end" timed expression.
+ *
+ * @return a string representation of this "at end" timed expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at end");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "at end" timed expression.
+ *
+ * @return a typed string representation of this "at end" timed expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at end");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java
new file mode 100644
index 00000000000..8e26414719d
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtStartTimedExp.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.Exp;
+
+/**
+ * This class implements a "at start" timed expression of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class AtStartTimedExp extends AtTimedExp {
+
+ /**
+ * The serial id version of the class.
+ */
+ private static final long serialVersionUID = 6680338005108742999L;
+
+ /**
+ * Creates a new "at start" timed expression with a specific expression.
+ *
+ * @param exp The timed expression.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public AtStartTimedExp(Exp exp) {
+ super(TimeSpecifier.START, exp);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public AtStartTimedExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public AtStartTimedExp standardize(Map<String, String> images) {
+ return (AtStartTimedExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AtStartTimedExp clone() {
+ return (AtStartTimedExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "at start" timed expression.
+ *
+ * @return a string representation of this "at start" timed expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at start");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "at start" timed expression.
+ *
+ * @return a typed string representation of this "at start" timed expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at start");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java
new file mode 100644
index 00000000000..9ec8c183b5c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/AtTimedExp.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import pddl4j.exp.Exp;
+
+/**
+ * This class implements an "at" timed expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class AtTimedExp extends TimedExp {
+
+ /**
+ * The time specifier of the "at" timed expression.
+ */
+ protected TimeSpecifier specifier;
+
+ /**
+ * Creates a new "at" timed expression with a specific time specifier and
+ * expression.
+ *
+ * @param specifier The time specifier of the timed expression.
+ * @param exp The timed expression..
+ * @throws NullPointerException if <code>specifier == null</code> of
+ * <code> exp == null</code>.
+ */
+ protected AtTimedExp(TimeSpecifier specifier, Exp exp) {
+ super(TimedExpID.AT, exp);
+ this.specifier = specifier;
+ }
+
+ /**
+ * Returns the time specifier of the expression.
+ *
+ * @return the time specifier of the expression.
+ */
+ public final TimeSpecifier getTimeSpecifier() {
+ return this.specifier;
+ }
+
+ /**
+ * Sets a new time specifier to the expression.
+ *
+ * @param specifier The new specifier to set.
+ * @throws NullPointerException if <code>specifier == null</code>.
+ */
+ public final void setTimeSpecifier(TimeSpecifier specifier) {
+ this.specifier = specifier;
+ }
+
+ /**
+ * Returns <code>true</code> if the "at" timed expression is equal to
+ * an other object, i.e., if the object is a not null reference to an
+ * instance of the class <code>AtEndTimedExp</code> and both "at start"
+ * timed expressions contain the same timed expression.
+ *
+ * @param obj - the reference object with which to compare.
+ * @return <code>true</code> if the "at" timed expression equal to an
+ * other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof AtTimedExp) {
+ AtTimedExp other = (AtTimedExp) obj;
+ return super.equals(obj) && this.specifier.equals(other.specifier);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the "at" timed expression. This method
+ * is supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the at timed expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.specifier.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public AtTimedExp clone() {
+ return (AtTimedExp) super.clone();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java
new file mode 100644
index 00000000000..2a37afbe6f4
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/Interval.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+/**
+ * This enumeration defines all type of timed interval used in PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum Interval {
+ /**
+ * The all timed interval.
+ */
+ ALL;
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java
new file mode 100644
index 00000000000..8766ecc6140
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverAllTimedExp.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import pddl4j.exp.Exp;
+
+/**
+ * This class implements an "over all" timed expression of the PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class OverAllTimedExp extends OverTimedExp {
+
+ /**
+ * The serial id version of the class.
+ */
+ private static final long serialVersionUID = 5674054849424501507L;
+
+ /**
+ * Creates a new "over all" timed expression with a specific timed
+ * description.
+ *
+ * @param exp the timed expression.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public OverAllTimedExp(Exp exp) {
+ super(Interval.ALL, exp);
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public OverAllTimedExp standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. The bound argument is used to store the bound variables.
+ * Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if
+ * <code>images == null || bound == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public OverAllTimedExp standardize(Map<String, String> images) {
+ return (OverAllTimedExp) super.standardize(images);
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public OverAllTimedExp clone() {
+ return (OverAllTimedExp) super.clone();
+ }
+
+ /**
+ * Returns a string representation of this "over all" timed expression.
+ *
+ * @return a string representation of this "over all" timed expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(over all ");
+ str.append(this.exp.toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "over all" timed expression.
+ *
+ * @return a type string representation of this "over all" timed expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(over all ");
+ str.append(this.exp.toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java
new file mode 100644
index 00000000000..c3595b0a12d
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/OverTimedExp.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import pddl4j.exp.Exp;
+
+/**
+ * This class implements an "over" timed expression of the PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class OverTimedExp extends TimedExp {
+
+ /**
+ * The time specifier of the "over" timed expression.
+ */
+ protected Interval interval;
+
+ /**
+ * Creates a new "over" timed expression with a specific interval and
+ * expression.
+ *
+ * @param interval The interval of the timed expression.
+ * @param exp The timed expression.
+ * @throws NullPointerException if <code>interval == null</code> or
+ * <code>exp == null</code>.
+ */
+ protected OverTimedExp(Interval interval, Exp exp) {
+ super(TimedExpID.OVER, exp);
+ if (interval == null)
+ throw new NullPointerException();
+ this.interval = interval;
+ }
+
+ /**
+ * Returns the interval of the timed expression.
+ *
+ * @return the interval of the timed expression.
+ */
+ public final Interval getInterval() {
+ return this.interval;
+ }
+
+ /**
+ * Sets a new interval to the timed expression.
+ *
+ * @param interval The new interval to set.
+ * @throws NullPointerException if <code>interval == null</code>.
+ */
+ public final void setTimeSpecifier(Interval interval) {
+ if (interval == null)
+ throw new NullPointerException();
+ this.interval = interval;
+ }
+
+ /**
+ * Returns <code>true</code> if the "over" timed expression is equal
+ * to an other object, i.e., if the object is a not null reference to an
+ * instance of the class <code>OverTimedExp</code> and both "over all"
+ * timed expression contain the same timed expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if the "over" timed expression equal to
+ * an other object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ OverTimedExp other = (OverTimedExp) obj;
+ return super.equals(obj) && this.interval.equals(other.interval);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the "over" timed expression. This
+ * method is supported for the benefit of hashtables such as those provided
+ * by <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the over timed expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.interval.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public OverTimedExp clone() {
+ return (OverTimedExp) super.clone();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java
new file mode 100644
index 00000000000..b2168049f38
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimeSpecifier.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+/**
+ * This enumeration defines all time specifier used in PDDL langage.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum TimeSpecifier {
+ /**
+ * The start time specifier.
+ */
+ START,
+ /**
+ * The end time specifier.
+ */
+ END;
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java
new file mode 100644
index 00000000000..e67275f5528
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExp.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import pddl4j.exp.AbstractExp;
+import pddl4j.exp.Exp;
+import pddl4j.exp.ExpID;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+import pddl4j.exp.term.Variable;
+
+/**
+ * The abstract generic class implements the common methods of all timed
+ * expression.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public abstract class TimedExp extends AbstractExp {
+
+ /**
+ * The timed expression id of this times expression.
+ */
+ private TimedExpID id;
+
+ /**
+ * The expression contained in this timed expression.
+ */
+ protected Exp exp;
+
+ /**
+ * Creates a new timed goal description expression with a specific id and an
+ * expression.
+ *
+ * @param id The timed expression id of the expression.
+ * @param exp The timed expression.
+ * @throws NullPointerException if <code>id == null</code> or
+ * <code> exp == null</code>.
+ */
+ protected TimedExp(TimedExpID id, Exp exp) {
+ super(ExpID.TIMED_EXP);
+ if (exp == null)
+ throw new NullPointerException();
+ this.id = id;
+ this.exp = exp;
+ }
+
+ /**
+ * Returns the timed expression id of this times expression.
+ *
+ * @return the timed expression id of this times expression.
+ * @see pddl4j.exp.time.TimedExpID
+ */
+ public final TimedExpID getTimeExpID() {
+ return this.id;
+ }
+
+ /**
+ * Returns the expression contained in the timed expression.
+ *
+ * @return the expression contained in the timed expression.
+ */
+ public Exp getExp() {
+ return this.exp;
+ }
+
+ /**
+ * Sets a new expression contained in the timed expression.
+ *
+ * @param exp the new expression to set.
+ * @throws NullPointerException if <code>exp == null</code>.
+ */
+ public final void setExp(Exp exp) {
+ if (exp == null)
+ throw new NullPointerException();
+ this.exp = exp;
+ }
+
+ /**
+ * Returns <code>true</code> if a term occurs in this timed expression.
+ *
+ * @param term the term to be tested.
+ * @return <code>true</code> if a term occurs in this timed expression;
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ */
+ public final boolean occurs(Term term) {
+ if (term == null)
+ throw new NullPointerException();
+ return this.exp.occurs(term);
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public TimedExp apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ TimedExp other = this.clone();
+ other.exp = this.exp.apply(sigma);
+ return other;
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public TimedExp standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ TimedExp other = this.clone();
+ other.exp = this.exp.standardize(images);
+ return other;
+ }
+
+ /**
+ * Returns the set of free variables of this expression.
+ *
+ * @return the set of free variables of this expression.
+ */
+ public Set<Variable> getFreeVariables() {
+ Set<Variable> vars = new LinkedHashSet<Variable>();
+ vars.addAll(this.exp.getFreeVariables());
+ return vars;
+ }
+
+ /**
+ * Returns <code>true</code> if the expression is ground.
+ *
+ * @return <code>true</code> if the expression is ground;
+ * <code>false</code>otherwise.
+ * @see pddl4j.exp.Exp#isGround()
+ */
+ public final boolean isGround() {
+ return this.exp.isGround();
+ }
+
+ /**
+ * Returns <code>true</code> if the timed expression is equal to an other
+ * object. This method returns <code>true</code> if the object is a not
+ * null reference to an instance of the class <code>TimedExp</code> and
+ * both timed expression have the same timed expression id and the same
+ * expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if the timed expression equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ TimedExp other = (TimedExp) obj;
+ return super.equals(obj) && this.exp.equals(other.exp);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the timed expression. This method is
+ * supported for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the timed expression.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.exp.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public TimedExp clone() {
+ TimedExp other = (TimedExp) super.clone();
+ other.exp = this.exp.clone();
+ return other;
+ }
+
+ /**
+ * Returns a copy of this expression such that the quantifiers appear first.
+ *
+ * @return a copy of this expression such that the quantifiers appear first.
+ * @see pddl4j.exp.Exp#moveQuantifierOutward()
+ */
+ public Exp moveQuantifierOutward() {
+ TimedExp other = (TimedExp) super.clone();
+ other.exp = this.exp.moveQuantifierOutward();
+ return other;
+ }
+
+ /**
+ * Return the disjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the disjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toDisjunctiveNormalForm()
+ */
+ public TimedExp toDisjunctiveNormalForm() {
+ TimedExp other = this.clone();
+ other.exp = this.exp.toDisjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the conjunctive normal form of this expression. Note, the
+ * expression returned is a copy.
+ *
+ * @return the conjunctive normal form of this expression.
+ * @see pddl4j.exp.Exp#toConjunctiveNormalForm()
+ */
+ public TimedExp toConjunctiveNormalForm() {
+ TimedExp other = this.clone();
+ other.exp = this.exp.toConjunctiveNormalForm();
+ return other;
+ }
+
+ /**
+ * Returns the negative normal form of this expression. Note, the expression
+ * returned is a copy.
+ *
+ * @return the negative normal form of this expression.
+ * @see pddl4j.exp.Exp#toNegativeNormalForm()
+ */
+ public TimedExp toNegativeNormalForm() {
+ TimedExp other = this.clone();
+ other.exp = this.exp.toNegativeNormalForm();
+ return other;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java
new file mode 100644
index 00000000000..9a41a8a7874
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedExpID.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+/**
+ * This enumeration defines all the time expression id.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public enum TimedExpID {
+ /**
+ * The at time expression id.
+ */
+ AT,
+ /**
+ * The over time expression id.
+ */
+ OVER,
+ /**
+ * The literal time expression id.
+ */
+ LITERAL
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java
new file mode 100644
index 00000000000..f48b4fb84cc
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/TimedLiteral.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.time;
+
+import java.util.LinkedHashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import pddl4j.exp.Literal;
+import pddl4j.exp.fexp.Number;
+import pddl4j.exp.term.Substitution;
+import pddl4j.exp.term.Term;
+
+/**
+ * This class implements a timed literal used in initial state definition of the
+ * PDDL language.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class TimedLiteral extends TimedExp implements Literal {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -1735624931301766305L;
+
+ /**
+ * The time stamp of the timed literal.
+ */
+ private Number ts;
+
+ /**
+ * Creates a new timed literal with a literal.
+ *
+ * @param time the time stamp of the timed literal.
+ * @param literal the literal of the timed literal.
+ * @throws NullPointerException if <code>time == null</code> or
+ * <code>literal == null</code>.
+ * @throws IllegalArgumentException if <code>time.getValue() < 0</code>.
+ */
+ public TimedLiteral(Number time, Literal literal) {
+ super(TimedExpID.LITERAL, literal);
+ if (time == null || literal == null)
+ throw new NullPointerException();
+ if (time.getValue() < 0)
+ throw new IllegalArgumentException();
+ this.ts = time;
+ }
+
+ /**
+ * Returns the literal contained in the timed expression.
+ *
+ * @return the literal contained in the timed expression.
+ */
+ public Literal getExp() {
+ return (Literal) this.exp;
+ }
+
+ /**
+ * Returns the time stamp of the timed literal.
+ *
+ * @return the time stamp of the timed literal.
+ */
+ public Number getTimeStamp() {
+ return this.ts;
+ }
+
+ /**
+ * Sets a new time stamp to the timed literal.
+ *
+ * @param time the new time stamp to set..
+ * @throws NullPointerException if <code>time == null</code> or
+ * <code>literal == null</code>.
+ * @throws IllegalArgumentException if <code>time.getValue() < 0</code>.
+ */
+ public void setTimeStamp(Number time) {
+ if (time == null)
+ throw new NullPointerException();
+ if (time.getValue() < 0)
+ throw new IllegalArgumentException();
+ this.ts = time;
+ }
+
+ /**
+ * Adds a new term to the timed literal.
+ *
+ * @param term the term to add.
+ * @return <code>true</code> if the term was added;
+ * <code>false</code otherwise.
+ * @throws NullPointerException if <code>term == null</code>.
+ * @see pddl4j.exp.Literal#add(pddl4j.exp.term.Term)
+ */
+ public boolean add(Term term) {
+ return this.getExp().add(term);
+ }
+
+ /**
+ * Returns the arity of the timed literal.
+ *
+ * @return the arity of the timed literal.
+ * @see pddl4j.exp.Literal#getArity()
+ */
+ public int getArity() {
+ return this.getExp().getArity();
+ }
+
+ /**
+ * Returns the predicate of the timed literal.
+ *
+ * @return the predicate of the timed literal.
+ * @see pddl4j.exp.Literal#getPredicate()
+ */
+ public String getPredicate() {
+ return this.getExp().getPredicate();
+ }
+
+ /**
+ * Returns a iterator over the expression of the timed literal.
+ *
+ * @return a iterator over the expression of the timed literal.
+ * @see java.lang.Iterable#iterator()
+ */
+ public Iterator<Term> iterator() {
+ return this.getExp().iterator();
+ }
+
+ /**
+ * Substitutes all occurrences of the variables that occur in this
+ * expression and that are mapped in the substitution by its binding
+ * term.
+ *
+ * @param sigma the substitution.
+ * @return a substituted copy of this expression.
+ * @throws NullPointerException if <code>sigma == null</code>.
+ */
+ public TimedLiteral apply(Substitution sigma) {
+ if (sigma == null)
+ throw new NullPointerException();
+ return new TimedLiteral(this.getTimeStamp().clone(),
+ (Literal) this.getExp().apply(sigma));
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. Remember that free variables are existentially quantified.
+ *
+ * @return a standardized copy of this expression.
+ */
+ public TimedLiteral standardize() {
+ return this.standardize(new LinkedHashMap<String, String>());
+ }
+
+ /**
+ * Standardizes all occurrences of the variables that occur in this
+ * expression. The map argument is used to store the variable already
+ * standardized. Remember that free variables are existentially quantified.
+ *
+ * @param images the object that maps old variable images to the standardize
+ * image.
+ * @return a standardized copy of this expression.
+ * @throws NullPointerException if <code>images == null</code>.
+ * @see pddl4j.exp.Exp#standardize(Map)
+ */
+ public TimedLiteral standardize(Map<String, String> images) {
+ if (images == null)
+ throw new NullPointerException();
+ return new TimedLiteral(this.getTimeStamp().clone(), (Literal) this
+ .getExp().standardize(images));
+ }
+
+ /**
+ * Returns <code>true</code> if the timed literal is equal to an other
+ * object, i.e., if the object is a not null reference to an instance of the
+ * class <code>TimedLiteral</code> and both timed literals have the same
+ * time stamp and literal expression.
+ *
+ * @param obj The reference object with which to compare.
+ * @return <code>true</code> if the timed literal equal to an other
+ * object; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ TimedLiteral other = (TimedLiteral) obj;
+ return super.equals(obj) && this.ts.equals(other.ts);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code value for the timed literal. This method is supported
+ * for the benefit of hash tables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return a hash code value for the effect goal description.
+ */
+ public int hashCode() {
+ return super.hashCode() + this.ts.hashCode();
+ }
+
+ /**
+ * Creates and returns a copy of this expression.
+ *
+ * @return a clone of this expression instance.
+ * @see pddl4j.exp.Exp#clone()
+ */
+ public TimedLiteral clone() {
+ TimedLiteral other = (TimedLiteral) super.clone();
+ other.ts = this.ts.clone();
+ return other;
+ }
+
+ /**
+ * Returns a string representation of this "at start" timed expression.
+ *
+ * @return a string representation of this "at start" timed expression.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at ");
+ str.append(this.ts.toString());
+ str.append(" ");
+ str.append(this.getExp().toString());
+ str.append(")");
+ return str.toString();
+ }
+
+ /**
+ * Returns a typed string representation of this "at start" timed
+ * expression.
+ *
+ * @return a typed string representation of this "at start" timed
+ * expression.
+ */
+ public String toTypedString() {
+ StringBuffer str = new StringBuffer();
+ str.append("(at ");
+ str.append(this.ts.toTypedString());
+ str.append(" ");
+ str.append(this.getExp().toTypedString());
+ str.append(")");
+ return str.toString();
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html
new file mode 100644
index 00000000000..59850a41cd0
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/time/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to time constraints expressions of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java
new file mode 100644
index 00000000000..f26d5b7071c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/Type.java
@@ -0,0 +1,321 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.type;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.Map.Entry;
+
+/**
+ * This class implements a type.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class Type implements Serializable {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -3938534221059491043L;
+
+ /**
+ * The object type symbol.
+ */
+ public static final String OBJECT_SYMBOL = "object";
+
+ /**
+ * The number type symbol.
+ */
+ public static final String NUMBER_SYMBOL = "number";
+
+ /**
+ * The number primitive type.
+ */
+ public static final Type NUMBER = new Type(Type.NUMBER_SYMBOL);
+
+ /**
+ * The image of this type.
+ */
+ private String image;
+
+ /**
+ * The list of subtypes of this types.
+ */
+ private Map<String, Set<String>> subTypes;
+
+ /**
+ * The list of super types of this types.
+ */
+ private Map<String, Set<String>> superTypes;
+
+ /**
+ * Creates a new type with a specific image and type hierachy.
+ *
+ * @param image the image of the type.
+ * @param hierarchy the type hierachy.
+ * @throws NullPointerException if <code>image == null</code> or
+ * <code>hierarchy == null</code>.
+ * @throws TypingException if the type hierarchy specified is not
+ * consistant. A type hierarchy is consistant if it does not
+ * contain cycle and all types inherite from object except the
+ * primitive type number.
+ */
+ public Type(String image, Map<String, Set<String>> hierarchy) {
+ if (image == null || hierarchy == null)
+ throw new NullPointerException();
+ this.image = image;
+ this.superTypes = new LinkedHashMap<String, Set<String>>();
+ this.subTypes = new LinkedHashMap<String, Set<String>>();
+ if (!this.checkTypeHierarchy(hierarchy)) {
+ throw new TypingException(this);
+ }
+ for (Entry<String, Set<String>> e : hierarchy.entrySet()) {
+ String typeImg = e.getKey();
+ this.subTypes.put(e.getKey(), e.getValue());
+ for (String st : e.getValue()) {
+ Set<String> stSet = this.superTypes.get(st);
+ if (stSet == null) {
+ stSet = new LinkedHashSet<String>();
+ this.superTypes.put(st, stSet);
+ }
+ stSet.add(e.getKey());
+ }
+ }
+ this.superTypes.put(Type.OBJECT_SYMBOL, new LinkedHashSet<String>());
+ }
+
+ /**
+ * Creates a new type with a specific image. This type is considered as a
+ * primitive type because no type hierarchy is specified. Consequencely,
+ * this type has no sub type and no super type and is final.
+ *
+ * @param image the image of the type.
+ * @throws NullPointerException if <code>image == null</code>.
+ */
+ private Type(String image) {
+ this.image = image;
+ this.superTypes = new LinkedHashMap<String, Set<String>>();
+ this.subTypes = new LinkedHashMap<String, Set<String>>();
+ this.subTypes.put(image, new LinkedHashSet<String>());
+ this.superTypes.put(image, new LinkedHashSet<String>());
+ }
+
+ /**
+ * Returns the image of this type.
+ *
+ * @return the image of this type.
+ */
+ public String getImage() {
+ return this.image;
+ }
+
+ /**
+ * Returns <code>true</code> if this type is final, i.e., has no subtype.
+ *
+ * @return <code>true</code> if this type is final, i.e., has no subtype;
+ * <code>false</code> otherwise.
+ */
+ public boolean isFinal() {
+ return this.subTypes.get(this.image) == null
+ || this.subTypes.get(this.image).isEmpty();
+ }
+
+ /**
+ * Returns the set of sub-types of this type.
+ *
+ * @return the set of sub-types of this type.
+ */
+ public Set<Type> getSuperTypes() {
+ Set<Type> types = new LinkedHashSet<Type>();
+ Set<String> images = this.superTypes.get(this.image);
+ for (String img : images) {
+ Type type = new Type(img);
+ type.subTypes = this.subTypes;
+ type.superTypes = this.superTypes;
+ types.add(type);
+ }
+ return types;
+ }
+
+ /**
+ * Returns the set of super-types of this type.
+ *
+ * @return the set of super-types of this type.
+ */
+ public Set<Type> getSubTypes() {
+ Set<Type> types = new LinkedHashSet<Type>();
+ Set<String> images = this.subTypes.get(this.image);
+ for (String img : images) {
+ Type type = new Type(img);
+ type.subTypes = this.subTypes;
+ type.superTypes = this.superTypes;
+ types.add(type);
+ }
+ return types;
+ }
+
+ /**
+ * Returns the set of all sub-types of this type.
+ *
+ * @return the set of all sub-types of this type.
+ */
+ public Set<Type> getAllSuperTypes() {
+ Set<Type> superTypes = new LinkedHashSet<Type>();
+ Set<Type> types = this.getSuperTypes();
+ superTypes.addAll(types);
+ for (Type st : types) {
+ superTypes.addAll(st.getAllSuperTypes());
+ }
+ return superTypes;
+ }
+
+ /**
+ * Returns the set of all super-types of this type.
+ *
+ * @return the set of all super-types of this type.
+ */
+ public Set<Type> getAllSubTypes() {
+ Set<Type> subTypes = new LinkedHashSet<Type>();
+ Set<Type> types = this.getSubTypes();
+ subTypes.addAll(types);
+ for (Type st : types) {
+ subTypes.addAll(st.getAllSubTypes());
+ }
+ return subTypes;
+ }
+
+ /**
+ * Returns <code>true</code> if this type is equals to an other object.
+ * This method return <code>true</code> if the object is a not null
+ * instance of the class <code>Type</code> and both type have the same
+ * image.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this type is equals to an other object;
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj.getClass().equals(this.getClass())) {
+ Type other = (Type) obj;
+ return this.image.equals(other.image);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this type. This method is supported
+ * for the benefit of hashtables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return the hash code value of this type.
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.image.hashCode();
+ }
+
+ /**
+ * Returns a string representation of this type.
+ *
+ * @return a string representation of this type.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append(this.image);
+ /*str.append("[");
+ if (!this.subTypes.isEmpty()) {
+ Iterator<Type> i = this.subTypes.iterator();
+ str.append(i.next().image);
+ while (i.hasNext()) {
+ str.append(" " + i.next().image);
+ }
+ }
+ str.append("][");
+ if (!this.superTypes.isEmpty()) {
+ Iterator<Type> i = this.superTypes.iterator();
+ str.append(i.next().image);
+ while (i.hasNext()) {
+ str.append(" " + i.next().image);
+ }
+ }
+ str.append("]");*/
+ return str.toString();
+ }
+
+
+ /**
+ * Checks the consistance of the type hierarchy. A type hierarchy is
+ * consistance if the hierarchy does not contain cycle and all types
+ * inherite from object except the primitive type number.
+ *
+ * @param hierarchy the type hierarchy.
+ * @return <code>true</code> if the type hierarchy is consistant;
+ * <code>false</code> otherwise.
+ */
+ private boolean checkTypeHierarchy(Map<String, Set<String>> hierarchy) {
+ Set<String> explored = new LinkedHashSet<String>();
+ if (hierarchy.containsKey(Type.OBJECT_SYMBOL)) {
+ Stack<String> stack = new Stack<String>();
+ stack.push(Type.OBJECT_SYMBOL);
+ Set<String> prefix = new LinkedHashSet<String>();
+ boolean consistant = true;
+ while (!stack.isEmpty() && consistant) {
+ String type = stack.pop();
+ explored.add(type);
+ Set<String> children = hierarchy.get(type);
+ if (children.isEmpty()) {
+ prefix.remove(type);
+ } else {
+ consistant = prefix.add(type);
+ if (!consistant) {
+ }
+ for (String child : children) {
+ stack.push(child);
+
+ }
+ }
+ }
+ Set<String> types = new LinkedHashSet<String>(hierarchy.keySet());
+ types.removeAll(explored);
+ return consistant
+ && (types.isEmpty() || (types.size() == 1 &&
+ types.contains(Type.NUMBER_SYMBOL)));
+ }
+ return false;
+ }
+
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java
new file mode 100644
index 00000000000..fafaf3e47b8
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypeSet.java
@@ -0,0 +1,305 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.type;
+
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * This class implements a type set.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public final class TypeSet implements Iterable<Type>, Cloneable {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = -3938534221059491043L;
+
+ /**
+ * The list of types.
+ */
+ private Set<Type> types;
+
+ /**
+ * Creates a new type set containing a specified type.
+ *
+ * @param type the type.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public TypeSet(Type type) {
+ if (type == null)
+ throw new NullPointerException();
+ this.types = new LinkedHashSet<Type>();
+ this.types.add(type);
+ }
+
+ /**
+ * Creates a new empty type set.
+ */
+ public TypeSet() {
+ this.types = new LinkedHashSet<Type>();
+ }
+
+ /**
+ * Adds a type to this type set.
+ *
+ * @param type the type to add.
+ * @return <code>true</code> if the was added; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public boolean add(Type type) {
+ if (type == null)
+ throw new NullPointerException();
+ return this.types.add(type);
+ }
+
+ /**
+ * Removes a type to this type set.
+ *
+ * @param type the type to remove.
+ * @return <code>true</code> if the type was removed; <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>type == null</code>.
+ */
+ public boolean remove(Type type) {
+ if (type == null)
+ throw new NullPointerException();
+ return this.types.remove(type);
+ }
+
+ /**
+ * Returns an iterator over the primitive type contained in this type.
+ *
+ * @return an iterator over the primitive type contained in this type.
+ */
+ public Iterator<Type> iterator() {
+ return this.types.iterator();
+ }
+
+ /**
+ * Returns <code>true</code> if this type set is empty.
+ *
+ * @return <code>true</code> if this type set is empty; <code>false</code>
+ * otherwise.
+ */
+ public boolean isEmpty() {
+ return this.types.isEmpty();
+ }
+
+ /**
+ * Return the sub-types if this type set.
+ *
+ * @return the sub-types if this type set.
+ */
+ public Set<Type> getSubTypes() {
+ Set<Type> subTypes = new LinkedHashSet<Type>(this.types);
+ for (Type t : this.types) {
+ subTypes.addAll(t.getAllSubTypes());
+ }
+ return subTypes;
+ }
+
+ /**
+ * Return the super-types if this type set.
+ *
+ * @return the super-types if this type set.
+ */
+ public Set<Type> getSuperTypes() {
+ Set<Type> superTypes = new LinkedHashSet<Type>(this.types);
+ for (Type t : this.types) {
+ superTypes.addAll(t.getAllSuperTypes());
+ }
+ return superTypes;
+ }
+
+
+ /**
+ * Returns <code>true</code> if this type set is an instance of an other
+ * type set.
+ *
+ * @param typeSet the other type set.
+ * @return <code>true</code> if this type set is an instance of an other
+ * type set; <code>false</code> otherwise.
+ */
+ public boolean isInstanceOf(TypeSet typeSet) {
+ Set<Type> thisSet = new LinkedHashSet<Type>(this.types);
+ thisSet.addAll(this.getSubTypes());
+ Set<Type> otherSet = new LinkedHashSet<Type>(typeSet.types);
+ otherSet.addAll(typeSet.getSubTypes());
+ return thisSet.containsAll(otherSet);
+ }
+
+ /**
+ * Returns <code>true</code> if this type set contains only the object
+ * type.
+ *
+ * @return <code>true</code> if this type set contains only the object
+ * type; <code>false</code> otherwise.
+ */
+ public boolean isObject() {
+ return this.types.size() == 1
+ && this.types.iterator().next().getImage().equals(Type.OBJECT_SYMBOL);
+ }
+
+ /**
+ * Returns <code>true</code> if this type set contains only the number
+ * type.
+ *
+ * @return <code>true</code> if this type set contains only the number
+ * type; <code>false</code> otherwise.
+ */
+ public boolean isNumber() {
+ return this.types.size() == 1
+ && this.types.iterator().next().getImage().equals(Type.NUMBER_SYMBOL);
+ }
+
+ /**
+ * Returns the infinum type set between this type set and a specified type
+ * set.
+ *
+ * @param ts the type set.
+ * @return the infinum type set between this type set and a specified type
+ * set.
+ * @throws NullPointerException if <code>ts == null</code>.
+ */
+ public TypeSet infimum(TypeSet ts) {
+ if (ts == null)
+ throw new NullPointerException();
+ TypeSet ts1 = new TypeSet();
+ ts1.types = new LinkedHashSet<Type>(this.types);
+ ts1.types.removeAll(ts.types);
+
+ TypeSet ts2 = new TypeSet();
+ ts2.types = new LinkedHashSet<Type>(ts.types);
+ ts2.types.removeAll(this.types);
+
+ TypeSet infinum = new TypeSet();
+ infinum.types = new LinkedHashSet<Type>(this.types);
+ infinum.types.retainAll(ts.types);
+
+ Set<Type> st = ts1.getSubTypes();
+ st.retainAll(ts2.getSubTypes());
+ infinum.types.addAll(st);
+ return infinum;
+ }
+
+ /**
+ * Returns <code>true</code> if this type set intersection a specified
+ * type set.
+ *
+ * @param typeSet the type set to be tested.
+ * @return <code>true</code> if this type set intersection a specified
+ * type set; <code>false</code> otherwise.
+ * @throws NullPointerException if <code>typeSet == null</code>.
+ */
+ public boolean intersect(TypeSet typeSet) {
+ if (typeSet == null)
+ throw new NullPointerException();
+ Set<Type> types = new LinkedHashSet<Type>(this.types);
+ types.addAll(this.getSubTypes());
+ return types.retainAll(typeSet.types);
+ }
+
+
+ /**
+ * Returns <code>true</code> if this type is equals to an other object.
+ * This method returns <code>true</code> if the object is a not null
+ * instance of the class <code>TypeSet</code> and contains the same types.
+ *
+ * @param obj the object to compare.
+ * @return <code>true</code> if this type is equals to an other object;
+ * <code>false</code> otherwise.
+ * @see pddl4j.exp.type.Type
+ */
+ public boolean equals(Object obj) {
+ if (obj != null && obj.getClass().equals(this.getClass())) {
+ TypeSet other = (TypeSet) obj;
+ return this.types.equals(other.types);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code value of this type set. This method is supported
+ * for the benefit of hashtables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ *
+ * @return the hash code value of this type set.
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.types.hashCode();
+ }
+
+ /**
+ * Return a shallow copy of this type set.
+ *
+ * @return a shallow copy of this type set.
+ */
+ public TypeSet clone() {
+ try {
+ TypeSet other = (TypeSet) super.clone();
+ other.types = new LinkedHashSet<Type>();
+ for (Type type : this.types) {
+ other.types.add(type);
+ }
+ return other;
+ } catch (CloneNotSupportedException e) {
+ throw new Error();
+ }
+ }
+
+ /**
+ * Returns a string representation of this type.
+ *
+ * @return a string representation of this type.
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ if (this.types.size() == 0) {
+ str.append("empty-type");
+ } else if (this.types.size() == 1) {
+ str.append(this.types.iterator().next().toString());
+ } else {
+ str.append("(either");
+ for (Type t : this.types) {
+ str.append(" " + t.toString());
+ }
+ str.append(")");
+ }
+ return str.toString();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java
new file mode 100644
index 00000000000..b8c6846d625
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/TypingException.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.exp.type;
+
+/**
+ * A typing exception is thrown if an attempt is made to create a type with a
+ * inconsistant type hierarchy. A type hierarchy is consistant if it does not
+ * contain cycle and all types inherite from object except the primitive type
+ * number.
+ *
+ * @author Damien Pellier
+ * @version 1.0
+ */
+public class TypingException extends RuntimeException {
+
+ /**
+ * The serial version id of the class.
+ */
+ private static final long serialVersionUID = 6846672849363008483L;
+
+ /**
+ * The inconsistant type.
+ */
+ private Type type;
+
+ /**
+ * Creates a new typing exception. with null as its detail message. The
+ * cause is not initialized, and may subsequently be initialized by a call
+ * to <code>Throwable.initCause(java.lang.Throwable)</code>.
+ *
+ * @param type the inconsitant type.
+ */
+ public TypingException(Type type) {
+ super();
+ this.type = type;
+ }
+
+ /**
+ * Creates a new typing exception with the specified cause and a detail
+ * message of <code>(cause==null ? null : cause.toString())</code> (which
+ * typically contains the class and detail message of cause). This
+ * constructor is useful for exceptions that are little more than wrappers
+ * for other throwables (for example, <code>PrivilegedActionException</code>).
+ *
+ * @param type the inconsistant type.
+ * @param cause the cause (which is saved for later retrieval by the
+ * <code>Throwable.getCause()</code> method). (A
+ * <code>null</code> value is permitted, and indicates that the
+ * cause is nonexistent or unknown.)
+ */
+ public TypingException(Type type, Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the typing source of this exception.
+ *
+ * @return the typing source of this exception.
+ */
+ public Type getType() {
+ return this.type;
+ }
+
+ /**
+ * Returns a string representation of this typing exception.
+ *
+ * @return a string representation of this typing exception.
+ */
+ public String toString() {
+ return this.getClass().getName() + ": type hierachy of "
+ + this.type.toString() + " is insconsistant";
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html
new file mode 100644
index 00000000000..f6a75351533
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/exp/type/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to type of the PDDL language.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java
new file mode 100644
index 00000000000..5faff56e85c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/JJTLexerState.java
@@ -0,0 +1,123 @@
+/* Generated By:JavaCC: Do not edit this line. JJTLexerState.java Version 4.1d1 */
+package pddl4j.lexer;
+
+public class JJTLexerState {
+ private java.util.List nodes;
+ private java.util.List marks;
+
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
+ private boolean node_created;
+
+ public JJTLexerState() {
+ nodes = new java.util.ArrayList();
+ marks = new java.util.ArrayList();
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Determines whether the current node was actually closed and
+ pushed. This should only be called in the final user action of a
+ node scope. */
+ public boolean nodeCreated() {
+ return node_created;
+ }
+
+ /* Call this to reinitialize the node stack. It is called
+ automatically by the parser's ReInit() method. */
+ public void reset() {
+ nodes.clear();
+ marks.clear();
+ sp = 0;
+ mk = 0;
+ }
+
+ /* Returns the root node of the AST. It only makes sense to call
+ this after a successful parse. */
+ public Node rootNode() {
+ return (Node)nodes.get(0);
+ }
+
+ /* Pushes a node on to the stack. */
+ public void pushNode(Node n) {
+ nodes.add(n);
+ ++sp;
+ }
+
+ /* Returns the node on the top of the stack, and remove it from the
+ stack. */
+ public Node popNode() {
+ if (--sp < mk) {
+ mk = ((Integer)marks.remove(marks.size()-1)).intValue();
+ }
+ return (Node)nodes.remove(nodes.size()-1);
+ }
+
+ /* Returns the node currently on the top of the stack. */
+ public Node peekNode() {
+ return (Node)nodes.get(nodes.size()-1);
+ }
+
+ /* Returns the number of children on the stack in the current node
+ scope. */
+ public int nodeArity() {
+ return sp - mk;
+ }
+
+
+ public void clearNodeScope(Node n) {
+ while (sp > mk) {
+ popNode();
+ }
+ mk = ((Integer)marks.remove(marks.size()-1)).intValue();
+ }
+
+
+ public void openNodeScope(Node n) {
+ marks.add(new Integer(mk));
+ mk = sp;
+ n.jjtOpen();
+ }
+
+
+ /* A definite node is constructed from a specified number of
+ children. That number of nodes are popped from the stack and
+ made the children of the definite node. Then the definite node
+ is pushed on to the stack. */
+ public void closeNodeScope(Node n, int num) {
+ mk = ((Integer)marks.remove(marks.size()-1)).intValue();
+ while (num-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, num);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ }
+
+
+ /* A conditional node is constructed if its condition is true. All
+ the nodes that have been pushed since the node was opened are
+ made children of the conditional node, which is then pushed
+ on to the stack. If the condition is false the node is not
+ constructed and they are left on the stack. */
+ public void closeNodeScope(Node n, boolean condition) {
+ if (condition) {
+ int a = nodeArity();
+ mk = ((Integer)marks.remove(marks.size()-1)).intValue();
+ while (a-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ } else {
+ mk = ((Integer)marks.remove(marks.size()-1)).intValue();
+ node_created = false;
+ }
+ }
+}
+/* JavaCC - OriginalChecksum=ef2ae28cdbf502b5fc736a3e8c854612 (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java
new file mode 100644
index 00000000000..d072f722e18
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.java
@@ -0,0 +1,14859 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. Lexer.java */
+package pddl4j.lexer;
+
+import java.io.File;
+import pddl4j.ErrorManager;
+
+public class Lexer/* @bgen(jjtree) */implements LexerTreeConstants,
+ LexerConstants {/* @bgen(jjtree) */
+ protected JJTLexerState jjtree = new JJTLexerState();
+ private ErrorManager mgr;
+ private File file;
+
+ private static final int[] BLOCKS = { REQUIREMENTS, TYPES, CONSTANTS,
+ PREDICATES, FUNCTIONS, ACTION, DURATIVE_ACTION, DERIVED, OBJECTS,
+ INIT, GOAL, METRIC, EOF };
+
+ private boolean isBlock(int token) {
+ int i = 0;
+ while (i < BLOCKS.length && (BLOCKS[i] != token))
+ i++;
+ return i == BLOCKS.length;
+ }
+
+ private void error(Throwable e, int line, int column) throws ParseException {
+ String message = new String();
+ if (e.getClass().equals(TokenMgrError.class)) {
+ String[] tmp = e.getMessage().split(" ");
+ int l = -1;
+ int c = -1;
+ int i = 0;
+ for (i = 0; i < tmp.length; i++) {
+ if (tmp[i].equals("line") && i + 1 < tmp.length) {
+ l = Integer.parseInt(tmp[i + 1].substring(0, tmp[i + 1]
+ .length() - 1));
+ }
+ if (tmp[i].equals("column") && i + 1 < tmp.length) {
+ c = Integer.parseInt(tmp[i + 1].substring(0, tmp[i + 1]
+ .length() - 1));
+ }
+ }
+ message = e.getMessage().split(". ")[1];
+ this.mgr.logLexicalError(message, this.file, l, c);
+ } else if (e.getClass().equals(ParseException.class)) {
+ ParseException pe = (ParseException) e;
+ message = generateErrorMesssage(pe);
+ this.mgr.logLexicalError(message, this.file,
+ pe.currentToken.beginLine, pe.currentToken.beginColumn);
+ } else if (e instanceof NullPointerException) {
+ // Do nothing
+ } else {
+ e.printStackTrace();
+ throw new ParseException(e.getMessage());
+ }
+ this.skipToNextBlock();
+ }
+
+ private void skipToNextBlock() {
+ Token t;
+ Token t2;
+ do {
+ t = getNextToken();
+ t2 = getToken(2);
+
+ } while (t2 != null && isBlock(t2.kind));
+ }
+
+ public void setErrorManager(ErrorManager mgr) {
+ this.mgr = mgr;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ /**
+ * Creates the error message from a specific parse exception.
+ *
+ * @param pe
+ * the parse exception.
+ * @return the error message.
+ */
+ private String generateErrorMesssage(ParseException pe) {
+ StringBuffer expected = new StringBuffer();
+ boolean expectedSeq = false;
+ int maxSize = 0;
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ if (maxSize < pe.expectedTokenSequences[i].length) {
+ maxSize = pe.expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ expected.append(pe.tokenImage[pe.expectedTokenSequences[i][j]])
+ .append(" ");
+ expectedSeq = true;
+ }
+ if (pe.expectedTokenSequences[i][pe.expectedTokenSequences[i].length - 1] != 0) {
+ expected.append("...");
+ }
+ if (i < pe.expectedTokenSequences.length - 1) {
+ expected.append("\n").append(" ");
+ }
+ }
+ String retval = "unexpected token \"" + pe.currentToken.next.image
+ + "\".";
+ if (expectedSeq) {
+ if (pe.expectedTokenSequences.length == 1) {
+ retval += "\nWas expecting:" + "\n" + " ";
+ } else {
+ retval += "\nWas expecting one of:" + "\n" + " ";
+ }
+ retval += expected.toString();
+ }
+ return retval;
+ }
+
+ final public SimpleNode parse() throws ParseException {
+ /* @bgen(jjtree) ROOT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTROOT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = null;
+ try {
+ try {
+ if (jj_2_1(4)) {
+ t = domain();
+ } else if (jj_2_2(4)) {
+ t = problem();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.mgr.logLexicalError("Lexical error file ("
+ + file.getName() + ") : to many errors", file);
+ {
+ if (true)
+ throw new ParseException(e.getMessage());
+ }
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return jjtn000;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token domain() throws ParseException {
+ /* @bgen(jjtree) DOMAIN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDOMAIN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DEFINE);
+ jj_consume_token(LPAREN);
+ jj_consume_token(DOMAIN);
+ domain_name();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_3(2)) {
+ t = require_def();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_4(2)) {
+ t = type_def();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_5(2)) {
+ t = constants_def();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_6(2)) {
+ t = predicates_def();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_7(2)) {
+ t = functions_def();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ if (jj_2_8(2)) {
+ t = constraints();
+ } else {
+ ;
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ label_1: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ break label_1;
+ }
+ t = structure_def();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token require_def() throws ParseException {
+ /* @bgen(jjtree) REQUIRE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTREQUIRE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(REQUIREMENTS);
+ label_2: while (true) {
+ require_key();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STRIPS:
+ case TYPING:
+ case NEGATIVE_PRECONDITIONS:
+ case DISJUNCTIVE_PRECONDITIONS:
+ case EQUALITY:
+ case EXISTENTIAL_PRECONDITIONS:
+ case UNIVERSAL_PRECONDITIONS:
+ case QUANTIFIED_PRECONDITIONS:
+ case CONDITIONAL_EFFECTS:
+ case FLUENTS:
+ case ADL:
+ case DURATIVE_ACTIONS:
+ case DERIVED_PREDICATES:
+ case TIMED_INITIAL_LITERALS:
+ case PREFERENCES:
+ case CONSTRAINTS:
+ case CONTINUS_EFFECTS:
+ case DURATION_INEQUALITIES:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_2;
+ }
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token require_key() throws ParseException {
+ /* @bgen(jjtree) REQUIRE_KEY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTREQUIRE_KEY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STRIPS:
+ t = jj_consume_token(STRIPS);
+ break;
+ case TYPING:
+ t = jj_consume_token(TYPING);
+ break;
+ case NEGATIVE_PRECONDITIONS:
+ t = jj_consume_token(NEGATIVE_PRECONDITIONS);
+ break;
+ case DISJUNCTIVE_PRECONDITIONS:
+ t = jj_consume_token(DISJUNCTIVE_PRECONDITIONS);
+ break;
+ case EQUALITY:
+ t = jj_consume_token(EQUALITY);
+ break;
+ case EXISTENTIAL_PRECONDITIONS:
+ t = jj_consume_token(EXISTENTIAL_PRECONDITIONS);
+ break;
+ case UNIVERSAL_PRECONDITIONS:
+ t = jj_consume_token(UNIVERSAL_PRECONDITIONS);
+ break;
+ case QUANTIFIED_PRECONDITIONS:
+ t = jj_consume_token(QUANTIFIED_PRECONDITIONS);
+ break;
+ case CONDITIONAL_EFFECTS:
+ t = jj_consume_token(CONDITIONAL_EFFECTS);
+ break;
+ case FLUENTS:
+ t = jj_consume_token(FLUENTS);
+ break;
+ case ADL:
+ t = jj_consume_token(ADL);
+ break;
+ case DURATIVE_ACTIONS:
+ t = jj_consume_token(DURATIVE_ACTIONS);
+ break;
+ case DERIVED_PREDICATES:
+ t = jj_consume_token(DERIVED_PREDICATES);
+ break;
+ case TIMED_INITIAL_LITERALS:
+ t = jj_consume_token(TIMED_INITIAL_LITERALS);
+ break;
+ case PREFERENCES:
+ t = jj_consume_token(PREFERENCES);
+ break;
+ case CONSTRAINTS:
+ t = jj_consume_token(CONSTRAINTS);
+ break;
+ case CONTINUS_EFFECTS:
+ t = jj_consume_token(CONTINUS_EFFECTS);
+ break;
+ case DURATION_INEQUALITIES:
+ t = jj_consume_token(DURATION_INEQUALITIES);
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token type_def() throws ParseException {
+ /* @bgen(jjtree) TYPE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(TYPES);
+ typed_list(LexerTreeConstants.JJTPRIMITIVE_TYPE);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token typed_list(int type) throws ParseException {
+ /* @bgen(jjtree) TYPED_LIST */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPED_LIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (type == LexerTreeConstants.JJTPRIMITIVE_TYPE) {
+ label_3: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case NUMBER_TYPE:
+ case OBJECT_TYPE:
+ case SYMBOL:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_3;
+ }
+ t = primitive_type();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SUB:
+ jj_consume_token(SUB);
+ type();
+ typed_list(type);
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ ;
+ }
+ } else if (type == LexerTreeConstants.JJTCONSTANT) {
+ label_4: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_4;
+ }
+ t = constant();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SUB:
+ jj_consume_token(SUB);
+ type();
+ typed_list(type);
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ ;
+ }
+ } else if (type == LexerTreeConstants.JJTVARIABLE) {
+ label_5: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 104:
+ ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ break label_5;
+ }
+ t = variable();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SUB:
+ jj_consume_token(SUB);
+ type();
+ typed_list(type);
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ ;
+ }
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ if (t != null) {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setTypeId(LexerTreeConstants.JJTVARIABLE);
+ }
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token type() throws ParseException {
+ /* @bgen(jjtree) TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(EITHER);
+ label_6: while (true) {
+ primitive_type();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case NUMBER_TYPE:
+ case OBJECT_TYPE:
+ case SYMBOL:
+ ;
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ break label_6;
+ }
+ }
+ jj_consume_token(RPAREN);
+ break;
+ case NUMBER_TYPE:
+ case OBJECT_TYPE:
+ case SYMBOL:
+ t = primitive_type();
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token primitive_type() throws ParseException {
+ /* @bgen(jjtree) PRIMITIVE_TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPRIMITIVE_TYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case OBJECT_TYPE:
+ t = jj_consume_token(OBJECT_TYPE);
+ break;
+ case NUMBER_TYPE:
+ t = jj_consume_token(NUMBER_TYPE);
+ break;
+ case SYMBOL:
+ t = jj_consume_token(SYMBOL);
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token constants_def() throws ParseException {
+ /* @bgen(jjtree) CONSTANT_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(CONSTANTS);
+ typed_list(LexerTreeConstants.JJTCONSTANT);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token constant() throws ParseException {
+ /* @bgen(jjtree) CONSTANT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ t = jj_consume_token(SYMBOL);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token predicates_def() throws ParseException {
+ /* @bgen(jjtree) PREDICATE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREDICATE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(PREDICATES);
+ label_7: while (true) {
+ atomic_formula_skeleton();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ break label_7;
+ }
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token atomic_formula_skeleton() throws ParseException {
+ /* @bgen(jjtree) ATOMIC_FORMULA_SKELETON */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FORMULA_SKELETON);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ t = jj_consume_token(LPAREN);
+ predicate();
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token predicate() throws ParseException {
+ /* @bgen(jjtree) PREDICATE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREDICATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ t = jj_consume_token(SYMBOL);
+ break;
+ case AT:
+ t = jj_consume_token(AT);
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token variable() throws ParseException {
+ /* @bgen(jjtree) VARIABLE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVARIABLE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ jj_consume_token(104);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ t = jj_consume_token(SYMBOL);
+ break;
+ case OBJECT_TYPE:
+ t = jj_consume_token(OBJECT_TYPE);
+ break;
+ case NUMBER_TYPE:
+ t = jj_consume_token(NUMBER_TYPE);
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token functions_def() throws ParseException {
+ /* @bgen(jjtree) FUNCTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FUNCTIONS);
+ function_typed_list(LexerTreeConstants.JJTATOMIC_FUNCTION_SKELETON);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token atomic_function_skeleton() throws ParseException {
+ /* @bgen(jjtree) ATOMIC_FUNCTION_SKELETON */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FUNCTION_SKELETON);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ t = jj_consume_token(LPAREN);
+ functor();
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token functor() throws ParseException {
+ /* @bgen(jjtree) FUNCTOR */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ t = jj_consume_token(SYMBOL);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token function_typed_list(int type) throws ParseException {
+ /* @bgen(jjtree) FUNCTION_TYPED_LIST */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_TYPED_LIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ label_8: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ break label_8;
+ }
+ t = atomic_function_skeleton();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SUB:
+ jj_consume_token(SUB);
+ function_type();
+ function_typed_list(type);
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ ;
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ if (t != null) {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ }
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token function_type() throws ParseException {
+ /* @bgen(jjtree) FUNCTION_TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_TYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ t = jj_consume_token(NUMBER_TYPE);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token con_gd() throws ParseException {
+ /* @bgen(jjtree) CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_9(2)) {
+ t = and_con_gd();
+ } else if (jj_2_10(2)) {
+ t = forall_con_gd();
+ } else if (jj_2_11(2)) {
+ t = at_end_con_gd();
+ } else if (jj_2_12(2)) {
+ t = always_con_gd();
+ } else if (jj_2_13(2)) {
+ t = sometime_con_gd();
+ } else if (jj_2_14(2)) {
+ t = within_con_gd();
+ } else if (jj_2_15(2)) {
+ t = at_most_once_con_gd();
+ } else if (jj_2_16(2)) {
+ t = sometime_after_con_gd();
+ } else if (jj_2_17(2)) {
+ t = sometime_before_con_gd();
+ } else if (jj_2_18(2)) {
+ t = always_within_con_gd();
+ } else if (jj_2_19(2)) {
+ t = hold_during_con_gd();
+ } else if (jj_2_20(2)) {
+ t = hold_after_con_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_con_gd() throws ParseException {
+ /* @bgen(jjtree) AND_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_9: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[17] = jj_gen;
+ break label_9;
+ }
+ con_gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_con_gd() throws ParseException {
+ /* @bgen(jjtree) FORALL_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ con_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_end_con_gd() throws ParseException {
+ /* @bgen(jjtree) AT_END_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(END);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token always_con_gd() throws ParseException {
+ /* @bgen(jjtree) ALWAYS_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTALWAYS_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ALWAYS);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token sometime_con_gd() throws ParseException {
+ /* @bgen(jjtree) SOMETIME_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SOMETIME);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token within_con_gd() throws ParseException {
+ /* @bgen(jjtree) WITHIN_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWITHIN_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(WITHIN);
+ jj_consume_token(NUMBER);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_most_once_con_gd() throws ParseException {
+ /* @bgen(jjtree) AT_MOST_ONCE_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_MOST_ONCE_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT_MOST_ONCE);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token sometime_after_con_gd() throws ParseException {
+ /* @bgen(jjtree) SOMETIME_AFTER_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_AFTER_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SOMETIME_AFTER);
+ gd();
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token sometime_before_con_gd() throws ParseException {
+ /* @bgen(jjtree) SOMETIME_BEFORE_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_BEFORE_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SOMETIME_BEFORE);
+ gd();
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token always_within_con_gd() throws ParseException {
+ /* @bgen(jjtree) ALWAYS_WITHIN_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTALWAYS_WITHIN_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ALWAYS_WITHIN);
+ jj_consume_token(NUMBER);
+ gd();
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token hold_during_con_gd() throws ParseException {
+ /* @bgen(jjtree) HOLD_DURING_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTHOLD_DURING_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(HOLD_DURING);
+ jj_consume_token(NUMBER);
+ jj_consume_token(NUMBER);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token hold_after_con_gd() throws ParseException {
+ /* @bgen(jjtree) HOLD_AFTER_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTHOLD_AFTER_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(HOLD_AFTER);
+ jj_consume_token(NUMBER);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token gd() throws ParseException {
+ /* @bgen(jjtree) GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_21(2)) {
+ t = atomic_formula(LexerTreeConstants.JJTTERM);
+ } else if (jj_2_22(2)) {
+ t = and_gd();
+ } else if (jj_2_23(2)) {
+ t = or_gd();
+ } else if (jj_2_24(2)) {
+ t = not_gd();
+ } else if (jj_2_25(2)) {
+ t = imply_gd();
+ } else if (jj_2_26(2)) {
+ t = exists_gd();
+ } else if (jj_2_27(2)) {
+ t = forall_gd();
+ } else if (jj_2_28(2)) {
+ t = f_comp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_gd() throws ParseException {
+ /* @bgen(jjtree) AND_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_10: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[18] = jj_gen;
+ break label_10;
+ }
+ gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token or_gd() throws ParseException {
+ /* @bgen(jjtree) OR_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOR_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(OR);
+ label_11: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[19] = jj_gen;
+ break label_11;
+ }
+ gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token not_gd() throws ParseException {
+ /* @bgen(jjtree) NOT_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNOT_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(NOT);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token imply_gd() throws ParseException {
+ /* @bgen(jjtree) IMPLY_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTIMPLY_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(IMPLY);
+ gd();
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token exists_gd() throws ParseException {
+ /* @bgen(jjtree) EXISTS_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEXISTS_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(EXISTS);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_gd() throws ParseException {
+ /* @bgen(jjtree) FORALL_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token atomic_formula(int type) throws ParseException {
+ /* @bgen(jjtree) ATOMIC_FORMULA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FORMULA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ predicate();
+ if (type == LexerTreeConstants.JJTCONSTANT) {
+ label_12: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ ;
+ break;
+ default:
+ jj_la1[20] = jj_gen;
+ break label_12;
+ }
+ constant();
+ }
+ jjtn000.setTypeId(LexerTreeConstants.JJTCONSTANT);
+ } else if (type == LexerTreeConstants.JJTTERM) {
+ label_13: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ case 104:
+ ;
+ break;
+ default:
+ jj_la1[21] = jj_gen;
+ break label_13;
+ }
+ term();
+ }
+ jjtn000.setTypeId(LexerTreeConstants.JJTTERM);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token term() throws ParseException {
+ /* @bgen(jjtree) TERM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTERM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ t = constant();
+ break;
+ case 104:
+ t = variable();
+ break;
+ default:
+ jj_la1[22] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token literal(int type) throws ParseException {
+ /* @bgen(jjtree) LITERAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_29(2)) {
+ t = atomic_formula(type);
+ } else if (jj_2_30(2)) {
+ t = not_atomic_formula(type);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token not_atomic_formula(int type) throws ParseException {
+ /* @bgen(jjtree) NOT_ATOMIC_FORMULA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNOT_ATOMIC_FORMULA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(NOT);
+ atomic_formula(type);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_comp() throws ParseException {
+ /* @bgen(jjtree) F_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = binary_comp();
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token binary_comp() throws ParseException {
+ /* @bgen(jjtree) BINARY_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_31(2)) {
+ t = greater_comp();
+ } else if (jj_2_32(2)) {
+ t = less_comp();
+ } else if (jj_2_33(2)) {
+ t = greater_equal_comp();
+ } else if (jj_2_34(2)) {
+ t = less_equal_comp();
+ } else if (jj_2_35(2)) {
+ t = equal_comp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token greater_comp() throws ParseException {
+ /* @bgen(jjtree) GREATER_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGREATER_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(GREATER);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token greater_equal_comp() throws ParseException {
+ /* @bgen(jjtree) GREATER_EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGREATER_EQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(GEQUAL);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token less_equal_comp() throws ParseException {
+ /* @bgen(jjtree) LESS_EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLESS_EQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(LEQUAL);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token less_comp() throws ParseException {
+ /* @bgen(jjtree) LESS_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLESS_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(LESS);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token equal_comp() throws ParseException {
+ /* @bgen(jjtree) EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(EQUAL);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_exp() throws ParseException {
+ /* @bgen(jjtree) F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case NUMBER:
+ t = number();
+ break;
+ default:
+ jj_la1[23] = jj_gen;
+ if (jj_2_36(2)) {
+ t = op();
+ } else if (jj_2_37(2)) {
+ t = f_head();
+ } else if (jj_2_38(2)) {
+ t = variable();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token number() throws ParseException {
+ /* @bgen(jjtree) NUMBER */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNUMBER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(NUMBER);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token op() throws ParseException {
+ /* @bgen(jjtree) OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_39(2)) {
+ t = binary_operation();
+ } else if (jj_2_40(2)) {
+ t = unary_op();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token binary_operation() throws ParseException {
+ /* @bgen(jjtree) BINARY_OPERATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_OPERATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_41(2)) {
+ t = add_op();
+ } else if (jj_2_42(2)) {
+ t = substract_op();
+ } else if (jj_2_43(2)) {
+ t = multiply_op();
+ } else if (jj_2_44(2)) {
+ t = divide_op();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token add_op() throws ParseException {
+ /* @bgen(jjtree) ADD_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ADD);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token substract_op() throws ParseException {
+ /* @bgen(jjtree) SUBSTRACT_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSUBSTRACT_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token multiply_op() throws ParseException {
+ /* @bgen(jjtree) MULTIPLY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMULTIPLY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(MUL);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token divide_op() throws ParseException {
+ /* @bgen(jjtree) DIVIDE_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDIVIDE_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DIV);
+ f_exp();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token unary_op() throws ParseException {
+ /* @bgen(jjtree) UNARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTUNARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_head() throws ParseException {
+ /* @bgen(jjtree) F_HEAD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_HEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ functor();
+ label_14: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ case 104:
+ ;
+ break;
+ default:
+ jj_la1[24] = jj_gen;
+ break label_14;
+ }
+ term();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token structure_def() throws ParseException {
+ /* @bgen(jjtree) STRUCTURE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSTRUCTURE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_45(2)) {
+ t = action_def();
+ } else if (jj_2_46(2)) {
+ t = durative_action_def();
+ } else if (jj_2_47(2)) {
+ t = derived_def();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token action_def() throws ParseException {
+ /* @bgen(jjtree) ACTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ACTION);
+ action_name();
+ jj_consume_token(PARAMETERS);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ action_def_body();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token action_name() throws ParseException {
+ /* @bgen(jjtree) ACTION_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(SYMBOL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token action_def_body() throws ParseException {
+ /* @bgen(jjtree) ACTION_DEF_BODY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_DEF_BODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(PRECONDITION);
+ pre_gd();
+ jj_consume_token(EFFECT);
+ effect();
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token pre_gd() throws ParseException {
+ /* @bgen(jjtree) PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_48(2)) {
+ t = empty_or();
+ } else if (jj_2_49(2)) {
+ t = pref_gd();
+ } else if (jj_2_50(2)) {
+ t = and_pre_gd();
+ } else if (jj_2_51(2)) {
+ t = forall_pre_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token empty_or() throws ParseException {
+ /* @bgen(jjtree) EMPTY_OR */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEMPTY_OR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_pre_gd() throws ParseException {
+ /* @bgen(jjtree) AND_PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_PRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_15: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_15;
+ }
+ pre_gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_pre_gd() throws ParseException {
+ /* @bgen(jjtree) FORALL_PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_PRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ pre_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token pref_gd() throws ParseException {
+ /* @bgen(jjtree) PREF_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_52(2)) {
+ t = named_pref_gd();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ t = gd();
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token named_pref_gd() throws ParseException {
+ /* @bgen(jjtree) NAMED_PREF_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(PREFERENCE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ pref_name();
+ break;
+ default:
+ jj_la1[27] = jj_gen;
+ ;
+ }
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token pref_name() throws ParseException {
+ /* @bgen(jjtree) PREF_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(SYMBOL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token effect() throws ParseException {
+ /* @bgen(jjtree) EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_53(2)) {
+ t = and_c_effect();
+ } else if (jj_2_54(2)) {
+ t = c_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_c_effect() throws ParseException {
+ /* @bgen(jjtree) AND_C_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_C_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_16: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[28] = jj_gen;
+ break label_16;
+ }
+ c_effect();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token prob_effect() throws ParseException {
+ /* @bgen(jjtree) PROB_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROB_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(PROB);
+ label_17: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case NUMBER:
+ ;
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ break label_17;
+ }
+ prob_term();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token prob_term() throws ParseException {
+ /* @bgen(jjtree) PROB_TERM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROB_TERM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_55(3)) {
+ t = number();
+ c_effect();
+ } else if (jj_2_56(3)) {
+ t = number();
+ and_c_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token c_effect() throws ParseException {
+ /* @bgen(jjtree) C_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTC_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_57(2)) {
+ t = forall_effect();
+ } else if (jj_2_58(2)) {
+ t = when_con_effect();
+ } else if (jj_2_59(2)) {
+ t = p_effect();
+ } else if (jj_2_60(2)) {
+ t = prob_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_effect() throws ParseException {
+ /* @bgen(jjtree) FORALL_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ effect();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token when_con_effect() throws ParseException {
+ /* @bgen(jjtree) WHEN_CON_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWHEN_CON_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(WHEN);
+ gd();
+ cond_effect();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token cond_effect() throws ParseException {
+ /* @bgen(jjtree) COND_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCOND_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_61(2)) {
+ t = and_c_effect();
+ } else if (jj_2_62(2)) {
+ t = c_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_p_effect() throws ParseException {
+ /* @bgen(jjtree) AND_P_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_P_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_18: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ break label_18;
+ }
+ p_effect();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token p_effect() throws ParseException {
+ /* @bgen(jjtree) P_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTP_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_63(2)) {
+ t = assign_op();
+ } else if (jj_2_64(2)) {
+ t = literal(LexerTreeConstants.JJTTERM);
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token assign_op() throws ParseException {
+ /* @bgen(jjtree) ASSIGN_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_65(2)) {
+ t = assign();
+ } else if (jj_2_66(2)) {
+ t = scale_up();
+ } else if (jj_2_67(2)) {
+ t = scale_down();
+ } else if (jj_2_68(2)) {
+ t = increase();
+ } else if (jj_2_69(2)) {
+ t = decrease();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token assign() throws ParseException {
+ /* @bgen(jjtree) ASSIGN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ASSIGN);
+ f_head();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token scale_up() throws ParseException {
+ /* @bgen(jjtree) SCALE_UP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSCALE_UP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SCALE_UP);
+ f_head();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token scale_down() throws ParseException {
+ /* @bgen(jjtree) SCALE_DOWN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSCALE_DOWN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SCALE_DOWN);
+ f_head();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token increase() throws ParseException {
+ /* @bgen(jjtree) INCREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINCREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(INCREASE);
+ f_head();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token decrease() throws ParseException {
+ /* @bgen(jjtree) DECREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDECREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DECREASE);
+ f_head();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token durative_action_def() throws ParseException {
+ /* @bgen(jjtree) DURATION_ACTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDURATION_ACTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DURATIVE_ACTION);
+ da_symbol();
+ jj_consume_token(PARAMETERS);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ da_def_body();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_symbol() throws ParseException {
+ /* @bgen(jjtree) DA_SYMBOL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SYMBOL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(SYMBOL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_def_body() throws ParseException {
+ /* @bgen(jjtree) DA_DEF_BODY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DEF_BODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(DURATION);
+ duration_constraint();
+ jj_consume_token(CONDITION);
+ da_gd();
+ jj_consume_token(EFFECT);
+ da_effect();
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token duration_constraint() throws ParseException {
+ /* @bgen(jjtree) DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_70(2)) {
+ t = empty_or();
+ } else if (jj_2_71(2)) {
+ t = and_simple_duration_constraint();
+ } else if (jj_2_72(2)) {
+ t = simple_duration_constraint();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_simple_duration_constraint() throws ParseException {
+ /* @bgen(jjtree) AND_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTAND_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_19: while (true) {
+ simple_duration_constraint();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[31] = jj_gen;
+ break label_19;
+ }
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token simple_duration_constraint() throws ParseException {
+ /* @bgen(jjtree) SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_73(2)) {
+ t = d_op();
+ } else if (jj_2_74(2)) {
+ t = at_simple_duration_constraint();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_simple_duration_constraint() throws ParseException {
+ /* @bgen(jjtree) AT_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTAT_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_75(3)) {
+ t = at_start_simple_duration_constraint();
+ } else if (jj_2_76(3)) {
+ t = at_end_simple_duration_constraint();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_start_simple_duration_constraint()
+ throws ParseException {
+ /* @bgen(jjtree) AT_START_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTAT_START_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(START);
+ simple_duration_constraint();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_end_simple_duration_constraint()
+ throws ParseException {
+ /* @bgen(jjtree) AT_END_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTAT_END_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(END);
+ simple_duration_constraint();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token d_op() throws ParseException {
+ /* @bgen(jjtree) D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_77(2)) {
+ t = equal_d_op();
+ } else if (jj_2_78(2)) {
+ t = gequal_d_op();
+ } else if (jj_2_79(2)) {
+ t = lequal_d_op();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token equal_d_op() throws ParseException {
+ /* @bgen(jjtree) EQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(EQUAL);
+ var_duration();
+ d_value();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token gequal_d_op() throws ParseException {
+ /* @bgen(jjtree) GEQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(GEQUAL);
+ var_duration();
+ d_value();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token lequal_d_op() throws ParseException {
+ /* @bgen(jjtree) LEQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(LEQUAL);
+ var_duration();
+ d_value();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token var_duration() throws ParseException {
+ /* @bgen(jjtree) VAR_DURATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVAR_DURATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(VAR_DURATION);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token d_value() throws ParseException {
+ /* @bgen(jjtree) D_VALUE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTD_VALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_80(2)) {
+ t = number();
+ } else if (jj_2_81(2)) {
+ t = f_exp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_gd() throws ParseException {
+ /* @bgen(jjtree) DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_82(2)) {
+ t = pref_timed_gd();
+ } else if (jj_2_83(2)) {
+ t = and_da_gd();
+ } else if (jj_2_84(2)) {
+ t = forall_da_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_da_gd() throws ParseException {
+ /* @bgen(jjtree) FORALL_DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_DA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ da_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_da_gd() throws ParseException {
+ /* @bgen(jjtree) AND_DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_DA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_20: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[32] = jj_gen;
+ break label_20;
+ }
+ da_gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token pref_timed_gd() throws ParseException {
+ /* @bgen(jjtree) PREF_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_85(2)) {
+ t = timed_gd();
+ } else if (jj_2_86(2)) {
+ t = named_pref_timed_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token named_pref_timed_gd() throws ParseException {
+ /* @bgen(jjtree) NAMED_PREF_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(PREFERENCE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ pref_name();
+ break;
+ default:
+ jj_la1[33] = jj_gen;
+ ;
+ }
+ timed_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token timed_gd() throws ParseException {
+ /* @bgen(jjtree) TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_87(2)) {
+ t = at_timed_gd();
+ } else if (jj_2_88(2)) {
+ t = over_timed_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token over_timed_gd() throws ParseException {
+ /* @bgen(jjtree) OVER_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOVER_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = over_all_timed_gd();
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token over_all_timed_gd() throws ParseException {
+ /* @bgen(jjtree) OVER_ALL_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOVER_ALL_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(OVER);
+ jj_consume_token(ALL);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_timed_gd() throws ParseException {
+ /* @bgen(jjtree) AT_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_89(3)) {
+ t = at_start_timed_gd();
+ } else if (jj_2_90(2)) {
+ t = at_end_timed_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_start_timed_gd() throws ParseException {
+ /* @bgen(jjtree) AT_START_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(START);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_end_timed_gd() throws ParseException {
+ /* @bgen(jjtree) AT_END_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(END);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token interval() throws ParseException {
+ /* @bgen(jjtree) INTERVAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINTERVAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(ALL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_effect() throws ParseException {
+ /* @bgen(jjtree) DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_91(2)) {
+ t = timed_effect();
+ } else if (jj_2_92(2)) {
+ t = and_da_effect();
+ } else if (jj_2_93(2)) {
+ t = forall_da_effect();
+ } else if (jj_2_94(2)) {
+ t = when_da_effect();
+ } else if (jj_2_95(2)) {
+ t = da_assign_op();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_assign_op() throws ParseException {
+ /* @bgen(jjtree) DA_ASSIGN_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ASSIGN_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_96(2)) {
+ t = da_assign();
+ } else if (jj_2_97(2)) {
+ t = da_scale_up();
+ } else if (jj_2_98(2)) {
+ t = da_scale_down();
+ } else if (jj_2_99(2)) {
+ t = da_increase();
+ } else if (jj_2_100(2)) {
+ t = da_decrease();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_assign() throws ParseException {
+ /* @bgen(jjtree) DA_ASSIGN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ASSIGN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ASSIGN);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_scale_up() throws ParseException {
+ /* @bgen(jjtree) DA_SCALE_UP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SCALE_UP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SCALE_UP);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_scale_down() throws ParseException {
+ /* @bgen(jjtree) DA_SCALE_DOWN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SCALE_DOWN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SCALE_DOWN);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_increase() throws ParseException {
+ /* @bgen(jjtree) DA_INCREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_INCREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(INCREASE);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_decrease() throws ParseException {
+ /* @bgen(jjtree) DA_DECREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DECREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DECREASE);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token when_da_effect() throws ParseException {
+ /* @bgen(jjtree) WHEN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWHEN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(WHEN);
+ da_gd();
+ timed_effect();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_da_effect() throws ParseException {
+ /* @bgen(jjtree) FORALL_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ da_effect();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_da_effect() throws ParseException {
+ /* @bgen(jjtree) AND_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_21: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[34] = jj_gen;
+ break label_21;
+ }
+ da_effect();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token timed_effect() throws ParseException {
+ /* @bgen(jjtree) TIMED_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_101(2)) {
+ t = at_da_effect();
+ } else if (jj_2_102(2)) {
+ t = at_f_assign_da_effect();
+ } else if (jj_2_103(2)) {
+ t = assign_op_t();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_f_assign_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_104(3)) {
+ t = at_start_f_assign_da_effect();
+ } else if (jj_2_105(3)) {
+ t = at_end_f_assign_da_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_start_f_assign_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_START_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTAT_START_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(START);
+ f_assign_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_end_f_assign_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_END_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(END);
+ f_assign_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_106(4)) {
+ t = at_start_da_effect();
+ } else if (jj_2_107(4)) {
+ t = at_end_da_effect();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_start_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_START_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(START);
+ literal(LexerTreeConstants.JJTTERM);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token at_end_da_effect() throws ParseException {
+ /* @bgen(jjtree) AT_END_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ jj_consume_token(END);
+ literal(LexerTreeConstants.JJTTERM);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token assign_op_t() throws ParseException {
+ /* @bgen(jjtree) ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_108(2)) {
+ t = increase_assign_op_t();
+ } else if (jj_2_109(2)) {
+ t = decrease_assign_op_t();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token increase_assign_op_t() throws ParseException {
+ /* @bgen(jjtree) INCREASE_ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINCREASE_ASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(INCREASE);
+ f_head();
+ f_exp_t();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token decrease_assign_op_t() throws ParseException {
+ /* @bgen(jjtree) DECREASE_ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDECREASE_ASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DECREASE);
+ f_head();
+ f_exp_t();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_exp_t() throws ParseException {
+ /* @bgen(jjtree) F_EXP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_110(2)) {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(MUL);
+ continous_variable();
+ f_exp();
+ jj_consume_token(RPAREN);
+ } else if (jj_2_111(2)) {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(MUL);
+ f_exp();
+ continous_variable();
+ jj_consume_token(RPAREN);
+ } else if (jj_2_112(2)) {
+ t = continous_variable();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token continous_variable() throws ParseException {
+ /* @bgen(jjtree) CONTINOUS_VARIABLE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONTINOUS_VARIABLE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(CONTINOUS_VARIABLE);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_assign_da() throws ParseException {
+ /* @bgen(jjtree) F_ASSIGN_DA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_ASSIGN_DA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_113(2)) {
+ t = da_assign();
+ } else if (jj_2_114(2)) {
+ t = da_scale_up();
+ } else if (jj_2_115(2)) {
+ t = da_scale_down();
+ } else if (jj_2_116(2)) {
+ t = da_increase();
+ } else if (jj_2_117(2)) {
+ t = da_decrease();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token f_exp_da() throws ParseException {
+ /* @bgen(jjtree) F_EXP_DA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP_DA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_118(3)) {
+ t = f_exp();
+ } else if (jj_2_119(3)) {
+ t = da_binary_op();
+ } else if (jj_2_120(3)) {
+ t = da_unary_op();
+ } else if (jj_2_121(3)) {
+ t = var_duration();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_binary_op() throws ParseException {
+ /* @bgen(jjtree) DA_BINARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_BINARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_122(2)) {
+ t = da_add_op();
+ } else if (jj_2_123(2)) {
+ t = da_substract_op();
+ } else if (jj_2_124(2)) {
+ t = da_multiply_op();
+ } else if (jj_2_125(2)) {
+ t = da_divide_op();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_add_op() throws ParseException {
+ /* @bgen(jjtree) DA_ADD_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ADD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ADD);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_substract_op() throws ParseException {
+ /* @bgen(jjtree) DA_SUBSTRACT_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SUBSTRACT_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_multiply_op() throws ParseException {
+ /* @bgen(jjtree) DA_MULTIPLY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_MULTIPLY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(MUL);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_divide_op() throws ParseException {
+ /* @bgen(jjtree) DA_DIVIDE_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DIVIDE_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DIV);
+ f_head();
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token da_unary_op() throws ParseException {
+ /* @bgen(jjtree) DA_UNARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_UNARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ f_exp_da();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token derived_def() throws ParseException {
+ /* @bgen(jjtree) DERIVED_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDERIVED_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DERIVED);
+ atomic_formula(LexerTreeConstants.JJTVARIABLE);
+ gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token problem() throws ParseException {
+ /* @bgen(jjtree) PROBLEM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROBLEM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(DEFINE);
+ jj_consume_token(LPAREN);
+ jj_consume_token(PROBLEM);
+ problem_name();
+ jj_consume_token(RPAREN);
+ jj_consume_token(LPAREN);
+ jj_consume_token(P_DOMAIN);
+ domain_name();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ if (jj_2_126(2)) {
+ require_def();
+ } else {
+ ;
+ }
+ if (jj_2_127(2)) {
+ object_declaration();
+ } else {
+ ;
+ }
+ init();
+ goal();
+ if (jj_2_128(2)) {
+ constraints();
+ } else {
+ ;
+ }
+ if (jj_2_129(2)) {
+ metric_spec();
+ } else {
+ ;
+ }
+ jj_consume_token(RPAREN);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token problem_name() throws ParseException {
+ /* @bgen(jjtree) PROBLEM_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROBLEM_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(SYMBOL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token domain_name() throws ParseException {
+ /* @bgen(jjtree) DOMAIN_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDOMAIN_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(SYMBOL);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token object_declaration() throws ParseException {
+ /* @bgen(jjtree) OBJECT_DECLARATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOBJECT_DECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(OBJECTS);
+ typed_list(LexerTreeConstants.JJTCONSTANT);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token init() throws ParseException {
+ /* @bgen(jjtree) INIT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(INIT);
+ label_22: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[35] = jj_gen;
+ break label_22;
+ }
+ init_el();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token init_el() throws ParseException {
+ /* @bgen(jjtree) INIT_EL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINIT_EL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_130(2)) {
+ t = literal(LexerTreeConstants.JJTCONSTANT);
+ } else if (jj_2_131(2)) {
+ t = equal_init_el();
+ } else if (jj_2_132(3)) {
+ t = timed_literal();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token equal_init_el() throws ParseException {
+ /* @bgen(jjtree) EQUAL_INIT_EL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_INIT_EL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(EQUALITY);
+ f_head();
+ number();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token timed_literal() throws ParseException {
+ /* @bgen(jjtree) TIMED_LITERAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_LITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AT);
+ number();
+ literal(LexerTreeConstants.JJTCONSTANT);
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token goal() throws ParseException {
+ /* @bgen(jjtree) GOAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGOAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(GOAL);
+ pre_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token constraints() throws ParseException {
+ /* @bgen(jjtree) CONSTRAINTS */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTRAINTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(CONSTRAINTS);
+ pref_con_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token pref_con_gd() throws ParseException {
+ /* @bgen(jjtree) PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_133(2)) {
+ t = and_pref_con_gd();
+ } else if (jj_2_134(2)) {
+ t = forall_pref_con_gd();
+ } else if (jj_2_135(2)) {
+ t = named_pref_con_gd();
+ } else if (jj_2_136(2)) {
+ t = con_gd();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token and_pref_con_gd() throws ParseException {
+ /* @bgen(jjtree) AND_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(AND);
+ label_23: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ ;
+ break;
+ default:
+ jj_la1[36] = jj_gen;
+ break label_23;
+ }
+ pref_con_gd();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token named_pref_con_gd() throws ParseException {
+ /* @bgen(jjtree) NAMED_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(PREFERENCE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ pref_name();
+ break;
+ default:
+ jj_la1[37] = jj_gen;
+ ;
+ }
+ con_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token forall_pref_con_gd() throws ParseException {
+ /* @bgen(jjtree) FORALL_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(FORALL);
+ jj_consume_token(LPAREN);
+ typed_list(LexerTreeConstants.JJTVARIABLE);
+ jj_consume_token(RPAREN);
+ pref_con_gd();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token metric_spec() throws ParseException {
+ /* @bgen(jjtree) METRIC_SPEC */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMETRIC_SPEC);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_137(3)) {
+ t = maximize();
+ } else if (jj_2_138(3)) {
+ t = minimize();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token maximize() throws ParseException {
+ /* @bgen(jjtree) MAXIMIZE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMAXIMIZE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(METRIC);
+ jj_consume_token(MAXIMIZE);
+ metric_f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token minimize() throws ParseException {
+ /* @bgen(jjtree) MINIMIZE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMINIMIZE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(METRIC);
+ jj_consume_token(MINIMIZE);
+ metric_f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMETRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_139(2)) {
+ t = unary_op_metric_f_exp();
+ } else if (jj_2_140(2)) {
+ t = binary_op_metric_f_exp();
+ } else if (jj_2_141(2)) {
+ t = multi_op_metric_f_exp();
+ } else if (jj_2_142(2)) {
+ t = number();
+ } else if (jj_2_143(2)) {
+ t = constant_f_head();
+ } else if (jj_2_144(2)) {
+ t = total_time();
+ } else if (jj_2_145(2)) {
+ t = violated_pref_exp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token violated_pref_exp() throws ParseException {
+ /* @bgen(jjtree) VIOLATED_PREF_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVIOLATED_PREF_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(IS_VIOLATED);
+ pref_name();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token constant_f_head() throws ParseException {
+ /* @bgen(jjtree) CONSTANT_F_HEAD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT_F_HEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ functor();
+ label_24: while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SYMBOL:
+ ;
+ break;
+ default:
+ jj_la1[38] = jj_gen;
+ break label_24;
+ }
+ constant();
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token total_time() throws ParseException {
+ /* @bgen(jjtree) TOTAL_TIME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTOTAL_TIME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(TOTAL_TIME);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token binary_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) BINARY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_146(2)) {
+ t = add_op_metric_f_exp();
+ } else if (jj_2_147(2)) {
+ t = substract_op_metric_f_exp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token add_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) ADD_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ADD);
+ metric_f_exp();
+ metric_f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token substract_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) SUBSTRACT_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSUBSTRACT_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ metric_f_exp();
+ metric_f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token multi_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) MULTI_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMULTI_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ if (jj_2_148(2)) {
+ t = multiply_narity_op_metric_f_exp();
+ } else if (jj_2_149(2)) {
+ t = add_narity_op_metric_f_exp();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token multiply_narity_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) MULTIPLY_NARITY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this,
+ JJTMULTIPLY_NARITY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(MUL);
+ metric_f_exp();
+ label_25: while (true) {
+ metric_f_exp();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ case TOTAL_TIME:
+ case NUMBER:
+ ;
+ break;
+ default:
+ jj_la1[39] = jj_gen;
+ break label_25;
+ }
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token add_narity_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) ADD_NARITY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_NARITY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(ADD);
+ metric_f_exp();
+ label_26: while (true) {
+ metric_f_exp();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ case TOTAL_TIME:
+ case NUMBER:
+ ;
+ break;
+ default:
+ jj_la1[40] = jj_gen;
+ break label_26;
+ }
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public Token unary_op_metric_f_exp() throws ParseException {
+ /* @bgen(jjtree) UNARY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTUNARY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ Token t = token;
+ try {
+ try {
+ t = jj_consume_token(LPAREN);
+ jj_consume_token(SUB);
+ metric_f_exp();
+ jj_consume_token(RPAREN);
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ ;
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ {
+ if (true)
+ return t;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true)
+ throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true)
+ throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true)
+ throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ private boolean jj_2_1(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_1();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(0, xla);
+ }
+ }
+
+ private boolean jj_2_2(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_2();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(1, xla);
+ }
+ }
+
+ private boolean jj_2_3(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_3();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(2, xla);
+ }
+ }
+
+ private boolean jj_2_4(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_4();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(3, xla);
+ }
+ }
+
+ private boolean jj_2_5(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_5();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(4, xla);
+ }
+ }
+
+ private boolean jj_2_6(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_6();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(5, xla);
+ }
+ }
+
+ private boolean jj_2_7(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_7();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(6, xla);
+ }
+ }
+
+ private boolean jj_2_8(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_8();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(7, xla);
+ }
+ }
+
+ private boolean jj_2_9(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_9();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(8, xla);
+ }
+ }
+
+ private boolean jj_2_10(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_10();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(9, xla);
+ }
+ }
+
+ private boolean jj_2_11(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_11();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(10, xla);
+ }
+ }
+
+ private boolean jj_2_12(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_12();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(11, xla);
+ }
+ }
+
+ private boolean jj_2_13(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_13();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(12, xla);
+ }
+ }
+
+ private boolean jj_2_14(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_14();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(13, xla);
+ }
+ }
+
+ private boolean jj_2_15(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_15();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(14, xla);
+ }
+ }
+
+ private boolean jj_2_16(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_16();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(15, xla);
+ }
+ }
+
+ private boolean jj_2_17(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_17();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(16, xla);
+ }
+ }
+
+ private boolean jj_2_18(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_18();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(17, xla);
+ }
+ }
+
+ private boolean jj_2_19(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_19();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(18, xla);
+ }
+ }
+
+ private boolean jj_2_20(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_20();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(19, xla);
+ }
+ }
+
+ private boolean jj_2_21(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_21();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(20, xla);
+ }
+ }
+
+ private boolean jj_2_22(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_22();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(21, xla);
+ }
+ }
+
+ private boolean jj_2_23(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_23();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(22, xla);
+ }
+ }
+
+ private boolean jj_2_24(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_24();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(23, xla);
+ }
+ }
+
+ private boolean jj_2_25(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_25();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(24, xla);
+ }
+ }
+
+ private boolean jj_2_26(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_26();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(25, xla);
+ }
+ }
+
+ private boolean jj_2_27(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_27();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(26, xla);
+ }
+ }
+
+ private boolean jj_2_28(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_28();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(27, xla);
+ }
+ }
+
+ private boolean jj_2_29(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_29();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(28, xla);
+ }
+ }
+
+ private boolean jj_2_30(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_30();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(29, xla);
+ }
+ }
+
+ private boolean jj_2_31(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_31();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(30, xla);
+ }
+ }
+
+ private boolean jj_2_32(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_32();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(31, xla);
+ }
+ }
+
+ private boolean jj_2_33(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_33();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(32, xla);
+ }
+ }
+
+ private boolean jj_2_34(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_34();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(33, xla);
+ }
+ }
+
+ private boolean jj_2_35(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_35();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(34, xla);
+ }
+ }
+
+ private boolean jj_2_36(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_36();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(35, xla);
+ }
+ }
+
+ private boolean jj_2_37(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_37();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(36, xla);
+ }
+ }
+
+ private boolean jj_2_38(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_38();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(37, xla);
+ }
+ }
+
+ private boolean jj_2_39(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_39();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(38, xla);
+ }
+ }
+
+ private boolean jj_2_40(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_40();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(39, xla);
+ }
+ }
+
+ private boolean jj_2_41(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_41();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(40, xla);
+ }
+ }
+
+ private boolean jj_2_42(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_42();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(41, xla);
+ }
+ }
+
+ private boolean jj_2_43(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_43();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(42, xla);
+ }
+ }
+
+ private boolean jj_2_44(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_44();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(43, xla);
+ }
+ }
+
+ private boolean jj_2_45(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_45();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(44, xla);
+ }
+ }
+
+ private boolean jj_2_46(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_46();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(45, xla);
+ }
+ }
+
+ private boolean jj_2_47(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_47();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(46, xla);
+ }
+ }
+
+ private boolean jj_2_48(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_48();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(47, xla);
+ }
+ }
+
+ private boolean jj_2_49(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_49();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(48, xla);
+ }
+ }
+
+ private boolean jj_2_50(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_50();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(49, xla);
+ }
+ }
+
+ private boolean jj_2_51(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_51();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(50, xla);
+ }
+ }
+
+ private boolean jj_2_52(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_52();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(51, xla);
+ }
+ }
+
+ private boolean jj_2_53(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_53();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(52, xla);
+ }
+ }
+
+ private boolean jj_2_54(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_54();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(53, xla);
+ }
+ }
+
+ private boolean jj_2_55(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_55();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(54, xla);
+ }
+ }
+
+ private boolean jj_2_56(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_56();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(55, xla);
+ }
+ }
+
+ private boolean jj_2_57(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_57();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(56, xla);
+ }
+ }
+
+ private boolean jj_2_58(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_58();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(57, xla);
+ }
+ }
+
+ private boolean jj_2_59(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_59();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(58, xla);
+ }
+ }
+
+ private boolean jj_2_60(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_60();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(59, xla);
+ }
+ }
+
+ private boolean jj_2_61(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_61();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(60, xla);
+ }
+ }
+
+ private boolean jj_2_62(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_62();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(61, xla);
+ }
+ }
+
+ private boolean jj_2_63(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_63();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(62, xla);
+ }
+ }
+
+ private boolean jj_2_64(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_64();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(63, xla);
+ }
+ }
+
+ private boolean jj_2_65(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_65();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(64, xla);
+ }
+ }
+
+ private boolean jj_2_66(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_66();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(65, xla);
+ }
+ }
+
+ private boolean jj_2_67(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_67();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(66, xla);
+ }
+ }
+
+ private boolean jj_2_68(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_68();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(67, xla);
+ }
+ }
+
+ private boolean jj_2_69(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_69();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(68, xla);
+ }
+ }
+
+ private boolean jj_2_70(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_70();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(69, xla);
+ }
+ }
+
+ private boolean jj_2_71(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_71();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(70, xla);
+ }
+ }
+
+ private boolean jj_2_72(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_72();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(71, xla);
+ }
+ }
+
+ private boolean jj_2_73(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_73();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(72, xla);
+ }
+ }
+
+ private boolean jj_2_74(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_74();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(73, xla);
+ }
+ }
+
+ private boolean jj_2_75(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_75();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(74, xla);
+ }
+ }
+
+ private boolean jj_2_76(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_76();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(75, xla);
+ }
+ }
+
+ private boolean jj_2_77(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_77();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(76, xla);
+ }
+ }
+
+ private boolean jj_2_78(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_78();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(77, xla);
+ }
+ }
+
+ private boolean jj_2_79(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_79();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(78, xla);
+ }
+ }
+
+ private boolean jj_2_80(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_80();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(79, xla);
+ }
+ }
+
+ private boolean jj_2_81(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_81();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(80, xla);
+ }
+ }
+
+ private boolean jj_2_82(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_82();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(81, xla);
+ }
+ }
+
+ private boolean jj_2_83(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_83();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(82, xla);
+ }
+ }
+
+ private boolean jj_2_84(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_84();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(83, xla);
+ }
+ }
+
+ private boolean jj_2_85(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_85();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(84, xla);
+ }
+ }
+
+ private boolean jj_2_86(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_86();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(85, xla);
+ }
+ }
+
+ private boolean jj_2_87(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_87();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(86, xla);
+ }
+ }
+
+ private boolean jj_2_88(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_88();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(87, xla);
+ }
+ }
+
+ private boolean jj_2_89(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_89();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(88, xla);
+ }
+ }
+
+ private boolean jj_2_90(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_90();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(89, xla);
+ }
+ }
+
+ private boolean jj_2_91(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_91();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(90, xla);
+ }
+ }
+
+ private boolean jj_2_92(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_92();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(91, xla);
+ }
+ }
+
+ private boolean jj_2_93(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_93();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(92, xla);
+ }
+ }
+
+ private boolean jj_2_94(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_94();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(93, xla);
+ }
+ }
+
+ private boolean jj_2_95(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_95();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(94, xla);
+ }
+ }
+
+ private boolean jj_2_96(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_96();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(95, xla);
+ }
+ }
+
+ private boolean jj_2_97(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_97();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(96, xla);
+ }
+ }
+
+ private boolean jj_2_98(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_98();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(97, xla);
+ }
+ }
+
+ private boolean jj_2_99(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_99();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(98, xla);
+ }
+ }
+
+ private boolean jj_2_100(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_100();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(99, xla);
+ }
+ }
+
+ private boolean jj_2_101(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_101();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(100, xla);
+ }
+ }
+
+ private boolean jj_2_102(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_102();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(101, xla);
+ }
+ }
+
+ private boolean jj_2_103(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_103();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(102, xla);
+ }
+ }
+
+ private boolean jj_2_104(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_104();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(103, xla);
+ }
+ }
+
+ private boolean jj_2_105(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_105();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(104, xla);
+ }
+ }
+
+ private boolean jj_2_106(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_106();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(105, xla);
+ }
+ }
+
+ private boolean jj_2_107(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_107();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(106, xla);
+ }
+ }
+
+ private boolean jj_2_108(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_108();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(107, xla);
+ }
+ }
+
+ private boolean jj_2_109(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_109();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(108, xla);
+ }
+ }
+
+ private boolean jj_2_110(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_110();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(109, xla);
+ }
+ }
+
+ private boolean jj_2_111(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_111();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(110, xla);
+ }
+ }
+
+ private boolean jj_2_112(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_112();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(111, xla);
+ }
+ }
+
+ private boolean jj_2_113(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_113();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(112, xla);
+ }
+ }
+
+ private boolean jj_2_114(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_114();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(113, xla);
+ }
+ }
+
+ private boolean jj_2_115(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_115();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(114, xla);
+ }
+ }
+
+ private boolean jj_2_116(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_116();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(115, xla);
+ }
+ }
+
+ private boolean jj_2_117(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_117();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(116, xla);
+ }
+ }
+
+ private boolean jj_2_118(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_118();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(117, xla);
+ }
+ }
+
+ private boolean jj_2_119(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_119();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(118, xla);
+ }
+ }
+
+ private boolean jj_2_120(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_120();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(119, xla);
+ }
+ }
+
+ private boolean jj_2_121(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_121();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(120, xla);
+ }
+ }
+
+ private boolean jj_2_122(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_122();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(121, xla);
+ }
+ }
+
+ private boolean jj_2_123(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_123();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(122, xla);
+ }
+ }
+
+ private boolean jj_2_124(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_124();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(123, xla);
+ }
+ }
+
+ private boolean jj_2_125(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_125();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(124, xla);
+ }
+ }
+
+ private boolean jj_2_126(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_126();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(125, xla);
+ }
+ }
+
+ private boolean jj_2_127(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_127();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(126, xla);
+ }
+ }
+
+ private boolean jj_2_128(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_128();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(127, xla);
+ }
+ }
+
+ private boolean jj_2_129(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_129();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(128, xla);
+ }
+ }
+
+ private boolean jj_2_130(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_130();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(129, xla);
+ }
+ }
+
+ private boolean jj_2_131(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_131();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(130, xla);
+ }
+ }
+
+ private boolean jj_2_132(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_132();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(131, xla);
+ }
+ }
+
+ private boolean jj_2_133(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_133();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(132, xla);
+ }
+ }
+
+ private boolean jj_2_134(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_134();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(133, xla);
+ }
+ }
+
+ private boolean jj_2_135(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_135();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(134, xla);
+ }
+ }
+
+ private boolean jj_2_136(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_136();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(135, xla);
+ }
+ }
+
+ private boolean jj_2_137(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_137();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(136, xla);
+ }
+ }
+
+ private boolean jj_2_138(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_138();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(137, xla);
+ }
+ }
+
+ private boolean jj_2_139(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_139();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(138, xla);
+ }
+ }
+
+ private boolean jj_2_140(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_140();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(139, xla);
+ }
+ }
+
+ private boolean jj_2_141(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_141();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(140, xla);
+ }
+ }
+
+ private boolean jj_2_142(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_142();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(141, xla);
+ }
+ }
+
+ private boolean jj_2_143(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_143();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(142, xla);
+ }
+ }
+
+ private boolean jj_2_144(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_144();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(143, xla);
+ }
+ }
+
+ private boolean jj_2_145(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_145();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(144, xla);
+ }
+ }
+
+ private boolean jj_2_146(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_146();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(145, xla);
+ }
+ }
+
+ private boolean jj_2_147(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_147();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(146, xla);
+ }
+ }
+
+ private boolean jj_2_148(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_148();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(147, xla);
+ }
+ }
+
+ private boolean jj_2_149(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_149();
+ } catch (LookaheadSuccess ls) {
+ return true;
+ } finally {
+ jj_save(148, xla);
+ }
+ }
+
+ private boolean jj_3R_105() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_87()) {
+ jj_scanpos = xsp;
+ if (jj_3_88())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_36() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_106() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PREFERENCE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_35() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_86() {
+ if (jj_3R_106())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_85() {
+ if (jj_3R_105())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_138() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(OBJECTS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_20() {
+ if (jj_3R_46())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_19() {
+ if (jj_3R_45())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_18() {
+ if (jj_3R_44())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_17() {
+ if (jj_3R_43())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_102() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_85()) {
+ jj_scanpos = xsp;
+ if (jj_3_86())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_16() {
+ if (jj_3R_42())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_15() {
+ if (jj_3R_41())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_14() {
+ if (jj_3R_40())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_13() {
+ if (jj_3R_39())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_12() {
+ if (jj_3R_38())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_11() {
+ if (jj_3R_37())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_10() {
+ if (jj_3R_36())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_9() {
+ if (jj_3R_35())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_145() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_9()) {
+ jj_scanpos = xsp;
+ if (jj_3_10()) {
+ jj_scanpos = xsp;
+ if (jj_3_11()) {
+ jj_scanpos = xsp;
+ if (jj_3_12()) {
+ jj_scanpos = xsp;
+ if (jj_3_13()) {
+ jj_scanpos = xsp;
+ if (jj_3_14()) {
+ jj_scanpos = xsp;
+ if (jj_3_15()) {
+ jj_scanpos = xsp;
+ if (jj_3_16()) {
+ jj_scanpos = xsp;
+ if (jj_3_17()) {
+ jj_scanpos = xsp;
+ if (jj_3_18()) {
+ jj_scanpos = xsp;
+ if (jj_3_19()) {
+ jj_scanpos = xsp;
+ if (jj_3_20())
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_103() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_70() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ACTION))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_166() {
+ if (jj_3R_167())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_47() {
+ if (jj_3R_72())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_46() {
+ if (jj_3R_71())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_45() {
+ if (jj_3R_70())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_104() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_129() {
+ if (jj_3R_139())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_128() {
+ if (jj_3R_34())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_84() {
+ if (jj_3R_104())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_83() {
+ if (jj_3R_103())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_127() {
+ if (jj_3R_138())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_82() {
+ if (jj_3R_102())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_126() {
+ if (jj_3R_29())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_28() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DEFINE))
+ return true;
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PROBLEM))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_160() {
+ if (jj_scan_token(SYMBOL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_62() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_3R_160())
+ return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_166()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(RPAREN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_81() {
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_80() {
+ if (jj_3R_80())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_72() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DERIVED))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_65() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ if (jj_3R_164())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_132() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ if (jj_3R_164())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_133() {
+ if (jj_scan_token(VAR_DURATION))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_33() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FUNCTIONS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_69() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DIV))
+ return true;
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_137() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DIV))
+ return true;
+ if (jj_3R_62())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_63() {
+ if (jj_scan_token(104))
+ return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(100)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(99)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(98))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_100() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(LEQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_68() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(MUL))
+ return true;
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_158() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(100)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(87))
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_136() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(MUL))
+ return true;
+ if (jj_3R_62())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_99() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(GEQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_67() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_135() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ if (jj_3R_62())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_98() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(EQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_66() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ADD))
+ return true;
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_32() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PREDICATES))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_79() {
+ if (jj_3R_100())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_78() {
+ if (jj_3R_99())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_77() {
+ if (jj_3R_98())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_44() {
+ if (jj_3R_69())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_134() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ADD))
+ return true;
+ if (jj_3R_62())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_43() {
+ if (jj_3R_68())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_42() {
+ if (jj_3R_67())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_41() {
+ if (jj_3R_66())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_94() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_77()) {
+ jj_scanpos = xsp;
+ if (jj_3_78()) {
+ jj_scanpos = xsp;
+ if (jj_3_79())
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_170() {
+ if (jj_scan_token(SYMBOL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_125() {
+ if (jj_3R_137())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_124() {
+ if (jj_3R_136())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_123() {
+ if (jj_3R_135())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_122() {
+ if (jj_3R_134())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_64() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_41()) {
+ jj_scanpos = xsp;
+ if (jj_3_42()) {
+ jj_scanpos = xsp;
+ if (jj_3_43()) {
+ jj_scanpos = xsp;
+ if (jj_3_44())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_40() {
+ if (jj_3R_65())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_131() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_122()) {
+ jj_scanpos = xsp;
+ if (jj_3_123()) {
+ jj_scanpos = xsp;
+ if (jj_3_124()) {
+ jj_scanpos = xsp;
+ if (jj_3_125())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_39() {
+ if (jj_3R_64())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_97() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(END))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_31() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(CONSTANTS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_121() {
+ if (jj_3R_133())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_61() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_39()) {
+ jj_scanpos = xsp;
+ if (jj_3_40())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_120() {
+ if (jj_3R_132())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_119() {
+ if (jj_3R_131())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_118() {
+ if (jj_3R_101())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_96() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(START))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_164() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_118()) {
+ jj_scanpos = xsp;
+ if (jj_3_119()) {
+ jj_scanpos = xsp;
+ if (jj_3_120()) {
+ jj_scanpos = xsp;
+ if (jj_3_121())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_76() {
+ if (jj_3R_97())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_75() {
+ if (jj_3R_96())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_117() {
+ if (jj_3R_120())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_80() {
+ if (jj_scan_token(NUMBER))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_116() {
+ if (jj_3R_119())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_115() {
+ if (jj_3R_118())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_114() {
+ if (jj_3R_117())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_113() {
+ if (jj_3R_116())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_95() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_75()) {
+ jj_scanpos = xsp;
+ if (jj_3_76())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_38() {
+ if (jj_3R_63())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_37() {
+ if (jj_3R_62())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_36() {
+ if (jj_3R_61())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_162() {
+ if (jj_3R_80())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_74() {
+ if (jj_3R_95())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_73() {
+ if (jj_3R_94())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_101() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_162()) {
+ jj_scanpos = xsp;
+ if (jj_3_36()) {
+ jj_scanpos = xsp;
+ if (jj_3_37()) {
+ jj_scanpos = xsp;
+ if (jj_3_38())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_93() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_73()) {
+ jj_scanpos = xsp;
+ if (jj_3_74())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_130() {
+ if (jj_scan_token(CONTINOUS_VARIABLE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_60() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(EQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_112() {
+ if (jj_3R_130())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_111() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(MUL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_110() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(MUL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_92() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_72() {
+ if (jj_3R_93())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_30() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(TYPES))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_71() {
+ if (jj_3R_92())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_70() {
+ if (jj_3R_73())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_57() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(LESS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_129() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DECREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_59() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(LEQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_128() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(INCREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_58() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(GEQUAL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_109() {
+ if (jj_3R_129())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_108() {
+ if (jj_3R_128())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_123() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_108()) {
+ jj_scanpos = xsp;
+ if (jj_3_109())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_29() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(REQUIREMENTS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_56() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(GREATER))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_35() {
+ if (jj_3R_60())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_34() {
+ if (jj_3R_59())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_33() {
+ if (jj_3R_58())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_32() {
+ if (jj_3R_57())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_31() {
+ if (jj_3R_56())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_71() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DURATIVE_ACTION))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_127() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(END))
+ return true;
+ if (jj_3R_86())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_8() {
+ if (jj_3R_34())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_7() {
+ if (jj_3R_33())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_159() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_31()) {
+ jj_scanpos = xsp;
+ if (jj_3_32()) {
+ jj_scanpos = xsp;
+ if (jj_3_33()) {
+ jj_scanpos = xsp;
+ if (jj_3_34()) {
+ jj_scanpos = xsp;
+ if (jj_3_35())
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_6() {
+ if (jj_3R_32())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_148() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_91() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DECREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_5() {
+ if (jj_3R_31())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_126() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(START))
+ return true;
+ if (jj_3R_86())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_4() {
+ if (jj_3R_30())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_54() {
+ if (jj_3R_159())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_107() {
+ if (jj_3R_127())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_3() {
+ if (jj_3R_29())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_106() {
+ if (jj_3R_126())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_157() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ADD))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_90() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(INCREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_121() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_106()) {
+ jj_scanpos = xsp;
+ if (jj_3_107())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_55() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(NOT))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_27() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DEFINE))
+ return true;
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DOMAIN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_156() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(MUL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_30() {
+ if (jj_3R_55())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_29() {
+ if (jj_3R_47())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_89() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SCALE_DOWN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_2() {
+ if (jj_3R_28())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_1() {
+ if (jj_3R_27())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_125() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(END))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_149() {
+ if (jj_3R_157())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_148() {
+ if (jj_3R_156())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_86() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_29()) {
+ jj_scanpos = xsp;
+ if (jj_3_30())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_150() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_148()) {
+ jj_scanpos = xsp;
+ if (jj_3_149())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_88() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SCALE_UP))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_169() {
+ if (jj_3R_63())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_168() {
+ if (jj_3R_170())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_124() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(START))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_167() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_168()) {
+ jj_scanpos = xsp;
+ if (jj_3R_169())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_105() {
+ if (jj_3R_125())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_104() {
+ if (jj_3R_124())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_155() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SUB))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_87() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ASSIGN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_122() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_104()) {
+ jj_scanpos = xsp;
+ if (jj_3_105())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_69() {
+ if (jj_3R_91())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_68() {
+ if (jj_3R_90())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_67() {
+ if (jj_3R_89())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_66() {
+ if (jj_3R_88())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_65() {
+ if (jj_3R_87())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_103() {
+ if (jj_3R_123())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_102() {
+ if (jj_3R_122())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_154() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ADD))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_101() {
+ if (jj_3R_121())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_47() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_3R_158())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_85() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_65()) {
+ jj_scanpos = xsp;
+ if (jj_3_66()) {
+ jj_scanpos = xsp;
+ if (jj_3_67()) {
+ jj_scanpos = xsp;
+ if (jj_3_68()) {
+ jj_scanpos = xsp;
+ if (jj_3_69())
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_147() {
+ if (jj_3R_155())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_146() {
+ if (jj_3R_154())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_111() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_101()) {
+ jj_scanpos = xsp;
+ if (jj_3_102()) {
+ jj_scanpos = xsp;
+ if (jj_3_103())
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_64() {
+ if (jj_3R_86())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_63() {
+ if (jj_3R_85())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_149() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_146()) {
+ jj_scanpos = xsp;
+ if (jj_3_147())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_53() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_83() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_63()) {
+ jj_scanpos = xsp;
+ if (jj_3_64())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_112() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_152() {
+ if (jj_scan_token(TOTAL_TIME))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_52() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(EXISTS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_113() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_62() {
+ if (jj_3R_79())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_61() {
+ if (jj_3R_78())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_151() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_3R_160())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_51() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(IMPLY))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_114() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(WHEN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_153() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(IS_VIOLATED))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_50() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(NOT))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_82() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(WHEN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_145() {
+ if (jj_3R_153())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_120() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(DECREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_144() {
+ if (jj_3R_152())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_143() {
+ if (jj_3R_151())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_142() {
+ if (jj_3R_80())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_141() {
+ if (jj_3R_150())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_140() {
+ if (jj_3R_149())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_139() {
+ if (jj_3R_148())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_49() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(OR))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_81() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_119() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(INCREASE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_60() {
+ if (jj_3R_84())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_48() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_59() {
+ if (jj_3R_83())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_58() {
+ if (jj_3R_82())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_57() {
+ if (jj_3R_81())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_147() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(METRIC))
+ return true;
+ if (jj_scan_token(MINIMIZE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_28() {
+ if (jj_3R_54())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_118() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SCALE_DOWN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_27() {
+ if (jj_3R_53())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_26() {
+ if (jj_3R_52())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_25() {
+ if (jj_3R_51())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_79() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_57()) {
+ jj_scanpos = xsp;
+ if (jj_3_58()) {
+ jj_scanpos = xsp;
+ if (jj_3_59()) {
+ jj_scanpos = xsp;
+ if (jj_3_60())
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3_24() {
+ if (jj_3R_50())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_23() {
+ if (jj_3R_49())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_22() {
+ if (jj_3R_48())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_21() {
+ if (jj_3R_47())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_146() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(METRIC))
+ return true;
+ if (jj_scan_token(MAXIMIZE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_165() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_21()) {
+ jj_scanpos = xsp;
+ if (jj_3_22()) {
+ jj_scanpos = xsp;
+ if (jj_3_23()) {
+ jj_scanpos = xsp;
+ if (jj_3_24()) {
+ jj_scanpos = xsp;
+ if (jj_3_25()) {
+ jj_scanpos = xsp;
+ if (jj_3_26()) {
+ jj_scanpos = xsp;
+ if (jj_3_27()) {
+ jj_scanpos = xsp;
+ if (jj_3_28())
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_117() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SCALE_UP))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_56() {
+ if (jj_3R_80())
+ return true;
+ if (jj_3R_78())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_55() {
+ if (jj_3R_80())
+ return true;
+ if (jj_3R_79())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_138() {
+ if (jj_3R_147())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_137() {
+ if (jj_3R_146())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_139() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_137()) {
+ jj_scanpos = xsp;
+ if (jj_3_138())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_46() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(HOLD_AFTER))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_116() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ASSIGN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_84() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PROB))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_100() {
+ if (jj_3R_120())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_99() {
+ if (jj_3R_119())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_98() {
+ if (jj_3R_118())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_97() {
+ if (jj_3R_117())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_96() {
+ if (jj_3R_116())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_143() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_45() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(HOLD_DURING))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_115() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_96()) {
+ jj_scanpos = xsp;
+ if (jj_3_97()) {
+ jj_scanpos = xsp;
+ if (jj_3_98()) {
+ jj_scanpos = xsp;
+ if (jj_3_99()) {
+ jj_scanpos = xsp;
+ if (jj_3_100())
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean jj_3R_78() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_95() {
+ if (jj_3R_115())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_94() {
+ if (jj_3R_114())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_93() {
+ if (jj_3R_113())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_144() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PREFERENCE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_92() {
+ if (jj_3R_112())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_54() {
+ if (jj_3R_79())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_91() {
+ if (jj_3R_111())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_44() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ALWAYS_WITHIN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_53() {
+ if (jj_3R_78())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_142() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_43() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SOMETIME_BEFORE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_136() {
+ if (jj_3R_145())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_135() {
+ if (jj_3R_144())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_134() {
+ if (jj_3R_143())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_133() {
+ if (jj_3R_142())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_42() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SOMETIME_AFTER))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_110() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_77() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(PREFERENCE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_41() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT_MOST_ONCE))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_34() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(CONSTRAINTS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_161() {
+ if (jj_3R_165())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_52() {
+ if (jj_3R_77())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_109() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_scan_token(START))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_74() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_52()) {
+ jj_scanpos = xsp;
+ if (jj_3R_161())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3_90() {
+ if (jj_3R_110())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_40() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(WITHIN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_89() {
+ if (jj_3R_109())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_107() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_89()) {
+ jj_scanpos = xsp;
+ if (jj_3_90())
+ return true;
+ }
+ return false;
+ }
+
+ private boolean jj_3R_76() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(FORALL))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_39() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(SOMETIME))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_141() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ if (jj_3R_80())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_163() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(OVER))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_75() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AND))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_38() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(ALWAYS))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_140() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(EQUALITY))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_132() {
+ if (jj_3R_141())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_108() {
+ if (jj_3R_163())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_131() {
+ if (jj_3R_140())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_130() {
+ if (jj_3R_86())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_73() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(RPAREN))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3R_37() {
+ if (jj_scan_token(LPAREN))
+ return true;
+ if (jj_scan_token(AT))
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_88() {
+ if (jj_3R_108())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_87() {
+ if (jj_3R_107())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_51() {
+ if (jj_3R_76())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_50() {
+ if (jj_3R_75())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_49() {
+ if (jj_3R_74())
+ return true;
+ return false;
+ }
+
+ private boolean jj_3_48() {
+ if (jj_3R_73())
+ return true;
+ return false;
+ }
+
+ /** Generated Token Manager. */
+ public LexerTokenManager token_source;
+ SimpleCharStream jj_input_stream;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[41];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static private int[] jj_la1_2;
+ static private int[] jj_la1_3;
+ static {
+ jj_la1_init_0();
+ jj_la1_init_1();
+ jj_la1_init_2();
+ jj_la1_init_3();
+ }
+
+ private static void jj_la1_init_0() {
+ jj_la1_0 = new int[] { 0x2000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x2000, 0x0, 0x2000, 0x0, 0x0, 0x2000, 0x0, 0x2000,
+ 0x2000, 0x2000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000, 0x2000, 0x0,
+ 0x2000, 0x0, 0x2000, 0x2000, 0x2000, 0x0, 0x2000, 0x2000,
+ 0x2000, 0x0, 0x0, 0x2000, 0x2000, };
+ }
+
+ private static void jj_la1_init_1() {
+ jj_la1_1 = new int[] { 0x0, 0x3ffff00, 0x3ffff00, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
+ }
+
+ private static void jj_la1_init_2() {
+ jj_la1_2 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x4, 0x0, 0x4,
+ 0x0, 0x0, 0x0, 0x0, 0x800000, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x10000000, };
+ }
+
+ private static void jj_la1_init_3() {
+ jj_la1_3 = new int[] { 0x0, 0x0, 0x0, 0x1c, 0x0, 0x10, 0x0, 0x100, 0x0,
+ 0x1c, 0x1c, 0x1c, 0x0, 0x10, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x10, 0x110, 0x110, 0x20, 0x110, 0x0, 0x0, 0x10, 0x0, 0x20,
+ 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x10, 0x20, 0x20, };
+ }
+
+ final private JJCalls[] jj_2_rtns = new JJCalls[149];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
+
+ /** Constructor with InputStream. */
+ public Lexer(java.io.InputStream stream) {
+ this(stream, null);
+ }
+
+ /** Constructor with InputStream and supplied encoding */
+ public Lexer(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source = new LexerTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream.ReInit(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Constructor. */
+ public Lexer(java.io.Reader stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new LexerTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Constructor with generated Token Manager. */
+ public Lexer(LexerTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ /** Reinitialise. */
+ public void ReInit(LexerTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 41; i++)
+ jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++)
+ jj_2_rtns[i] = new JJCalls();
+ }
+
+ private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null)
+ token = token.next;
+ else
+ token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen)
+ c.first = null;
+ c = c.next;
+ }
+ }
+ }
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ static private final class LookaheadSuccess extends java.lang.Error {
+ }
+
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+
+ private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source
+ .getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0;
+ Token tok = token;
+ while (tok != null && tok != jj_scanpos) {
+ i++;
+ tok = tok.next;
+ }
+ if (tok != null)
+ jj_add_error_token(kind, i);
+ }
+ if (jj_scanpos.kind != kind)
+ return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos)
+ throw jj_ls;
+ return false;
+ }
+
+ /** Get the next Token. */
+ final public Token getNextToken() {
+ if (token.next != null)
+ token = token.next;
+ else
+ token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ /** Get the specific Token. */
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null)
+ t = t.next;
+ else
+ t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ private int jj_ntk() {
+ if ((jj_nt = token.next) == null)
+ return (jj_ntk = (token.next = token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.List jj_expentries = new java.util.ArrayList();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100)
+ return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ jj_entries_loop: for (java.util.Iterator it = jj_expentries
+ .iterator(); it.hasNext();) {
+ int[] oldentry = (int[]) (it.next());
+ if (oldentry.length == jj_expentry.length) {
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ continue jj_entries_loop;
+ }
+ }
+ jj_expentries.add(jj_expentry);
+ break jj_entries_loop;
+ }
+ }
+ if (pos != 0)
+ jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
+ /** Generate ParseException. */
+ public ParseException generateParseException() {
+ jj_expentries.clear();
+ boolean[] la1tokens = new boolean[105];
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 41; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1 << j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1 << j)) != 0) {
+ la1tokens[32 + j] = true;
+ }
+ if ((jj_la1_2[i] & (1 << j)) != 0) {
+ la1tokens[64 + j] = true;
+ }
+ if ((jj_la1_3[i] & (1 << j)) != 0) {
+ la1tokens[96 + j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 105; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.add(jj_expentry);
+ }
+ }
+ jj_endpos = 0;
+ jj_rescan_token();
+ jj_add_error_token(0, 0);
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = (int[]) jj_expentries.get(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ /** Enable tracing. */
+ final public void enable_tracing() {
+ }
+
+ /** Disable tracing. */
+ final public void disable_tracing() {
+ }
+
+ private void jj_rescan_token() {
+ jj_rescan = true;
+ for (int i = 0; i < 149; i++) {
+ try {
+ JJCalls p = jj_2_rtns[i];
+ do {
+ if (p.gen > jj_gen) {
+ jj_la = p.arg;
+ jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0:
+ jj_3_1();
+ break;
+ case 1:
+ jj_3_2();
+ break;
+ case 2:
+ jj_3_3();
+ break;
+ case 3:
+ jj_3_4();
+ break;
+ case 4:
+ jj_3_5();
+ break;
+ case 5:
+ jj_3_6();
+ break;
+ case 6:
+ jj_3_7();
+ break;
+ case 7:
+ jj_3_8();
+ break;
+ case 8:
+ jj_3_9();
+ break;
+ case 9:
+ jj_3_10();
+ break;
+ case 10:
+ jj_3_11();
+ break;
+ case 11:
+ jj_3_12();
+ break;
+ case 12:
+ jj_3_13();
+ break;
+ case 13:
+ jj_3_14();
+ break;
+ case 14:
+ jj_3_15();
+ break;
+ case 15:
+ jj_3_16();
+ break;
+ case 16:
+ jj_3_17();
+ break;
+ case 17:
+ jj_3_18();
+ break;
+ case 18:
+ jj_3_19();
+ break;
+ case 19:
+ jj_3_20();
+ break;
+ case 20:
+ jj_3_21();
+ break;
+ case 21:
+ jj_3_22();
+ break;
+ case 22:
+ jj_3_23();
+ break;
+ case 23:
+ jj_3_24();
+ break;
+ case 24:
+ jj_3_25();
+ break;
+ case 25:
+ jj_3_26();
+ break;
+ case 26:
+ jj_3_27();
+ break;
+ case 27:
+ jj_3_28();
+ break;
+ case 28:
+ jj_3_29();
+ break;
+ case 29:
+ jj_3_30();
+ break;
+ case 30:
+ jj_3_31();
+ break;
+ case 31:
+ jj_3_32();
+ break;
+ case 32:
+ jj_3_33();
+ break;
+ case 33:
+ jj_3_34();
+ break;
+ case 34:
+ jj_3_35();
+ break;
+ case 35:
+ jj_3_36();
+ break;
+ case 36:
+ jj_3_37();
+ break;
+ case 37:
+ jj_3_38();
+ break;
+ case 38:
+ jj_3_39();
+ break;
+ case 39:
+ jj_3_40();
+ break;
+ case 40:
+ jj_3_41();
+ break;
+ case 41:
+ jj_3_42();
+ break;
+ case 42:
+ jj_3_43();
+ break;
+ case 43:
+ jj_3_44();
+ break;
+ case 44:
+ jj_3_45();
+ break;
+ case 45:
+ jj_3_46();
+ break;
+ case 46:
+ jj_3_47();
+ break;
+ case 47:
+ jj_3_48();
+ break;
+ case 48:
+ jj_3_49();
+ break;
+ case 49:
+ jj_3_50();
+ break;
+ case 50:
+ jj_3_51();
+ break;
+ case 51:
+ jj_3_52();
+ break;
+ case 52:
+ jj_3_53();
+ break;
+ case 53:
+ jj_3_54();
+ break;
+ case 54:
+ jj_3_55();
+ break;
+ case 55:
+ jj_3_56();
+ break;
+ case 56:
+ jj_3_57();
+ break;
+ case 57:
+ jj_3_58();
+ break;
+ case 58:
+ jj_3_59();
+ break;
+ case 59:
+ jj_3_60();
+ break;
+ case 60:
+ jj_3_61();
+ break;
+ case 61:
+ jj_3_62();
+ break;
+ case 62:
+ jj_3_63();
+ break;
+ case 63:
+ jj_3_64();
+ break;
+ case 64:
+ jj_3_65();
+ break;
+ case 65:
+ jj_3_66();
+ break;
+ case 66:
+ jj_3_67();
+ break;
+ case 67:
+ jj_3_68();
+ break;
+ case 68:
+ jj_3_69();
+ break;
+ case 69:
+ jj_3_70();
+ break;
+ case 70:
+ jj_3_71();
+ break;
+ case 71:
+ jj_3_72();
+ break;
+ case 72:
+ jj_3_73();
+ break;
+ case 73:
+ jj_3_74();
+ break;
+ case 74:
+ jj_3_75();
+ break;
+ case 75:
+ jj_3_76();
+ break;
+ case 76:
+ jj_3_77();
+ break;
+ case 77:
+ jj_3_78();
+ break;
+ case 78:
+ jj_3_79();
+ break;
+ case 79:
+ jj_3_80();
+ break;
+ case 80:
+ jj_3_81();
+ break;
+ case 81:
+ jj_3_82();
+ break;
+ case 82:
+ jj_3_83();
+ break;
+ case 83:
+ jj_3_84();
+ break;
+ case 84:
+ jj_3_85();
+ break;
+ case 85:
+ jj_3_86();
+ break;
+ case 86:
+ jj_3_87();
+ break;
+ case 87:
+ jj_3_88();
+ break;
+ case 88:
+ jj_3_89();
+ break;
+ case 89:
+ jj_3_90();
+ break;
+ case 90:
+ jj_3_91();
+ break;
+ case 91:
+ jj_3_92();
+ break;
+ case 92:
+ jj_3_93();
+ break;
+ case 93:
+ jj_3_94();
+ break;
+ case 94:
+ jj_3_95();
+ break;
+ case 95:
+ jj_3_96();
+ break;
+ case 96:
+ jj_3_97();
+ break;
+ case 97:
+ jj_3_98();
+ break;
+ case 98:
+ jj_3_99();
+ break;
+ case 99:
+ jj_3_100();
+ break;
+ case 100:
+ jj_3_101();
+ break;
+ case 101:
+ jj_3_102();
+ break;
+ case 102:
+ jj_3_103();
+ break;
+ case 103:
+ jj_3_104();
+ break;
+ case 104:
+ jj_3_105();
+ break;
+ case 105:
+ jj_3_106();
+ break;
+ case 106:
+ jj_3_107();
+ break;
+ case 107:
+ jj_3_108();
+ break;
+ case 108:
+ jj_3_109();
+ break;
+ case 109:
+ jj_3_110();
+ break;
+ case 110:
+ jj_3_111();
+ break;
+ case 111:
+ jj_3_112();
+ break;
+ case 112:
+ jj_3_113();
+ break;
+ case 113:
+ jj_3_114();
+ break;
+ case 114:
+ jj_3_115();
+ break;
+ case 115:
+ jj_3_116();
+ break;
+ case 116:
+ jj_3_117();
+ break;
+ case 117:
+ jj_3_118();
+ break;
+ case 118:
+ jj_3_119();
+ break;
+ case 119:
+ jj_3_120();
+ break;
+ case 120:
+ jj_3_121();
+ break;
+ case 121:
+ jj_3_122();
+ break;
+ case 122:
+ jj_3_123();
+ break;
+ case 123:
+ jj_3_124();
+ break;
+ case 124:
+ jj_3_125();
+ break;
+ case 125:
+ jj_3_126();
+ break;
+ case 126:
+ jj_3_127();
+ break;
+ case 127:
+ jj_3_128();
+ break;
+ case 128:
+ jj_3_129();
+ break;
+ case 129:
+ jj_3_130();
+ break;
+ case 130:
+ jj_3_131();
+ break;
+ case 131:
+ jj_3_132();
+ break;
+ case 132:
+ jj_3_133();
+ break;
+ case 133:
+ jj_3_134();
+ break;
+ case 134:
+ jj_3_135();
+ break;
+ case 135:
+ jj_3_136();
+ break;
+ case 136:
+ jj_3_137();
+ break;
+ case 137:
+ jj_3_138();
+ break;
+ case 138:
+ jj_3_139();
+ break;
+ case 139:
+ jj_3_140();
+ break;
+ case 140:
+ jj_3_141();
+ break;
+ case 141:
+ jj_3_142();
+ break;
+ case 142:
+ jj_3_143();
+ break;
+ case 143:
+ jj_3_144();
+ break;
+ case 144:
+ jj_3_145();
+ break;
+ case 145:
+ jj_3_146();
+ break;
+ case 146:
+ jj_3_147();
+ break;
+ case 147:
+ jj_3_148();
+ break;
+ case 148:
+ jj_3_149();
+ break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ } catch (LookaheadSuccess ls) {
+ }
+ }
+ jj_rescan = false;
+ }
+
+ private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) {
+ p = p.next = new JJCalls();
+ break;
+ }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la;
+ p.first = token;
+ p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+} \ No newline at end of file
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj
new file mode 100644
index 00000000000..47c6b4ca7b1
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jj
@@ -0,0 +1,8581 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./Lexer.jj */
+/*@egen*//*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+options {
+
+
+ STATIC=false;
+
+
+ IGNORE_CASE=true;
+}
+
+PARSER_BEGIN(Lexer)
+
+package pddl4j.lexer;
+
+import java.io.InputStream;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import pddl4j.ErrorManager;
+import pddl4j.ErrorManager.Message;
+
+public class Lexer/*@bgen(jjtree)*/implements LexerTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
+ protected JJTLexerState jjtree = new JJTLexerState();
+
+/*@egen*/
+
+ private ErrorManager mgr;
+ private File file;
+
+ private static final int[] BLOCKS = {REQUIREMENTS,
+ TYPES,
+ CONSTANTS,
+ PREDICATES,
+ FUNCTIONS,
+ ACTION,
+ DURATIVE_ACTION,
+ DERIVED,
+ OBJECTS,
+ INIT,
+ GOAL,
+ METRIC,
+ EOF};
+
+ private boolean isBlock(int token) {
+ int i = 0;
+ while (i < BLOCKS.length && (BLOCKS[i] != token)) i++;
+ return i == BLOCKS.length;
+ }
+
+ private void error(Throwable e, int line, int column) throws ParseException {
+ String message = new String();
+ if (e.getClass().equals(TokenMgrError.class)) {
+ String[] tmp = e.getMessage().split(" ");
+ int l = -1;
+ int c = -1;
+ int i = 0;
+ for (i = 0 ; i < tmp.length; i++) {
+ if (tmp[i].equals("line") && i+1 < tmp.length) {
+ l = Integer.parseInt(tmp[i+1].substring(0, tmp[i+1].length()-1));
+ }
+ if (tmp[i].equals("column") && i+1 < tmp.length) {
+ c = Integer.parseInt(tmp[i+1].substring(0, tmp[i+1].length()-1));
+ }
+ }
+ message = e.getMessage().split(". ")[1];
+ this.mgr.logLexicalError(message, this.file, l, c);
+ } else if (e.getClass().equals(ParseException.class)) {
+ ParseException pe = (ParseException) e;
+ message = generateErrorMesssage(pe);
+ this.mgr.logLexicalError(message, this.file, pe.currentToken.beginLine, pe.currentToken.beginColumn);
+ } else if (e instanceof NullPointerException) {
+ // Do nothing
+ } else {
+ e.printStackTrace();
+ throw new ParseException(e.getMessage());
+ }
+ this.skipToNextBlock();
+ }
+
+ private void skipToNextBlock() {
+ Token t;
+ Token t2;
+ do {
+ t = getNextToken();
+ t2 = getToken(2);
+
+ } while (t2 != null && isBlock(t2.kind));
+ }
+
+ public void setErrorManager(ErrorManager mgr) {
+ this.mgr = mgr;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ /**
+ * Creates the error message from a specific parse exception.
+ *
+ * @param pe the parse exception.
+ * @return the error message.
+ */
+ private String generateErrorMesssage(ParseException pe) {
+ StringBuffer expected = new StringBuffer();
+ boolean expectedSeq = false;
+ int maxSize = 0;
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ if (maxSize < pe.expectedTokenSequences[i].length) {
+ maxSize = pe.expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ expected.append(pe.tokenImage[pe.expectedTokenSequences[i][j]]).append(" ");
+ expectedSeq = true;
+ }
+ if (pe.expectedTokenSequences[i][pe.expectedTokenSequences[i].length - 1] != 0) {
+ expected.append("...");
+ }
+ if (i < pe.expectedTokenSequences.length - 1) {
+ expected.append("\n").append(" ");
+ }
+ }
+ String retval = "unexpected token \"" + pe.currentToken.next.image + "\".";
+ if (expectedSeq) {
+ if (pe.expectedTokenSequences.length == 1) {
+ retval += "\nWas expecting:" + "\n" + " ";
+ } else {
+ retval += "\nWas expecting one of:" + "\n" + " ";
+ }
+ retval += expected.toString();
+ }
+ return retval;
+ }
+}
+PARSER_END(Lexer)
+
+
+SKIP :
+{
+ " "
+| "\t"
+| "\n"
+| "\r"
+}
+MORE :
+{
+ "//" : IN_SINGLE_LINE_COMMENT
+| ";" : IN_SINGLE_LINE_COMMENT
+| <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
+| "/*" : IN_MULTI_LINE_COMMENT
+}
+<IN_SINGLE_LINE_COMMENT>
+ SPECIAL_TOKEN : {
+ <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : DEFAULT
+ }
+<IN_FORMAL_COMMENT>
+ SPECIAL_TOKEN : {
+ <FORMAL_COMMENT: "*/" > : DEFAULT
+ }
+<IN_MULTI_LINE_COMMENT>
+ SPECIAL_TOKEN : {
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+ }
+<IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
+ MORE : {
+ < ~[] >
+}
+
+TOKEN :
+{
+ < LPAREN: "(">
+| < RPAREN: ")">
+}
+
+TOKEN : {
+ < DEFINE : "define" >
+| < DOMAIN : "domain" >
+| < REQUIREMENTS : ":requirements" >
+| < TYPES : ":types" >
+| < EITHER : "either" >
+| < CONSTANTS : ":constants" >
+| < PREDICATES : ":predicates" >
+| < FUNCTIONS : ":functions" >
+| < ACTION : ":action" >
+| < PARAMETERS : ":parameters" >
+| < PRECONDITION : ":precondition" >
+| < EFFECT : ":effect" >
+| < PREFERENCE : "preference" >
+| < WHEN : "when" >
+| < PROB : "probabilistic">
+| < DURATIVE_ACTION : ":durative-action" >
+| < DURATION : ":duration" >
+| < CONDITION : ":condition" >
+| < DERIVED : ":derived" >
+| < PROBLEM : "problem" >
+| < P_DOMAIN : ":domain" >
+| < OBJECTS : ":objects" >
+| < INIT : ":init" >
+| < GOAL: ":goal" >
+| < METRIC : ":metric" >
+}
+
+TOKEN : {
+ < STRIPS : ":strips" >
+| < TYPING : ":typing" >
+| < NEGATIVE_PRECONDITIONS : ":negative-preconditions" >
+| < DISJUNCTIVE_PRECONDITIONS : ":disjunctive-preconditions" >
+| < EQUALITY : ":equality" >
+| < EXISTENTIAL_PRECONDITIONS : ":existential-preconditions" >
+| < UNIVERSAL_PRECONDITIONS : ":universal-preconditions" >
+| < QUANTIFIED_PRECONDITIONS : ":quantified-preconditions" >
+| < CONDITIONAL_EFFECTS : ":conditional-effects" >
+| < FLUENTS : ":fluents" >
+| < ADL : ":adl" >
+| < DURATIVE_ACTIONS : ":durative-actions" >
+| < DERIVED_PREDICATES : ":derived-predicates" >
+| < TIMED_INITIAL_LITERALS : ":timed-initial-literals" >
+| < PREFERENCES : ":preferences" >
+| < CONSTRAINTS : ":constraints" >
+| < CONTINUS_EFFECTS : ":continus_effects" >
+| < DURATION_INEQUALITIES : ":duration-inequalities" >
+}
+
+TOKEN :
+{
+ < GREATER : ">" >
+| < LESS : "<" >
+| < GEQUAL : ">=" >
+| < LEQUAL : "<=" >
+| < EQUAL : "=" >
+}
+
+TOKEN :
+{
+ < MUL : "*" >
+| < DIV : "/" >
+| < ADD : "+" >
+| < SUB : "-" >
+}
+
+TOKEN :
+{
+ <ASSIGN : "assign" >
+| <SCALE_UP : "scale-up" >
+| <SCALE_DOWN : "scale-down" >
+| <INCREASE : "increase" >
+| <DECREASE : "decrease" >
+}
+
+TOKEN :
+{
+ < OR : "or" >
+| < AND : "and" >
+| < IMPLY : "imply" >
+| < NOT : "not" >
+| < FORALL : "forall" >
+| < EXISTS : "exists" >
+}
+
+TOKEN :
+{
+ < ALWAYS : "always" >
+| < SOMETIME : "sometime" >
+| < WITHIN : "within" >
+| < AT_MOST_ONCE : "at-most-once" >
+| < SOMETIME_AFTER : "sometime-after" >
+| < SOMETIME_BEFORE : "sometime-before" >
+| < ALWAYS_WITHIN : "always-within" >
+| < HOLD_DURING : "hold-during" >
+| < HOLD_AFTER : "hold-after" >
+| < AT: "at" >
+| < START : "start">
+| < END : "end">
+| < OVER : "over">
+| < ALL : "all">
+| < TOTAL_TIME : "total_time" >
+| < MAXIMIZE : "maximize" >
+| < MINIMIZE : "minimize" >
+| < IS_VIOLATED : "is-violated" >
+}
+
+TOKEN :
+{
+ < VAR_DURATION : "?duration" >
+| < CONTINOUS_VARIABLE : "#t" >
+}
+
+TOKEN :
+{
+ < NUMBER_TYPE : "number" >
+| < OBJECT_TYPE : "object" >
+}
+
+
+TOKEN :
+{
+ < SYMBOL : ((<LETTER> (<LETTER> | <DIGIT>)*)) >
+| < NUMBER : (<DIGIT>)+ ("." (<DIGIT>)*)? >
+| < #DIGIT : ["0"-"9"] >
+| < #LETTER : ["a"-"z","A"-"Z","_","-","#"] >
+}
+
+SimpleNode parse() :
+{/*@bgen(jjtree) ROOT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTROOT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t= null;
+}
+{/*@bgen(jjtree) ROOT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(4) t=domain()
+ | LOOKAHEAD(4) t=problem()
+ } catch (Throwable e) {
+ this.mgr.logLexicalError("Lexical error file (" +file.getName() + ") : to many errors", file);
+ throw new ParseException(e.getMessage());
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return jjtn000;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+
+}
+
+Token domain() :
+{/*@bgen(jjtree) DOMAIN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDOMAIN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DOMAIN */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DEFINE> <LPAREN> <DOMAIN> domain_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=require_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=type_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=constants_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=predicates_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=functions_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=constraints()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ (t=structure_def())*
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token require_def() :
+{/*@bgen(jjtree) REQUIRE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTREQUIRE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) REQUIRE_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <REQUIREMENTS> (require_key())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token require_key() :
+{/*@bgen(jjtree) REQUIRE_KEY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTREQUIRE_KEY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) REQUIRE_KEY */
+ try {
+/*@egen*/
+ try {
+ t=<STRIPS>
+ | t=<TYPING>
+ | t=<NEGATIVE_PRECONDITIONS>
+ | t=<DISJUNCTIVE_PRECONDITIONS>
+ | t=<EQUALITY>
+ | t=<EXISTENTIAL_PRECONDITIONS>
+ | t=<UNIVERSAL_PRECONDITIONS>
+ | t=<QUANTIFIED_PRECONDITIONS>
+ | t=<CONDITIONAL_EFFECTS>
+ | t=<FLUENTS>
+ | t=<ADL>
+ | t=<DURATIVE_ACTIONS>
+ | t=<DERIVED_PREDICATES>
+ | t=<TIMED_INITIAL_LITERALS>
+ | t=<PREFERENCES>
+ | t=<CONSTRAINTS>
+ | t=<CONTINUS_EFFECTS>
+ | t=<DURATION_INEQUALITIES>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token type_def() :
+{/*@bgen(jjtree) TYPE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TYPE_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <TYPES> typed_list(LexerTreeConstants.JJTPRIMITIVE_TYPE) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token typed_list(int type) :
+{/*@bgen(jjtree) TYPED_LIST */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPED_LIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TYPED_LIST */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2, {type == LexerTreeConstants.JJTPRIMITIVE_TYPE})
+ (t=primitive_type())* (<SUB> type() typed_list(type))?
+ | LOOKAHEAD(2, {type == LexerTreeConstants.JJTCONSTANT})
+ (t=constant())* (<SUB> type() typed_list(type))?
+ | LOOKAHEAD(2, {type == LexerTreeConstants.JJTVARIABLE})
+ (t=variable())* (<SUB> type() typed_list(type))?
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ if (t != null) {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setTypeId(LexerTreeConstants.JJTVARIABLE);
+ }
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token type() :
+{/*@bgen(jjtree) TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TYPE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <EITHER> (primitive_type())+ <RPAREN>
+ | t=primitive_type()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token primitive_type() :
+{/*@bgen(jjtree) PRIMITIVE_TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPRIMITIVE_TYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PRIMITIVE_TYPE */
+try {
+/*@egen*/
+( t=<OBJECT_TYPE>
+| t=<NUMBER_TYPE>
+| t=<SYMBOL>)/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+} finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+}
+/*@egen*/
+}
+
+Token constants_def() :
+{/*@bgen(jjtree) CONSTANT_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CONSTANT_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <CONSTANTS> typed_list(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token constant() :
+{/*@bgen(jjtree) CONSTANT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CONSTANT */
+ try {
+/*@egen*/
+ t=<SYMBOL>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token predicates_def() :
+{/*@bgen(jjtree) PREDICATE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREDICATE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREDICATE_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <PREDICATES> (atomic_formula_skeleton())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token atomic_formula_skeleton() :
+{/*@bgen(jjtree) ATOMIC_FORMULA_SKELETON */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FORMULA_SKELETON);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ATOMIC_FORMULA_SKELETON */
+ try {
+/*@egen*/
+ t=<LPAREN> predicate() typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token predicate() :
+{/*@bgen(jjtree) PREDICATE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREDICATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREDICATE */
+ try {
+/*@egen*/
+ (t=<SYMBOL> | t=<AT>)/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token variable() :
+{/*@bgen(jjtree) VARIABLE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVARIABLE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) VARIABLE */
+ try {
+/*@egen*/
+ "?" (t=<SYMBOL> | t=<OBJECT_TYPE> | t=<NUMBER_TYPE>)/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token functions_def() :
+{/*@bgen(jjtree) FUNCTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FUNCTION_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FUNCTIONS> function_typed_list(LexerTreeConstants.JJTATOMIC_FUNCTION_SKELETON) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token atomic_function_skeleton() :
+{/*@bgen(jjtree) ATOMIC_FUNCTION_SKELETON */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FUNCTION_SKELETON);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ATOMIC_FUNCTION_SKELETON */
+ try {
+/*@egen*/
+ t=<LPAREN> functor() typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token functor() :
+{/*@bgen(jjtree) FUNCTOR */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FUNCTOR */
+ try {
+/*@egen*/
+ t=<SYMBOL>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token function_typed_list(int type) :
+{/*@bgen(jjtree) FUNCTION_TYPED_LIST */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_TYPED_LIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FUNCTION_TYPED_LIST */
+ try {
+/*@egen*/
+ (t=atomic_function_skeleton())* (<SUB> function_type() function_typed_list(type))?/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ if (t != null) {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ }
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token function_type() :
+{/*@bgen(jjtree) FUNCTION_TYPE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFUNCTION_TYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FUNCTION_TYPE */
+ try {
+/*@egen*/
+ t=<NUMBER_TYPE>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token con_gd() :
+{/*@bgen(jjtree) CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CON_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=and_con_gd()
+ | LOOKAHEAD(2) t=forall_con_gd()
+ | LOOKAHEAD(2) t=at_end_con_gd()
+ | LOOKAHEAD(2) t=always_con_gd()
+ | LOOKAHEAD(2) t=sometime_con_gd()
+ | LOOKAHEAD(2) t=within_con_gd()
+ | LOOKAHEAD(2) t=at_most_once_con_gd()
+ | LOOKAHEAD(2) t=sometime_after_con_gd()
+ | LOOKAHEAD(2) t=sometime_before_con_gd()
+ | LOOKAHEAD(2) t=always_within_con_gd()
+ | LOOKAHEAD(2) t=hold_during_con_gd()
+ | LOOKAHEAD(2) t=hold_after_con_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_con_gd() :
+{/*@bgen(jjtree) AND_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (con_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_con_gd() :
+{/*@bgen(jjtree) FORALL_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_end_con_gd() :
+{/*@bgen(jjtree) AT_END_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_END_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <END> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token always_con_gd() :
+{/*@bgen(jjtree) ALWAYS_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTALWAYS_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ALWAYS_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ALWAYS> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token sometime_con_gd() :
+{/*@bgen(jjtree) SOMETIME_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SOMETIME_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SOMETIME> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token within_con_gd() :
+{/*@bgen(jjtree) WITHIN_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWITHIN_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) WITHIN_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <WITHIN> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_most_once_con_gd() :
+{/*@bgen(jjtree) AT_MOST_ONCE_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_MOST_ONCE_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_MOST_ONCE_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT_MOST_ONCE> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token sometime_after_con_gd() :
+{/*@bgen(jjtree) SOMETIME_AFTER_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_AFTER_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SOMETIME_AFTER_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SOMETIME_AFTER> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token sometime_before_con_gd() :
+{/*@bgen(jjtree) SOMETIME_BEFORE_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSOMETIME_BEFORE_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SOMETIME_BEFORE_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SOMETIME_BEFORE> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token always_within_con_gd() :
+{/*@bgen(jjtree) ALWAYS_WITHIN_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTALWAYS_WITHIN_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ALWAYS_WITHIN_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ALWAYS_WITHIN> <NUMBER> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token hold_during_con_gd() :
+{/*@bgen(jjtree) HOLD_DURING_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTHOLD_DURING_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) HOLD_DURING_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <HOLD_DURING> <NUMBER> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token hold_after_con_gd() :
+{/*@bgen(jjtree) HOLD_AFTER_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTHOLD_AFTER_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) HOLD_AFTER_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <HOLD_AFTER> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token gd() :
+{/*@bgen(jjtree) GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=atomic_formula(LexerTreeConstants.JJTTERM)
+// | LOOKAHEAD(2) t=not_atomic_formula(LexerTreeConstants.JJTTERM)
+ | LOOKAHEAD(2) t=and_gd()
+ | LOOKAHEAD(2) t=or_gd()
+ | LOOKAHEAD(2) t=not_gd()
+ | LOOKAHEAD(2) t=imply_gd()
+ | LOOKAHEAD(2) t=exists_gd()
+ | LOOKAHEAD(2) t=forall_gd()
+ | LOOKAHEAD(2) t=f_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_gd() :
+{/*@bgen(jjtree) AND_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token or_gd() :
+{/*@bgen(jjtree) OR_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOR_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) OR_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <OR> (gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token not_gd() :
+{/*@bgen(jjtree) NOT_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNOT_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NOT_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <NOT> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token imply_gd() :
+{/*@bgen(jjtree) IMPLY_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTIMPLY_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) IMPLY_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <IMPLY> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token exists_gd() :
+{/*@bgen(jjtree) EXISTS_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEXISTS_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EXISTS_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <EXISTS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_gd() :
+{/*@bgen(jjtree) FORALL_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token atomic_formula(int type) :
+{/*@bgen(jjtree) ATOMIC_FORMULA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTATOMIC_FORMULA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ATOMIC_FORMULA */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> predicate() (
+ LOOKAHEAD({ type == LexerTreeConstants.JJTCONSTANT } ) (constant())* {
+ jjtn000.setTypeId(LexerTreeConstants.JJTCONSTANT);
+ }
+ | LOOKAHEAD({ type == LexerTreeConstants.JJTTERM }) (term())* {
+ jjtn000.setTypeId(LexerTreeConstants.JJTTERM);
+ }
+ ) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token term() :
+{/*@bgen(jjtree) TERM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTERM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TERM */
+ try {
+/*@egen*/
+ try {
+ t=constant()
+ | t=variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token literal(int type) :
+{/*@bgen(jjtree) LITERAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) LITERAL */
+ try {
+/*@egen*/
+
+ try {
+ LOOKAHEAD(2) t=atomic_formula(type)
+ | LOOKAHEAD(2) t=not_atomic_formula(type)
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token not_atomic_formula(int type) :
+{/*@bgen(jjtree) NOT_ATOMIC_FORMULA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNOT_ATOMIC_FORMULA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NOT_ATOMIC_FORMULA */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <NOT> atomic_formula(type) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token f_comp() :
+{/*@bgen(jjtree) F_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_COMP */
+ try {
+/*@egen*/
+ try {
+ t=binary_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token binary_comp() :
+{/*@bgen(jjtree) BINARY_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) BINARY_COMP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=greater_comp()
+ | LOOKAHEAD(2) t=less_comp()
+ | LOOKAHEAD(2) t=greater_equal_comp()
+ | LOOKAHEAD(2) t=less_equal_comp()
+ | LOOKAHEAD(2) t=equal_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token greater_comp() :
+{/*@bgen(jjtree) GREATER_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGREATER_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) GREATER_COMP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <GREATER> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token greater_equal_comp() :
+{/*@bgen(jjtree) GREATER_EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGREATER_EQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) GREATER_EQUAL_COMP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <GEQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token less_equal_comp() :
+{/*@bgen(jjtree) LESS_EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLESS_EQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) LESS_EQUAL_COMP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <LEQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token less_comp() :
+{/*@bgen(jjtree) LESS_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLESS_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) LESS_COMP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <LESS> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token equal_comp() :
+{/*@bgen(jjtree) EQUAL_COMP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_COMP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EQUAL_COMP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <EQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token f_exp() :
+{/*@bgen(jjtree) F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_EXP */
+ try {
+/*@egen*/
+ try {
+ t=number()
+ | LOOKAHEAD(2) t=op()
+ | LOOKAHEAD(2) t=f_head()
+ | LOOKAHEAD(2) t=variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token number() :
+{/*@bgen(jjtree) NUMBER */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNUMBER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NUMBER */
+ try {
+/*@egen*/
+ try {
+ t =<NUMBER>
+
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token op() :
+{/*@bgen(jjtree) OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) OP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=binary_operation()
+ | LOOKAHEAD(2) t=unary_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token binary_operation() :
+{/*@bgen(jjtree) BINARY_OPERATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_OPERATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) BINARY_OPERATION */
+ try {
+/*@egen*/
+ try{
+ LOOKAHEAD(2) t=add_op()
+ | LOOKAHEAD(2) t=substract_op()
+ | LOOKAHEAD(2) t=multiply_op()
+ | LOOKAHEAD(2) t=divide_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token add_op() :
+{/*@bgen(jjtree) ADD_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ADD_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ADD> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token substract_op() :
+{/*@bgen(jjtree) SUBSTRACT_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSUBSTRACT_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SUBSTRACT_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SUB> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token multiply_op() :
+{/*@bgen(jjtree) MULTIPLY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMULTIPLY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) MULTIPLY_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <MUL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token divide_op() :
+{/*@bgen(jjtree) DIVIDE_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDIVIDE_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DIVIDE_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DIV> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token unary_op() :
+{/*@bgen(jjtree) UNARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTUNARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) UNARY_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SUB> f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token f_head() :
+{/*@bgen(jjtree) F_HEAD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_HEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_HEAD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> functor() (term())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token structure_def() :
+{/*@bgen(jjtree) STRUCTURE_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSTRUCTURE_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) STRUCTURE_DEF */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=action_def()
+ | LOOKAHEAD(2) t=durative_action_def()
+ | LOOKAHEAD(2) t=derived_def()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token action_def() :
+{/*@bgen(jjtree) ACTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ACTION_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ACTION> action_name()
+ <PARAMETERS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ action_def_body()
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token action_name() :
+{/*@bgen(jjtree) ACTION_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ACTION_NAME */
+ try {
+/*@egen*/
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token action_def_body() :
+{/*@bgen(jjtree) ACTION_DEF_BODY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTACTION_DEF_BODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ACTION_DEF_BODY */
+ try {
+/*@egen*/
+ try {
+ t=<PRECONDITION> pre_gd()
+ <EFFECT> effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token pre_gd() :
+{/*@bgen(jjtree) PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PRE_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=empty_or()
+ | LOOKAHEAD(2) t=pref_gd()
+ | LOOKAHEAD(2) t=and_pre_gd()
+ | LOOKAHEAD(2) t=forall_pre_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token empty_or() :
+{/*@bgen(jjtree) EMPTY_OR */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEMPTY_OR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EMPTY_OR */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_pre_gd() :
+{/*@bgen(jjtree) AND_PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_PRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_PRE_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (pre_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_pre_gd() :
+{/*@bgen(jjtree) FORALL_PRE_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_PRE_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_PRE_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> pre_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token pref_gd() :
+{/*@bgen(jjtree) PREF_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREF_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=named_pref_gd()
+ | t=gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token named_pref_gd() :
+{/*@bgen(jjtree) NAMED_PREF_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NAMED_PREF_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token pref_name() :
+{/*@bgen(jjtree) PREF_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREF_NAME */
+ try {
+/*@egen*/
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token effect() :
+{/*@bgen(jjtree) EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=and_c_effect()
+ | LOOKAHEAD(2) t=c_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_c_effect() :
+{/*@bgen(jjtree) AND_C_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_C_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_C_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (c_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token prob_effect() :
+{/*@bgen(jjtree) PROB_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROB_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PROB_EFFECT */
+ try {
+/*@egen*/
+ try{
+ t = <LPAREN> <PROB> (prob_term())* <RPAREN>
+ }catch(Throwable e){
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token prob_term() :
+{/*@bgen(jjtree) PROB_TERM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROB_TERM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PROB_TERM */
+ try {
+/*@egen*/
+ try{
+ LOOKAHEAD(3) t = number() c_effect()
+ | LOOKAHEAD(3) t = number() and_c_effect()
+ }catch(Throwable e){
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token c_effect() :
+{/*@bgen(jjtree) C_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTC_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) C_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=forall_effect()
+ | LOOKAHEAD(2) t=when_con_effect()
+ | LOOKAHEAD(2) t=p_effect()
+ | LOOKAHEAD(2) t=prob_effect()
+ } catch (Throwable e) {
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_effect() :
+{/*@bgen(jjtree) FORALL_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token when_con_effect() :
+{/*@bgen(jjtree) WHEN_CON_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWHEN_CON_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) WHEN_CON_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <WHEN> gd() cond_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token cond_effect() :
+{/*@bgen(jjtree) COND_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCOND_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) COND_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=and_c_effect()
+ | LOOKAHEAD(2) t=c_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_p_effect() :
+{/*@bgen(jjtree) AND_P_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_P_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_P_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (p_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token p_effect() :
+{/*@bgen(jjtree) P_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTP_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) P_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=assign_op()
+ | LOOKAHEAD(2) t=literal(LexerTreeConstants.JJTTERM)
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token assign_op() :
+{/*@bgen(jjtree) ASSIGN_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ASSIGN_OP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=assign()
+ | LOOKAHEAD(2) t=scale_up()
+ | LOOKAHEAD(2) t=scale_down()
+ | LOOKAHEAD(2) t=increase()
+ | LOOKAHEAD(2) t=decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token assign() :
+{/*@bgen(jjtree) ASSIGN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ASSIGN */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ASSIGN> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ { return t; }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token scale_up() :
+{/*@bgen(jjtree) SCALE_UP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSCALE_UP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SCALE_UP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SCALE_UP> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token scale_down() :
+{/*@bgen(jjtree) SCALE_DOWN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSCALE_DOWN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SCALE_DOWN */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SCALE_DOWN> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token increase() :
+{/*@bgen(jjtree) INCREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINCREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) INCREASE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token decrease() :
+{/*@bgen(jjtree) DECREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDECREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DECREASE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token durative_action_def() :
+{/*@bgen(jjtree) DURATION_ACTION_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDURATION_ACTION_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DURATION_ACTION_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DURATIVE_ACTION> da_symbol()
+ <PARAMETERS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ da_def_body()
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_symbol() :
+{/*@bgen(jjtree) DA_SYMBOL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SYMBOL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_SYMBOL */
+ try {
+/*@egen*/
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_def_body() :
+{/*@bgen(jjtree) DA_DEF_BODY */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DEF_BODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_DEF_BODY */
+ try {
+/*@egen*/
+ try {
+ t=<DURATION> duration_constraint()
+ <CONDITION> da_gd()
+ <EFFECT> da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token duration_constraint() :
+{/*@bgen(jjtree) DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=empty_or()
+ | LOOKAHEAD(2) t=and_simple_duration_constraint()
+ | LOOKAHEAD(2) t=simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_simple_duration_constraint() :
+{/*@bgen(jjtree) AND_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_SIMPLE_DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (simple_duration_constraint())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token simple_duration_constraint() :
+{/*@bgen(jjtree) SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SIMPLE_DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=d_op()
+ | LOOKAHEAD(2) t=at_simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_simple_duration_constraint() :
+{/*@bgen(jjtree) AT_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_SIMPLE_DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(3) t=at_start_simple_duration_constraint()
+ | LOOKAHEAD(3) t=at_end_simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_start_simple_duration_constraint() :
+{/*@bgen(jjtree) AT_START_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_START_SIMPLE_DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <START> simple_duration_constraint() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_end_simple_duration_constraint() :
+{/*@bgen(jjtree) AT_END_SIMPLE_DURATION_CONSTRAINT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_SIMPLE_DURATION_CONSTRAINT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_END_SIMPLE_DURATION_CONSTRAINT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <END> simple_duration_constraint() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token d_op() :
+{/*@bgen(jjtree) D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) D_OP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=equal_d_op()
+ | LOOKAHEAD(2) t=gequal_d_op()
+ | LOOKAHEAD(2) t=lequal_d_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token equal_d_op() :
+{/*@bgen(jjtree) EQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EQUAL_D_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <EQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token gequal_d_op() :
+{/*@bgen(jjtree) GEQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) GEQUAL_D_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <GEQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token lequal_d_op() :
+{/*@bgen(jjtree) LEQUAL_D_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTLEQUAL_D_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) LEQUAL_D_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <LEQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token var_duration() :
+{/*@bgen(jjtree) VAR_DURATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVAR_DURATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) VAR_DURATION */
+ try {
+/*@egen*/
+ try {
+ t=<VAR_DURATION>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token d_value() :
+{/*@bgen(jjtree) D_VALUE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTD_VALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) D_VALUE */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=number()
+ | LOOKAHEAD(2) t=f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_gd() :
+{/*@bgen(jjtree) DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=pref_timed_gd()
+ | LOOKAHEAD(2) t=and_da_gd()
+ | LOOKAHEAD(2) t=forall_da_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_da_gd() :
+{/*@bgen(jjtree) FORALL_DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_DA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_DA_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> da_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_da_gd() :
+{/*@bgen(jjtree) AND_DA_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_DA_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_DA_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (da_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token pref_timed_gd() :
+{/*@bgen(jjtree) PREF_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREF_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=timed_gd()
+ | LOOKAHEAD(2) t=named_pref_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token named_pref_timed_gd() :
+{/*@bgen(jjtree) NAMED_PREF_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NAMED_PREF_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] timed_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token timed_gd() :
+{/*@bgen(jjtree) TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=at_timed_gd()
+ | LOOKAHEAD(2) t=over_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token over_timed_gd() :
+{/*@bgen(jjtree) OVER_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOVER_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) OVER_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ t=over_all_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token over_all_timed_gd() :
+{/*@bgen(jjtree) OVER_ALL_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOVER_ALL_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) OVER_ALL_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <OVER> <ALL> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_timed_gd() :
+{/*@bgen(jjtree) AT_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(3) t=at_start_timed_gd()
+ | LOOKAHEAD(2) t=at_end_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_start_timed_gd() :
+{/*@bgen(jjtree) AT_START_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_START_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <START> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_end_timed_gd() :
+{/*@bgen(jjtree) AT_END_TIMED_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_TIMED_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_END_TIMED_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <END> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token interval() :
+{/*@bgen(jjtree) INTERVAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINTERVAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) INTERVAL */
+ try {
+/*@egen*/
+ try {
+ t=<ALL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_effect() :
+{/*@bgen(jjtree) DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=timed_effect()
+ | LOOKAHEAD(2) t=and_da_effect()
+ | LOOKAHEAD(2) t=forall_da_effect()
+ | LOOKAHEAD(2) t=when_da_effect()
+ | LOOKAHEAD(2) t=da_assign_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_assign_op() :
+{/*@bgen(jjtree) DA_ASSIGN_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ASSIGN_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_ASSIGN_OP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=da_assign()
+ | LOOKAHEAD(2) t=da_scale_up()
+ | LOOKAHEAD(2) t=da_scale_down()
+ | LOOKAHEAD(2) t=da_increase()
+ | LOOKAHEAD(2) t=da_decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_assign() :
+{/*@bgen(jjtree) DA_ASSIGN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ASSIGN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_ASSIGN */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ASSIGN> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_scale_up() :
+{/*@bgen(jjtree) DA_SCALE_UP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SCALE_UP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_SCALE_UP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SCALE_UP> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_scale_down() :
+{/*@bgen(jjtree) DA_SCALE_DOWN */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SCALE_DOWN);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_SCALE_DOWN */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SCALE_DOWN> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+
+}
+
+Token da_increase() :
+{/*@bgen(jjtree) DA_INCREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_INCREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_INCREASE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_decrease() :
+{/*@bgen(jjtree) DA_DECREASE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DECREASE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_DECREASE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token when_da_effect() :
+{/*@bgen(jjtree) WHEN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTWHEN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) WHEN_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <WHEN> da_gd() timed_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token forall_da_effect() :
+{/*@bgen(jjtree) FORALL_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> da_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_da_effect() :
+{/*@bgen(jjtree) AND_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (da_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token timed_effect() :
+{/*@bgen(jjtree) TIMED_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TIMED_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=at_da_effect()
+ | LOOKAHEAD(2) t=at_f_assign_da_effect()
+ | LOOKAHEAD(2) t=assign_op_t()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_f_assign_da_effect() :
+{/*@bgen(jjtree) AT_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_F_ASSIGN_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(3) t=at_start_f_assign_da_effect()
+ | LOOKAHEAD(3) t=at_end_f_assign_da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_start_f_assign_da_effect() :
+{/*@bgen(jjtree) AT_START_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_START_F_ASSIGN_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <START> f_assign_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token at_end_f_assign_da_effect() :
+{/*@bgen(jjtree) AT_END_F_ASSIGN_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_F_ASSIGN_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_END_F_ASSIGN_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <END> f_assign_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_da_effect() :
+{/*@bgen(jjtree) AT_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(4) t=at_start_da_effect()
+ | LOOKAHEAD(4) t=at_end_da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token at_start_da_effect() :
+{/*@bgen(jjtree) AT_START_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_START_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_START_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <START> literal(LexerTreeConstants.JJTTERM) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token at_end_da_effect() :
+{/*@bgen(jjtree) AT_END_DA_EFFECT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAT_END_DA_EFFECT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AT_END_DA_EFFECT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> <END> literal(LexerTreeConstants.JJTTERM) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token assign_op_t() :
+{/*@bgen(jjtree) ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ASSIGN_OP_T */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=increase_assign_op_t()
+ | LOOKAHEAD(2) t=decrease_assign_op_t()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token increase_assign_op_t() :
+{/*@bgen(jjtree) INCREASE_ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINCREASE_ASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) INCREASE_ASSIGN_OP_T */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp_t() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token decrease_assign_op_t() :
+{/*@bgen(jjtree) DECREASE_ASSIGN_OP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDECREASE_ASSIGN_OP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DECREASE_ASSIGN_OP_T */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp_t() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token f_exp_t() :
+{/*@bgen(jjtree) F_EXP_T */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP_T);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_EXP_T */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=<LPAREN> <MUL> continous_variable() f_exp() <RPAREN>
+ | LOOKAHEAD(2) t=<LPAREN> <MUL> f_exp() continous_variable() <RPAREN>
+ | LOOKAHEAD(2) t=continous_variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token continous_variable() :
+{/*@bgen(jjtree) CONTINOUS_VARIABLE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONTINOUS_VARIABLE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CONTINOUS_VARIABLE */
+ try {
+/*@egen*/
+ try {
+ t=<CONTINOUS_VARIABLE>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+
+}
+
+Token f_assign_da() :
+{/*@bgen(jjtree) F_ASSIGN_DA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_ASSIGN_DA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_ASSIGN_DA */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=da_assign()
+ | LOOKAHEAD(2) t=da_scale_up()
+ | LOOKAHEAD(2) t=da_scale_down()
+ | LOOKAHEAD(2) t=da_increase()
+ | LOOKAHEAD(2) t=da_decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token f_exp_da() :
+{/*@bgen(jjtree) F_EXP_DA */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTF_EXP_DA);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) F_EXP_DA */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(3) t=f_exp()
+ | LOOKAHEAD(3) t=da_binary_op()
+ | LOOKAHEAD(3) t=da_unary_op()
+ | LOOKAHEAD(3) t=var_duration()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token da_binary_op() :
+{/*@bgen(jjtree) DA_BINARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_BINARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_BINARY_OP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=da_add_op()
+ | LOOKAHEAD(2) t=da_substract_op()
+ | LOOKAHEAD(2) t=da_multiply_op()
+ | LOOKAHEAD(2) t=da_divide_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_add_op() :
+{/*@bgen(jjtree) DA_ADD_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_ADD_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_ADD_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ADD> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_substract_op() :
+{/*@bgen(jjtree) DA_SUBSTRACT_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_SUBSTRACT_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_SUBSTRACT_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SUB> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_multiply_op() :
+{/*@bgen(jjtree) DA_MULTIPLY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_MULTIPLY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_MULTIPLY_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <MUL> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_divide_op() :
+{/*@bgen(jjtree) DA_DIVIDE_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_DIVIDE_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_DIVIDE_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DIV> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token da_unary_op() :
+{/*@bgen(jjtree) DA_UNARY_OP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDA_UNARY_OP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DA_UNARY_OP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SUB> f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token derived_def() :
+{/*@bgen(jjtree) DERIVED_DEF */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDERIVED_DEF);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DERIVED_DEF */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DERIVED> atomic_formula(LexerTreeConstants.JJTVARIABLE) gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token problem() :
+{/*@bgen(jjtree) PROBLEM */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROBLEM);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PROBLEM */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <DEFINE> <LPAREN> <PROBLEM> problem_name() <RPAREN>
+ <LPAREN> <P_DOMAIN> domain_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ [LOOKAHEAD(2) require_def()]
+ [LOOKAHEAD(2) object_declaration()]
+ init()
+ goal()
+ [LOOKAHEAD(2) constraints()]
+ [LOOKAHEAD(2) metric_spec()]
+ // [length-spec()] not implemented
+ <RPAREN>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token problem_name() :
+{/*@bgen(jjtree) PROBLEM_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPROBLEM_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PROBLEM_NAME */
+ try {
+/*@egen*/
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token domain_name() :
+{/*@bgen(jjtree) DOMAIN_NAME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTDOMAIN_NAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) DOMAIN_NAME */
+ try {
+/*@egen*/
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ jjtn000.setImage(t.image);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token object_declaration() :
+{/*@bgen(jjtree) OBJECT_DECLARATION */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTOBJECT_DECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) OBJECT_DECLARATION */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <OBJECTS> typed_list(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token init() :
+{/*@bgen(jjtree) INIT */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) INIT */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <INIT> (init_el())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token init_el() :
+{/*@bgen(jjtree) INIT_EL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTINIT_EL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) INIT_EL */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=literal(LexerTreeConstants.JJTCONSTANT)
+ | LOOKAHEAD(2) t=equal_init_el()
+ | LOOKAHEAD(3) t=timed_literal()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token equal_init_el() :
+{/*@bgen(jjtree) EQUAL_INIT_EL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTEQUAL_INIT_EL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) EQUAL_INIT_EL */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <EQUALITY> f_head() number() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token timed_literal() :
+{/*@bgen(jjtree) TIMED_LITERAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTIMED_LITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TIMED_LITERAL */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AT> number() literal(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token goal() :
+{/*@bgen(jjtree) GOAL */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTGOAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) GOAL */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <GOAL> pre_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token constraints() :
+{/*@bgen(jjtree) CONSTRAINTS */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTRAINTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CONSTRAINTS */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <CONSTRAINTS> pref_con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token pref_con_gd() :
+{/*@bgen(jjtree) PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTPREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) PREF_CON_GD */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=and_pref_con_gd()
+ | LOOKAHEAD(2) t=forall_pref_con_gd()
+ | LOOKAHEAD(2) t=named_pref_con_gd()
+ | LOOKAHEAD(2) t=con_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token and_pref_con_gd() :
+{/*@bgen(jjtree) AND_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTAND_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) AND_PREF_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <AND> (pref_con_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token named_pref_con_gd() :
+{/*@bgen(jjtree) NAMED_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTNAMED_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) NAMED_PREF_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token forall_pref_con_gd() :
+{/*@bgen(jjtree) FORALL_PREF_CON_GD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTFORALL_PREF_CON_GD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) FORALL_PREF_CON_GD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> pref_con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token metric_spec() :
+{/*@bgen(jjtree) METRIC_SPEC */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMETRIC_SPEC);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) METRIC_SPEC */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(3) t=maximize()
+ | LOOKAHEAD(3) t=minimize()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token maximize() :
+{/*@bgen(jjtree) MAXIMIZE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMAXIMIZE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) MAXIMIZE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <METRIC> <MAXIMIZE> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token minimize() :
+{/*@bgen(jjtree) MINIMIZE */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMINIMIZE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) MINIMIZE */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <METRIC> <MINIMIZE> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token metric_f_exp() :
+{/*@bgen(jjtree) METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMETRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=unary_op_metric_f_exp()
+ | LOOKAHEAD(2) t=binary_op_metric_f_exp()
+ | LOOKAHEAD(2) t=multi_op_metric_f_exp()
+ | LOOKAHEAD(2) t=number()
+ | LOOKAHEAD(2) t=constant_f_head()
+ | LOOKAHEAD(2) t=total_time()
+ | LOOKAHEAD(2) t=violated_pref_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token violated_pref_exp() :
+{/*@bgen(jjtree) VIOLATED_PREF_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTVIOLATED_PREF_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) VIOLATED_PREF_EXP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <IS_VIOLATED> pref_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token constant_f_head() :
+{/*@bgen(jjtree) CONSTANT_F_HEAD */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTCONSTANT_F_HEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) CONSTANT_F_HEAD */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> functor() (constant())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token total_time() :
+{/*@bgen(jjtree) TOTAL_TIME */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTTOTAL_TIME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) TOTAL_TIME */
+ try {
+/*@egen*/
+ try {
+ t=<TOTAL_TIME>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+Token binary_op_metric_f_exp() :
+{/*@bgen(jjtree) BINARY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTBINARY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) BINARY_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=add_op_metric_f_exp()
+ | LOOKAHEAD(2) t=substract_op_metric_f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token add_op_metric_f_exp() :
+{/*@bgen(jjtree) ADD_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ADD_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ADD> metric_f_exp() metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token substract_op_metric_f_exp() :
+{/*@bgen(jjtree) SUBSTRACT_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTSUBSTRACT_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) SUBSTRACT_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try{
+ t=<LPAREN> <SUB> metric_f_exp() metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token multi_op_metric_f_exp() :
+{/*@bgen(jjtree) MULTI_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMULTI_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) MULTI_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ LOOKAHEAD(2) t=multiply_narity_op_metric_f_exp()
+ | LOOKAHEAD(2) t=add_narity_op_metric_f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token multiply_narity_op_metric_f_exp() :
+{/*@bgen(jjtree) MULTIPLY_NARITY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTMULTIPLY_NARITY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) MULTIPLY_NARITY_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <MUL> metric_f_exp() (metric_f_exp())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token add_narity_op_metric_f_exp() :
+{/*@bgen(jjtree) ADD_NARITY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTADD_NARITY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) ADD_NARITY_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <ADD> metric_f_exp() (metric_f_exp())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+Token unary_op_metric_f_exp() :
+{/*@bgen(jjtree) UNARY_OP_METRIC_F_EXP */
+ SimpleNode jjtn000 = new SimpleNode(this, JJTUNARY_OP_METRIC_F_EXP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/
+ Token t = token;
+}
+{/*@bgen(jjtree) UNARY_OP_METRIC_F_EXP */
+ try {
+/*@egen*/
+ try {
+ t=<LPAREN> <SUB> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);;
+ }/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ }
+/*@egen*/
+ {
+ jjtn000.setLine(t.beginLine);
+ jjtn000.setColumn(t.beginColumn);
+ return t;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ }
+ }
+/*@egen*/
+}
+
+
+
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt
new file mode 100644
index 00000000000..faf8c5a3038
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Lexer.jjt
@@ -0,0 +1,3466 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+options {
+ //MULTI=true;
+ NODE_DEFAULT_VOID=false;
+ STATIC=false;
+ NODE_PREFIX="PDDL_";
+ NODE_USES_PARSER=true;
+ IGNORE_CASE=true;
+}
+
+PARSER_BEGIN(Lexer)
+
+package pddl4j.lexer;
+
+import java.io.InputStream;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import pddl4j.ErrorManager;
+import pddl4j.ErrorManager.Message;
+
+public class Lexer {
+
+ private ErrorManager mgr;
+ private File file;
+
+ private static final int[] BLOCKS = {REQUIREMENTS,
+ TYPES,
+ CONSTANTS,
+ PREDICATES,
+ FUNCTIONS,
+ ACTION,
+ DURATIVE_ACTION,
+ DERIVED,
+ OBJECTS,
+ INIT,
+ GOAL,
+ METRIC,
+ EOF};
+
+ private boolean isBlock(int token) {
+ int i = 0;
+ while (i < BLOCKS.length && (BLOCKS[i] != token)) i++;
+ return i == BLOCKS.length;
+ }
+
+ private void error(Throwable e, int line, int column) throws ParseException {
+ String message = new String();
+ if (e.getClass().equals(TokenMgrError.class)) {
+ String[] tmp = e.getMessage().split(" ");
+ int l = -1;
+ int c = -1;
+ int i = 0;
+ for (i = 0 ; i < tmp.length; i++) {
+ if (tmp[i].equals("line") && i+1 < tmp.length) {
+ l = Integer.parseInt(tmp[i+1].substring(0, tmp[i+1].length()-1));
+ }
+ if (tmp[i].equals("column") && i+1 < tmp.length) {
+ c = Integer.parseInt(tmp[i+1].substring(0, tmp[i+1].length()-1));
+ }
+ }
+ message = e.getMessage().split(". ")[1];
+ this.mgr.logLexicalError(message, this.file, l, c);
+ } else if (e.getClass().equals(ParseException.class)) {
+ ParseException pe = (ParseException) e;
+ message = generateErrorMesssage(pe);
+ this.mgr.logLexicalError(message, this.file, pe.currentToken.beginLine, pe.currentToken.beginColumn);
+ } else if (e instanceof NullPointerException) {
+ // Do nothing
+ } else {
+ e.printStackTrace();
+ throw new ParseException(e.getMessage());
+ }
+ this.skipToNextBlock();
+ }
+
+ private void skipToNextBlock() {
+ Token t;
+ Token t2;
+ do {
+ t = getNextToken();
+ t2 = getToken(2);
+
+ } while (t2 != null && isBlock(t2.kind));
+ }
+
+ public void setErrorManager(ErrorManager mgr) {
+ this.mgr = mgr;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ /**
+ * Creates the error message from a specific parse exception.
+ *
+ * @param pe the parse exception.
+ * @return the error message.
+ */
+ private String generateErrorMesssage(ParseException pe) {
+ StringBuffer expected = new StringBuffer();
+ boolean expectedSeq = false;
+ int maxSize = 0;
+ for (int i = 0; i < pe.expectedTokenSequences.length; i++) {
+ if (maxSize < pe.expectedTokenSequences[i].length) {
+ maxSize = pe.expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < pe.expectedTokenSequences[i].length; j++) {
+ expected.append(pe.tokenImage[pe.expectedTokenSequences[i][j]]).append(" ");
+ expectedSeq = true;
+ }
+ if (pe.expectedTokenSequences[i][pe.expectedTokenSequences[i].length - 1] != 0) {
+ expected.append("...");
+ }
+ if (i < pe.expectedTokenSequences.length - 1) {
+ expected.append("\n").append(" ");
+ }
+ }
+ String retval = "unexpected token \"" + pe.currentToken.next.image + "\".";
+ if (expectedSeq) {
+ if (pe.expectedTokenSequences.length == 1) {
+ retval += "\nWas expecting:" + "\n" + " ";
+ } else {
+ retval += "\nWas expecting one of:" + "\n" + " ";
+ }
+ retval += expected.toString();
+ }
+ return retval;
+ }
+}
+PARSER_END(Lexer)
+
+
+SKIP :
+{
+ " "
+| "\t"
+| "\n"
+| "\r"
+}
+MORE :
+{
+ "//" : IN_SINGLE_LINE_COMMENT
+| ";" : IN_SINGLE_LINE_COMMENT
+| <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
+| "/*" : IN_MULTI_LINE_COMMENT
+}
+<IN_SINGLE_LINE_COMMENT>
+ SPECIAL_TOKEN : {
+ <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : DEFAULT
+ }
+<IN_FORMAL_COMMENT>
+ SPECIAL_TOKEN : {
+ <FORMAL_COMMENT: "*/" > : DEFAULT
+ }
+<IN_MULTI_LINE_COMMENT>
+ SPECIAL_TOKEN : {
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+ }
+<IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
+ MORE : {
+ < ~[] >
+}
+
+TOKEN :
+{
+ < LPAREN: "(">
+| < RPAREN: ")">
+}
+
+TOKEN : {
+ < DEFINE : "define" >
+| < DOMAIN : "domain" >
+| < REQUIREMENTS : ":requirements" >
+| < TYPES : ":types" >
+| < EITHER : "either" >
+| < CONSTANTS : ":constants" >
+| < PREDICATES : ":predicates" >
+| < FUNCTIONS : ":functions" >
+| < ACTION : ":action" >
+| < PARAMETERS : ":parameters" >
+| < PRECONDITION : ":precondition" >
+| < EFFECT : ":effect" >
+| < PREFERENCE : "preference" >
+| < WHEN : "when" >
+| < PROB : "probabilistic">
+| < DURATIVE_ACTION : ":durative-action" >
+| < DURATION : ":duration" >
+| < CONDITION : ":condition" >
+| < DERIVED : ":derived" >
+| < PROBLEM : "problem" >
+| < P_DOMAIN : ":domain" >
+| < OBJECTS : ":objects" >
+| < INIT : ":init" >
+| < GOAL: ":goal" >
+| < METRIC : ":metric" >
+}
+
+TOKEN : {
+ < STRIPS : ":strips" >
+| < TYPING : ":typing" >
+| < NEGATIVE_PRECONDITIONS : ":negative-preconditions" >
+| < DISJUNCTIVE_PRECONDITIONS : ":disjunctive-preconditions" >
+| < EQUALITY : ":equality" >
+| < EXISTENTIAL_PRECONDITIONS : ":existential-preconditions" >
+| < UNIVERSAL_PRECONDITIONS : ":universal-preconditions" >
+| < QUANTIFIED_PRECONDITIONS : ":quantified-preconditions" >
+| < CONDITIONAL_EFFECTS : ":conditional-effects" >
+| < FLUENTS : ":fluents" >
+| < ADL : ":adl" >
+| < DURATIVE_ACTIONS : ":durative-actions" >
+| < DERIVED_PREDICATES : ":derived-predicates" >
+| < TIMED_INITIAL_LITERALS : ":timed-initial-literals" >
+| < PREFERENCES : ":preferences" >
+| < CONSTRAINTS : ":constraints" >
+| < CONTINUS_EFFECTS : ":continus_effects" >
+| < DURATION_INEQUALITIES : ":duration-inequalities" >
+}
+
+TOKEN :
+{
+ < GREATER : ">" >
+| < LESS : "<" >
+| < GEQUAL : ">=" >
+| < LEQUAL : "<=" >
+| < EQUAL : "=" >
+}
+
+TOKEN :
+{
+ < MUL : "*" >
+| < DIV : "/" >
+| < ADD : "+" >
+| < SUB : "-" >
+}
+
+TOKEN :
+{
+ <ASSIGN : "assign" >
+| <SCALE_UP : "scale-up" >
+| <SCALE_DOWN : "scale-down" >
+| <INCREASE : "increase" >
+| <DECREASE : "decrease" >
+}
+
+TOKEN :
+{
+ < OR : "or" >
+| < AND : "and" >
+| < IMPLY : "imply" >
+| < NOT : "not" >
+| < FORALL : "forall" >
+| < EXISTS : "exists" >
+}
+
+TOKEN :
+{
+ < ALWAYS : "always" >
+| < SOMETIME : "sometime" >
+| < WITHIN : "within" >
+| < AT_MOST_ONCE : "at-most-once" >
+| < SOMETIME_AFTER : "sometime-after" >
+| < SOMETIME_BEFORE : "sometime-before" >
+| < ALWAYS_WITHIN : "always-within" >
+| < HOLD_DURING : "hold-during" >
+| < HOLD_AFTER : "hold-after" >
+| < AT: "at" >
+| < START : "start">
+| < END : "end">
+| < OVER : "over">
+| < ALL : "all">
+| < TOTAL_TIME : "total_time" >
+| < MAXIMIZE : "maximize" >
+| < MINIMIZE : "minimize" >
+| < IS_VIOLATED : "is-violated" >
+}
+
+TOKEN :
+{
+ < VAR_DURATION : "?duration" >
+| < CONTINOUS_VARIABLE : "#t" >
+}
+
+TOKEN :
+{
+ < NUMBER_TYPE : "number" >
+| < OBJECT_TYPE : "object" >
+}
+
+
+TOKEN :
+{
+ < SYMBOL : ((<LETTER> (<LETTER> | <DIGIT>)*)) >
+| < NUMBER : (<DIGIT>)+ ("." (<DIGIT>)*)? >
+| < #DIGIT : ["0"-"9"] >
+| < #LETTER : ["a"-"z","A"-"Z","_","-","#"] >
+}
+
+SimpleNode parse() #ROOT:
+{
+ Token t= null;
+}
+{
+ try {
+ LOOKAHEAD(4) t=domain()
+ | LOOKAHEAD(4) t=problem()
+ } catch (Throwable e) {
+ this.mgr.logLexicalError("Lexical error file (" +file.getName() + ") : to many errors", file);
+ throw new ParseException(e.getMessage());
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return jjtThis;
+ }
+
+}
+
+Token domain() #DOMAIN:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DEFINE> <LPAREN> <DOMAIN> domain_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=require_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=type_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=constants_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=predicates_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=functions_def()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ [LOOKAHEAD(2) t=constraints()]
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ (t=structure_def())*
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ try {
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token require_def() #REQUIRE_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <REQUIREMENTS> (require_key())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token require_key() #REQUIRE_KEY:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<STRIPS>
+ | t=<TYPING>
+ | t=<NEGATIVE_PRECONDITIONS>
+ | t=<DISJUNCTIVE_PRECONDITIONS>
+ | t=<EQUALITY>
+ | t=<EXISTENTIAL_PRECONDITIONS>
+ | t=<UNIVERSAL_PRECONDITIONS>
+ | t=<QUANTIFIED_PRECONDITIONS>
+ | t=<CONDITIONAL_EFFECTS>
+ | t=<FLUENTS>
+ | t=<ADL>
+ | t=<DURATIVE_ACTIONS>
+ | t=<DERIVED_PREDICATES>
+ | t=<TIMED_INITIAL_LITERALS>
+ | t=<PREFERENCES>
+ | t=<CONSTRAINTS>
+ | t=<CONTINUS_EFFECTS>
+ | t=<DURATION_INEQUALITIES>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token type_def() #TYPE_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <TYPES> typed_list(LexerTreeConstants.JJTPRIMITIVE_TYPE) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token typed_list(int type) #TYPED_LIST:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2, {type == LexerTreeConstants.JJTPRIMITIVE_TYPE})
+ (t=primitive_type())* (<SUB> type() typed_list(type))?
+ | LOOKAHEAD(2, {type == LexerTreeConstants.JJTCONSTANT})
+ (t=constant())* (<SUB> type() typed_list(type))?
+ | LOOKAHEAD(2, {type == LexerTreeConstants.JJTVARIABLE})
+ (t=variable())* (<SUB> type() typed_list(type))?
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ if (t != null) {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setTypeId(LexerTreeConstants.JJTVARIABLE);
+ }
+ return t;
+ }
+}
+
+Token type() #TYPE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <EITHER> (primitive_type())+ <RPAREN>
+ | t=primitive_type()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token primitive_type() #PRIMITIVE_TYPE:
+{
+ Token t = token;
+}
+{
+( t=<OBJECT_TYPE>
+| t=<NUMBER_TYPE>
+| t=<SYMBOL>)
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token constants_def() #CONSTANT_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <CONSTANTS> typed_list(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token constant() #CONSTANT:
+{
+ Token t = token;
+}
+{
+ t=<SYMBOL>
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token predicates_def() #PREDICATE_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <PREDICATES> (atomic_formula_skeleton())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token atomic_formula_skeleton() #ATOMIC_FORMULA_SKELETON:
+{
+ Token t = token;
+}
+{
+ t=<LPAREN> predicate() typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token predicate() #PREDICATE:
+{
+ Token t = token;
+}
+{
+ (t=<SYMBOL> | t=<AT>)
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token variable() #VARIABLE:
+{
+ Token t = token;
+}
+{
+ "?" (t=<SYMBOL> | t=<OBJECT_TYPE> | t=<NUMBER_TYPE>)
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token functions_def() #FUNCTION_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FUNCTIONS> function_typed_list(LexerTreeConstants.JJTATOMIC_FUNCTION_SKELETON) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token atomic_function_skeleton() #ATOMIC_FUNCTION_SKELETON:
+{
+ Token t = token;
+}
+{
+ t=<LPAREN> functor() typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token functor() #FUNCTOR:
+{
+ Token t = token;
+}
+{
+ t=<SYMBOL>
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token function_typed_list(int type) #FUNCTION_TYPED_LIST:
+{
+ Token t = token;
+}
+{
+ (t=atomic_function_skeleton())* (<SUB> function_type() function_typed_list(type))?
+ {
+ if (t != null) {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ }
+ return t;
+ }
+}
+
+Token function_type() #FUNCTION_TYPE:
+{
+ Token t = token;
+}
+{
+ t=<NUMBER_TYPE>
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token con_gd() #CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=and_con_gd()
+ | LOOKAHEAD(2) t=forall_con_gd()
+ | LOOKAHEAD(2) t=at_end_con_gd()
+ | LOOKAHEAD(2) t=always_con_gd()
+ | LOOKAHEAD(2) t=sometime_con_gd()
+ | LOOKAHEAD(2) t=within_con_gd()
+ | LOOKAHEAD(2) t=at_most_once_con_gd()
+ | LOOKAHEAD(2) t=sometime_after_con_gd()
+ | LOOKAHEAD(2) t=sometime_before_con_gd()
+ | LOOKAHEAD(2) t=always_within_con_gd()
+ | LOOKAHEAD(2) t=hold_during_con_gd()
+ | LOOKAHEAD(2) t=hold_after_con_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_con_gd() #AND_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (con_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_con_gd() #FORALL_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_end_con_gd() #AT_END_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <END> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token always_con_gd() #ALWAYS_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ALWAYS> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token sometime_con_gd() #SOMETIME_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SOMETIME> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token within_con_gd() #WITHIN_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <WITHIN> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_most_once_con_gd() #AT_MOST_ONCE_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT_MOST_ONCE> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token sometime_after_con_gd() #SOMETIME_AFTER_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SOMETIME_AFTER> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token sometime_before_con_gd() #SOMETIME_BEFORE_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SOMETIME_BEFORE> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token always_within_con_gd() #ALWAYS_WITHIN_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ALWAYS_WITHIN> <NUMBER> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token hold_during_con_gd() #HOLD_DURING_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <HOLD_DURING> <NUMBER> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token hold_after_con_gd() #HOLD_AFTER_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <HOLD_AFTER> <NUMBER> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token gd() #GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=atomic_formula(LexerTreeConstants.JJTTERM)
+// | LOOKAHEAD(2) t=not_atomic_formula(LexerTreeConstants.JJTTERM)
+ | LOOKAHEAD(2) t=and_gd()
+ | LOOKAHEAD(2) t=or_gd()
+ | LOOKAHEAD(2) t=not_gd()
+ | LOOKAHEAD(2) t=imply_gd()
+ | LOOKAHEAD(2) t=exists_gd()
+ | LOOKAHEAD(2) t=forall_gd()
+ | LOOKAHEAD(2) t=f_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_gd() #AND_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token or_gd() #OR_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <OR> (gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token not_gd() #NOT_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <NOT> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token imply_gd() #IMPLY_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <IMPLY> gd() gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token exists_gd() #EXISTS_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <EXISTS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_gd() #FORALL_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token atomic_formula(int type) #ATOMIC_FORMULA:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> predicate() (
+ LOOKAHEAD({ type == LexerTreeConstants.JJTCONSTANT } ) (constant())* {
+ jjtThis.setTypeId(LexerTreeConstants.JJTCONSTANT);
+ }
+ | LOOKAHEAD({ type == LexerTreeConstants.JJTTERM }) (term())* {
+ jjtThis.setTypeId(LexerTreeConstants.JJTTERM);
+ }
+ ) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token term() #TERM:
+{
+ Token t = token;
+}
+{
+ try {
+ t=constant()
+ | t=variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token literal(int type) #LITERAL:
+{
+ Token t = token;
+}
+{
+
+ try {
+ LOOKAHEAD(2) t=atomic_formula(type)
+ | LOOKAHEAD(2) t=not_atomic_formula(type)
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token not_atomic_formula(int type) #NOT_ATOMIC_FORMULA:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <NOT> atomic_formula(type) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token f_comp() #F_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=binary_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token binary_comp() #BINARY_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=greater_comp()
+ | LOOKAHEAD(2) t=less_comp()
+ | LOOKAHEAD(2) t=greater_equal_comp()
+ | LOOKAHEAD(2) t=less_equal_comp()
+ | LOOKAHEAD(2) t=equal_comp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token greater_comp() #GREATER_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <GREATER> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token greater_equal_comp() #GREATER_EQUAL_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <GEQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token less_equal_comp() #LESS_EQUAL_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <LEQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token less_comp() #LESS_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <LESS> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token equal_comp() #EQUAL_COMP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <EQUAL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token f_exp() #F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=number()
+ | LOOKAHEAD(2) t=op()
+ | LOOKAHEAD(2) t=f_head()
+ | LOOKAHEAD(2) t=variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token number() #NUMBER:
+{
+ Token t = token;
+}
+{
+ try {
+ t =<NUMBER>
+
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token op() #OP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=binary_operation()
+ | LOOKAHEAD(2) t=unary_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token binary_operation() #BINARY_OPERATION:
+{
+ Token t = token;
+}
+{
+ try{
+ LOOKAHEAD(2) t=add_op()
+ | LOOKAHEAD(2) t=substract_op()
+ | LOOKAHEAD(2) t=multiply_op()
+ | LOOKAHEAD(2) t=divide_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token add_op() #ADD_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ADD> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token substract_op() #SUBSTRACT_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SUB> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token multiply_op() #MULTIPLY_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <MUL> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token divide_op() #DIVIDE_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DIV> f_exp() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token unary_op() #UNARY_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SUB> f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token f_head() #F_HEAD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> functor() (term())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token structure_def() #STRUCTURE_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=action_def()
+ | LOOKAHEAD(2) t=durative_action_def()
+ | LOOKAHEAD(2) t=derived_def()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token action_def() #ACTION_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ACTION> action_name()
+ <PARAMETERS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ action_def_body()
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token action_name() #ACTION_NAME:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token action_def_body() #ACTION_DEF_BODY:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<PRECONDITION> pre_gd()
+ <EFFECT> effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token pre_gd() #PRE_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=empty_or()
+ | LOOKAHEAD(2) t=pref_gd()
+ | LOOKAHEAD(2) t=and_pre_gd()
+ | LOOKAHEAD(2) t=forall_pre_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token empty_or() #EMPTY_OR:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_pre_gd() #AND_PRE_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (pre_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_pre_gd() #FORALL_PRE_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> pre_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token pref_gd() #PREF_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=named_pref_gd()
+ | t=gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token named_pref_gd() #NAMED_PREF_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token pref_name() #PREF_NAME:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token effect() #EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=and_c_effect()
+ | LOOKAHEAD(2) t=c_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_c_effect() #AND_C_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (c_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token prob_effect() #PROB_EFFECT:
+{
+ Token t = token;
+}
+{
+ try{
+ t = <LPAREN> <PROB> (prob_term())* <RPAREN>
+ }catch(Throwable e){
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token prob_term() #PROB_TERM:
+{
+ Token t = token;
+}
+{
+ try{
+ LOOKAHEAD(3) t = number() c_effect()
+ | LOOKAHEAD(3) t = number() and_c_effect()
+ }catch(Throwable e){
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token c_effect() #C_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=forall_effect()
+ | LOOKAHEAD(2) t=when_con_effect()
+ | LOOKAHEAD(2) t=p_effect()
+ | LOOKAHEAD(2) t=prob_effect()
+ } catch (Throwable e) {
+
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_effect() #FORALL_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token when_con_effect() #WHEN_CON_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <WHEN> gd() cond_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token cond_effect() #COND_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=and_c_effect()
+ | LOOKAHEAD(2) t=c_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_p_effect() #AND_P_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (p_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token p_effect() #P_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=assign_op()
+ | LOOKAHEAD(2) t=literal(LexerTreeConstants.JJTTERM)
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token assign_op() #ASSIGN_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=assign()
+ | LOOKAHEAD(2) t=scale_up()
+ | LOOKAHEAD(2) t=scale_down()
+ | LOOKAHEAD(2) t=increase()
+ | LOOKAHEAD(2) t=decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token assign() #ASSIGN:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ASSIGN> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+ { return t; }
+}
+
+Token scale_up() #SCALE_UP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SCALE_UP> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token scale_down() #SCALE_DOWN:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SCALE_DOWN> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token increase() #INCREASE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token decrease() #DECREASE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token durative_action_def() #DURATION_ACTION_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DURATIVE_ACTION> da_symbol()
+ <PARAMETERS> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN>
+ da_def_body()
+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_symbol() #DA_SYMBOL:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token da_def_body() #DA_DEF_BODY:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<DURATION> duration_constraint()
+ <CONDITION> da_gd()
+ <EFFECT> da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token duration_constraint() #DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=empty_or()
+ | LOOKAHEAD(2) t=and_simple_duration_constraint()
+ | LOOKAHEAD(2) t=simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_simple_duration_constraint() #AND_SIMPLE_DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (simple_duration_constraint())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token simple_duration_constraint() #SIMPLE_DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=d_op()
+ | LOOKAHEAD(2) t=at_simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_simple_duration_constraint() #AT_SIMPLE_DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(3) t=at_start_simple_duration_constraint()
+ | LOOKAHEAD(3) t=at_end_simple_duration_constraint()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_start_simple_duration_constraint() #AT_START_SIMPLE_DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <START> simple_duration_constraint() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_end_simple_duration_constraint() #AT_END_SIMPLE_DURATION_CONSTRAINT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <END> simple_duration_constraint() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token d_op() #D_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=equal_d_op()
+ | LOOKAHEAD(2) t=gequal_d_op()
+ | LOOKAHEAD(2) t=lequal_d_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token equal_d_op() #EQUAL_D_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <EQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token gequal_d_op() #GEQUAL_D_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <GEQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token lequal_d_op() #LEQUAL_D_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <LEQUAL> var_duration() d_value() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token var_duration() #VAR_DURATION:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<VAR_DURATION>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token d_value() #D_VALUE:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=number()
+ | LOOKAHEAD(2) t=f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_gd() #DA_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=pref_timed_gd()
+ | LOOKAHEAD(2) t=and_da_gd()
+ | LOOKAHEAD(2) t=forall_da_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_da_gd() #FORALL_DA_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> da_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_da_gd() #AND_DA_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (da_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token pref_timed_gd() #PREF_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=timed_gd()
+ | LOOKAHEAD(2) t=named_pref_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token named_pref_timed_gd() #NAMED_PREF_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] timed_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token timed_gd() #TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=at_timed_gd()
+ | LOOKAHEAD(2) t=over_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token over_timed_gd() #OVER_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=over_all_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token over_all_timed_gd() #OVER_ALL_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <OVER> <ALL> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_timed_gd() #AT_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(3) t=at_start_timed_gd()
+ | LOOKAHEAD(2) t=at_end_timed_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_start_timed_gd() #AT_START_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <START> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_end_timed_gd() #AT_END_TIMED_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <END> gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token interval() #INTERVAL:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<ALL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_effect() #DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=timed_effect()
+ | LOOKAHEAD(2) t=and_da_effect()
+ | LOOKAHEAD(2) t=forall_da_effect()
+ | LOOKAHEAD(2) t=when_da_effect()
+ | LOOKAHEAD(2) t=da_assign_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_assign_op() #DA_ASSIGN_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=da_assign()
+ | LOOKAHEAD(2) t=da_scale_up()
+ | LOOKAHEAD(2) t=da_scale_down()
+ | LOOKAHEAD(2) t=da_increase()
+ | LOOKAHEAD(2) t=da_decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_assign() #DA_ASSIGN:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ASSIGN> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_scale_up() #DA_SCALE_UP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SCALE_UP> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_scale_down() #DA_SCALE_DOWN:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SCALE_DOWN> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+
+}
+
+Token da_increase() #DA_INCREASE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_decrease() #DA_DECREASE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token when_da_effect() #WHEN_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <WHEN> da_gd() timed_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token forall_da_effect() #FORALL_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> da_effect() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_da_effect() #AND_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (da_effect())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token timed_effect() #TIMED_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=at_da_effect()
+ | LOOKAHEAD(2) t=at_f_assign_da_effect()
+ | LOOKAHEAD(2) t=assign_op_t()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_f_assign_da_effect() #AT_F_ASSIGN_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(3) t=at_start_f_assign_da_effect()
+ | LOOKAHEAD(3) t=at_end_f_assign_da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_start_f_assign_da_effect() #AT_START_F_ASSIGN_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <START> f_assign_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token at_end_f_assign_da_effect() #AT_END_F_ASSIGN_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <END> f_assign_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_da_effect() #AT_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(4) t=at_start_da_effect()
+ | LOOKAHEAD(4) t=at_end_da_effect()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token at_start_da_effect() #AT_START_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <START> literal(LexerTreeConstants.JJTTERM) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token at_end_da_effect() #AT_END_DA_EFFECT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> <END> literal(LexerTreeConstants.JJTTERM) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token assign_op_t() #ASSIGN_OP_T:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=increase_assign_op_t()
+ | LOOKAHEAD(2) t=decrease_assign_op_t()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token increase_assign_op_t() #INCREASE_ASSIGN_OP_T:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <INCREASE> f_head() f_exp_t() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token decrease_assign_op_t() #DECREASE_ASSIGN_OP_T:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DECREASE> f_head() f_exp_t() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token f_exp_t() #F_EXP_T:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=<LPAREN> <MUL> continous_variable() f_exp() <RPAREN>
+ | LOOKAHEAD(2) t=<LPAREN> <MUL> f_exp() continous_variable() <RPAREN>
+ | LOOKAHEAD(2) t=continous_variable()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token continous_variable() #CONTINOUS_VARIABLE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<CONTINOUS_VARIABLE>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+
+}
+
+Token f_assign_da() #F_ASSIGN_DA:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=da_assign()
+ | LOOKAHEAD(2) t=da_scale_up()
+ | LOOKAHEAD(2) t=da_scale_down()
+ | LOOKAHEAD(2) t=da_increase()
+ | LOOKAHEAD(2) t=da_decrease()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token f_exp_da() #F_EXP_DA:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(3) t=f_exp()
+ | LOOKAHEAD(3) t=da_binary_op()
+ | LOOKAHEAD(3) t=da_unary_op()
+ | LOOKAHEAD(3) t=var_duration()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token da_binary_op() #DA_BINARY_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=da_add_op()
+ | LOOKAHEAD(2) t=da_substract_op()
+ | LOOKAHEAD(2) t=da_multiply_op()
+ | LOOKAHEAD(2) t=da_divide_op()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_add_op() #DA_ADD_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ADD> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_substract_op() #DA_SUBSTRACT_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SUB> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_multiply_op() #DA_MULTIPLY_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <MUL> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_divide_op() #DA_DIVIDE_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DIV> f_head() f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token da_unary_op() #DA_UNARY_OP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SUB> f_exp_da() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token derived_def() #DERIVED_DEF:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DERIVED> atomic_formula(LexerTreeConstants.JJTVARIABLE) gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token problem() #PROBLEM:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <DEFINE> <LPAREN> <PROBLEM> problem_name() <RPAREN>
+ <LPAREN> <P_DOMAIN> domain_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ [LOOKAHEAD(2) require_def()]
+ [LOOKAHEAD(2) object_declaration()]
+ init()
+ goal()
+ [LOOKAHEAD(2) constraints()]
+ [LOOKAHEAD(2) metric_spec()]
+ // [length-spec()] not implemented
+ <RPAREN> {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token problem_name() #PROBLEM_NAME:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token domain_name() #DOMAIN_NAME:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<SYMBOL>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ jjtThis.setImage(t.image);
+ return t;
+ }
+}
+
+Token object_declaration() #OBJECT_DECLARATION:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <OBJECTS> typed_list(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token init() #INIT:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <INIT> (init_el())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token init_el() #INIT_EL:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=literal(LexerTreeConstants.JJTCONSTANT)
+ | LOOKAHEAD(2) t=equal_init_el()
+ | LOOKAHEAD(3) t=timed_literal()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token equal_init_el() #EQUAL_INIT_EL:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <EQUALITY> f_head() number() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token timed_literal() #TIMED_LITERAL:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AT> number() literal(LexerTreeConstants.JJTCONSTANT) <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token goal() #GOAL:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <GOAL> pre_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token constraints() #CONSTRAINTS:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <CONSTRAINTS> pref_con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token pref_con_gd() #PREF_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=and_pref_con_gd()
+ | LOOKAHEAD(2) t=forall_pref_con_gd()
+ | LOOKAHEAD(2) t=named_pref_con_gd()
+ | LOOKAHEAD(2) t=con_gd()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token and_pref_con_gd() #AND_PREF_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <AND> (pref_con_gd())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token named_pref_con_gd() #NAMED_PREF_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <PREFERENCE> [pref_name()] con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token forall_pref_con_gd() #FORALL_PREF_CON_GD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <FORALL> <LPAREN> typed_list(LexerTreeConstants.JJTVARIABLE) <RPAREN> pref_con_gd() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token metric_spec() #METRIC_SPEC:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(3) t=maximize()
+ | LOOKAHEAD(3) t=minimize()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token maximize() #MAXIMIZE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <METRIC> <MAXIMIZE> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token minimize() #MINIMIZE:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <METRIC> <MINIMIZE> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token metric_f_exp() #METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=unary_op_metric_f_exp()
+ | LOOKAHEAD(2) t=binary_op_metric_f_exp()
+ | LOOKAHEAD(2) t=multi_op_metric_f_exp()
+ | LOOKAHEAD(2) t=number()
+ | LOOKAHEAD(2) t=constant_f_head()
+ | LOOKAHEAD(2) t=total_time()
+ | LOOKAHEAD(2) t=violated_pref_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token violated_pref_exp() #VIOLATED_PREF_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <IS_VIOLATED> pref_name() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token constant_f_head() #CONSTANT_F_HEAD:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> functor() (constant())* <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token total_time() #TOTAL_TIME:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<TOTAL_TIME>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+Token binary_op_metric_f_exp() #BINARY_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=add_op_metric_f_exp()
+ | LOOKAHEAD(2) t=substract_op_metric_f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token add_op_metric_f_exp() #ADD_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ADD> metric_f_exp() metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token substract_op_metric_f_exp() #SUBSTRACT_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try{
+ t=<LPAREN> <SUB> metric_f_exp() metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token multi_op_metric_f_exp() #MULTI_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ LOOKAHEAD(2) t=multiply_narity_op_metric_f_exp()
+ | LOOKAHEAD(2) t=add_narity_op_metric_f_exp()
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token multiply_narity_op_metric_f_exp() #MULTIPLY_NARITY_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <MUL> metric_f_exp() (metric_f_exp())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token add_narity_op_metric_f_exp() #ADD_NARITY_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <ADD> metric_f_exp() (metric_f_exp())+ <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+Token unary_op_metric_f_exp() #UNARY_OP_METRIC_F_EXP:
+{
+ Token t = token;
+}
+{
+ try {
+ t=<LPAREN> <SUB> metric_f_exp() <RPAREN>
+ } catch (Throwable e) {
+ this.error(e, t.beginLine, t.beginColumn);;
+ }
+ {
+ jjtThis.setLine(t.beginLine);
+ jjtThis.setColumn(t.beginColumn);
+ return t;
+ }
+}
+
+
+
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java
new file mode 100644
index 00000000000..426c9fdf05e
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerConstants.java
@@ -0,0 +1,320 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. LexerConstants.java */
+package pddl4j.lexer;
+
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
+public interface LexerConstants {
+
+ /** End of File. */
+ int EOF = 0;
+ /** RegularExpression Id. */
+ int SINGLE_LINE_COMMENT = 9;
+ /** RegularExpression Id. */
+ int FORMAL_COMMENT = 10;
+ /** RegularExpression Id. */
+ int MULTI_LINE_COMMENT = 11;
+ /** RegularExpression Id. */
+ int LPAREN = 13;
+ /** RegularExpression Id. */
+ int RPAREN = 14;
+ /** RegularExpression Id. */
+ int DEFINE = 15;
+ /** RegularExpression Id. */
+ int DOMAIN = 16;
+ /** RegularExpression Id. */
+ int REQUIREMENTS = 17;
+ /** RegularExpression Id. */
+ int TYPES = 18;
+ /** RegularExpression Id. */
+ int EITHER = 19;
+ /** RegularExpression Id. */
+ int CONSTANTS = 20;
+ /** RegularExpression Id. */
+ int PREDICATES = 21;
+ /** RegularExpression Id. */
+ int FUNCTIONS = 22;
+ /** RegularExpression Id. */
+ int ACTION = 23;
+ /** RegularExpression Id. */
+ int PARAMETERS = 24;
+ /** RegularExpression Id. */
+ int PRECONDITION = 25;
+ /** RegularExpression Id. */
+ int EFFECT = 26;
+ /** RegularExpression Id. */
+ int PREFERENCE = 27;
+ /** RegularExpression Id. */
+ int WHEN = 28;
+ /** RegularExpression Id. */
+ int PROB = 29;
+ /** RegularExpression Id. */
+ int DURATIVE_ACTION = 30;
+ /** RegularExpression Id. */
+ int DURATION = 31;
+ /** RegularExpression Id. */
+ int CONDITION = 32;
+ /** RegularExpression Id. */
+ int DERIVED = 33;
+ /** RegularExpression Id. */
+ int PROBLEM = 34;
+ /** RegularExpression Id. */
+ int P_DOMAIN = 35;
+ /** RegularExpression Id. */
+ int OBJECTS = 36;
+ /** RegularExpression Id. */
+ int INIT = 37;
+ /** RegularExpression Id. */
+ int GOAL = 38;
+ /** RegularExpression Id. */
+ int METRIC = 39;
+ /** RegularExpression Id. */
+ int STRIPS = 40;
+ /** RegularExpression Id. */
+ int TYPING = 41;
+ /** RegularExpression Id. */
+ int NEGATIVE_PRECONDITIONS = 42;
+ /** RegularExpression Id. */
+ int DISJUNCTIVE_PRECONDITIONS = 43;
+ /** RegularExpression Id. */
+ int EQUALITY = 44;
+ /** RegularExpression Id. */
+ int EXISTENTIAL_PRECONDITIONS = 45;
+ /** RegularExpression Id. */
+ int UNIVERSAL_PRECONDITIONS = 46;
+ /** RegularExpression Id. */
+ int QUANTIFIED_PRECONDITIONS = 47;
+ /** RegularExpression Id. */
+ int CONDITIONAL_EFFECTS = 48;
+ /** RegularExpression Id. */
+ int FLUENTS = 49;
+ /** RegularExpression Id. */
+ int ADL = 50;
+ /** RegularExpression Id. */
+ int DURATIVE_ACTIONS = 51;
+ /** RegularExpression Id. */
+ int DERIVED_PREDICATES = 52;
+ /** RegularExpression Id. */
+ int TIMED_INITIAL_LITERALS = 53;
+ /** RegularExpression Id. */
+ int PREFERENCES = 54;
+ /** RegularExpression Id. */
+ int CONSTRAINTS = 55;
+ /** RegularExpression Id. */
+ int CONTINUS_EFFECTS = 56;
+ /** RegularExpression Id. */
+ int DURATION_INEQUALITIES = 57;
+ /** RegularExpression Id. */
+ int GREATER = 58;
+ /** RegularExpression Id. */
+ int LESS = 59;
+ /** RegularExpression Id. */
+ int GEQUAL = 60;
+ /** RegularExpression Id. */
+ int LEQUAL = 61;
+ /** RegularExpression Id. */
+ int EQUAL = 62;
+ /** RegularExpression Id. */
+ int MUL = 63;
+ /** RegularExpression Id. */
+ int DIV = 64;
+ /** RegularExpression Id. */
+ int ADD = 65;
+ /** RegularExpression Id. */
+ int SUB = 66;
+ /** RegularExpression Id. */
+ int ASSIGN = 67;
+ /** RegularExpression Id. */
+ int SCALE_UP = 68;
+ /** RegularExpression Id. */
+ int SCALE_DOWN = 69;
+ /** RegularExpression Id. */
+ int INCREASE = 70;
+ /** RegularExpression Id. */
+ int DECREASE = 71;
+ /** RegularExpression Id. */
+ int OR = 72;
+ /** RegularExpression Id. */
+ int AND = 73;
+ /** RegularExpression Id. */
+ int IMPLY = 74;
+ /** RegularExpression Id. */
+ int NOT = 75;
+ /** RegularExpression Id. */
+ int FORALL = 76;
+ /** RegularExpression Id. */
+ int EXISTS = 77;
+ /** RegularExpression Id. */
+ int ALWAYS = 78;
+ /** RegularExpression Id. */
+ int SOMETIME = 79;
+ /** RegularExpression Id. */
+ int WITHIN = 80;
+ /** RegularExpression Id. */
+ int AT_MOST_ONCE = 81;
+ /** RegularExpression Id. */
+ int SOMETIME_AFTER = 82;
+ /** RegularExpression Id. */
+ int SOMETIME_BEFORE = 83;
+ /** RegularExpression Id. */
+ int ALWAYS_WITHIN = 84;
+ /** RegularExpression Id. */
+ int HOLD_DURING = 85;
+ /** RegularExpression Id. */
+ int HOLD_AFTER = 86;
+ /** RegularExpression Id. */
+ int AT = 87;
+ /** RegularExpression Id. */
+ int START = 88;
+ /** RegularExpression Id. */
+ int END = 89;
+ /** RegularExpression Id. */
+ int OVER = 90;
+ /** RegularExpression Id. */
+ int ALL = 91;
+ /** RegularExpression Id. */
+ int TOTAL_TIME = 92;
+ /** RegularExpression Id. */
+ int MAXIMIZE = 93;
+ /** RegularExpression Id. */
+ int MINIMIZE = 94;
+ /** RegularExpression Id. */
+ int IS_VIOLATED = 95;
+ /** RegularExpression Id. */
+ int VAR_DURATION = 96;
+ /** RegularExpression Id. */
+ int CONTINOUS_VARIABLE = 97;
+ /** RegularExpression Id. */
+ int NUMBER_TYPE = 98;
+ /** RegularExpression Id. */
+ int OBJECT_TYPE = 99;
+ /** RegularExpression Id. */
+ int SYMBOL = 100;
+ /** RegularExpression Id. */
+ int NUMBER = 101;
+ /** RegularExpression Id. */
+ int DIGIT = 102;
+ /** RegularExpression Id. */
+ int LETTER = 103;
+
+ /** Lexical state. */
+ int DEFAULT = 0;
+ /** Lexical state. */
+ int IN_SINGLE_LINE_COMMENT = 1;
+ /** Lexical state. */
+ int IN_FORMAL_COMMENT = 2;
+ /** Lexical state. */
+ int IN_MULTI_LINE_COMMENT = 3;
+
+ /** Literal token values. */
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\n\"",
+ "\"\\r\"",
+ "\"//\"",
+ "\";\"",
+ "<token of kind 7>",
+ "\"/*\"",
+ "<SINGLE_LINE_COMMENT>",
+ "\"*/\"",
+ "\"*/\"",
+ "<token of kind 12>",
+ "\"(\"",
+ "\")\"",
+ "\"define\"",
+ "\"domain\"",
+ "\":requirements\"",
+ "\":types\"",
+ "\"either\"",
+ "\":constants\"",
+ "\":predicates\"",
+ "\":functions\"",
+ "\":action\"",
+ "\":parameters\"",
+ "\":precondition\"",
+ "\":effect\"",
+ "\"preference\"",
+ "\"when\"",
+ "\"probabilistic\"",
+ "\":durative-action\"",
+ "\":duration\"",
+ "\":condition\"",
+ "\":derived\"",
+ "\"problem\"",
+ "\":domain\"",
+ "\":objects\"",
+ "\":init\"",
+ "\":goal\"",
+ "\":metric\"",
+ "\":strips\"",
+ "\":typing\"",
+ "\":negative-preconditions\"",
+ "\":disjunctive-preconditions\"",
+ "\":equality\"",
+ "\":existential-preconditions\"",
+ "\":universal-preconditions\"",
+ "\":quantified-preconditions\"",
+ "\":conditional-effects\"",
+ "\":fluents\"",
+ "\":adl\"",
+ "\":durative-actions\"",
+ "\":derived-predicates\"",
+ "\":timed-initial-literals\"",
+ "\":preferences\"",
+ "\":constraints\"",
+ "\":continus_effects\"",
+ "\":duration-inequalities\"",
+ "\">\"",
+ "\"<\"",
+ "\">=\"",
+ "\"<=\"",
+ "\"=\"",
+ "\"*\"",
+ "\"/\"",
+ "\"+\"",
+ "\"-\"",
+ "\"assign\"",
+ "\"scale-up\"",
+ "\"scale-down\"",
+ "\"increase\"",
+ "\"decrease\"",
+ "\"or\"",
+ "\"and\"",
+ "\"imply\"",
+ "\"not\"",
+ "\"forall\"",
+ "\"exists\"",
+ "\"always\"",
+ "\"sometime\"",
+ "\"within\"",
+ "\"at-most-once\"",
+ "\"sometime-after\"",
+ "\"sometime-before\"",
+ "\"always-within\"",
+ "\"hold-during\"",
+ "\"hold-after\"",
+ "\"at\"",
+ "\"start\"",
+ "\"end\"",
+ "\"over\"",
+ "\"all\"",
+ "\"total_time\"",
+ "\"maximize\"",
+ "\"minimize\"",
+ "\"is-violated\"",
+ "\"?duration\"",
+ "\"#t\"",
+ "\"number\"",
+ "\"object\"",
+ "<SYMBOL>",
+ "<NUMBER>",
+ "<DIGIT>",
+ "<LETTER>",
+ "\"?\"",
+ };
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java
new file mode 100644
index 00000000000..8c6b22538bd
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTokenManager.java
@@ -0,0 +1,2226 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. LexerTokenManager.java */
+package pddl4j.lexer;
+import java.io.InputStream;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import pddl4j.ErrorManager;
+import pddl4j.ErrorManager.Message;
+
+/** Token Manager. */
+public class LexerTokenManager implements LexerConstants
+{
+
+ /** Debug output. */
+ public java.io.PrintStream debugStream = System.out;
+ /** Set debug output. */
+ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
+{
+ switch (pos)
+ {
+ case 0:
+ if ((active0 & 0x120L) != 0L || (active1 & 0x1L) != 0L)
+ return 2;
+ if ((active0 & 0x438098000L) != 0L || (active1 & 0xefffffff8L) != 0L)
+ {
+ jjmatchedKind = 100;
+ return 5;
+ }
+ if ((active1 & 0x4L) != 0L)
+ return 5;
+ return -1;
+ case 1:
+ if ((active0 & 0x100L) != 0L)
+ return 0;
+ if ((active0 & 0x438098000L) != 0L || (active1 & 0xcff7dfef8L) != 0L)
+ {
+ if (jjmatchedPos != 1)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 1;
+ }
+ return 5;
+ }
+ if ((active1 & 0x200820100L) != 0L)
+ return 5;
+ return -1;
+ case 2:
+ if ((active0 & 0x438098000L) != 0L || (active1 & 0xcf57ff4f8L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 2;
+ return 5;
+ }
+ if ((active1 & 0xa000a00L) != 0L)
+ return 5;
+ return -1;
+ case 3:
+ if ((active0 & 0x428098000L) != 0L || (active1 & 0xcf17ff4f8L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 3;
+ return 5;
+ }
+ if ((active0 & 0x10000000L) != 0L || (active1 & 0x4000000L) != 0L)
+ return 5;
+ return -1;
+ case 4:
+ if ((active0 & 0x428098000L) != 0L || (active1 & 0xcf07ff0f8L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 4;
+ return 5;
+ }
+ if ((active1 & 0x1000400L) != 0L)
+ return 5;
+ return -1;
+ case 5:
+ if ((active0 & 0x428000000L) != 0L || (active1 & 0xf06e80f0L) != 0L)
+ {
+ if (jjmatchedPos != 5)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 5;
+ }
+ return 5;
+ }
+ if ((active0 & 0x98000L) != 0L || (active1 & 0xc00117008L) != 0L)
+ return 5;
+ return -1;
+ case 6:
+ if ((active0 & 0x400000000L) != 0L)
+ return 5;
+ if ((active0 & 0x28000000L) != 0L || (active1 & 0xf07e80f0L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 6;
+ return 5;
+ }
+ return -1;
+ case 7:
+ if ((active1 & 0x600c80d0L) != 0L)
+ return 5;
+ if ((active0 & 0x28000000L) != 0L || (active1 & 0x90720020L) != 0L)
+ {
+ if (jjmatchedPos != 7)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 7;
+ }
+ return 5;
+ }
+ return -1;
+ case 8:
+ if ((active0 & 0x28000000L) != 0L || (active1 & 0x907e0020L) != 0L)
+ {
+ if (jjmatchedPos != 8)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 8;
+ }
+ return 5;
+ }
+ return -1;
+ case 9:
+ if ((active0 & 0x20000000L) != 0L || (active1 & 0x803e0000L) != 0L)
+ {
+ if (jjmatchedPos != 9)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 9;
+ }
+ return 5;
+ }
+ if ((active0 & 0x8000000L) != 0L || (active1 & 0x10400020L) != 0L)
+ return 5;
+ return -1;
+ case 10:
+ if ((active0 & 0x20000000L) != 0L || (active1 & 0x1e0000L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 10;
+ return 5;
+ }
+ if ((active1 & 0x80200000L) != 0L)
+ return 5;
+ return -1;
+ case 11:
+ if ((active0 & 0x20000000L) != 0L || (active1 & 0x1c0000L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 11;
+ return 5;
+ }
+ if ((active1 & 0x20000L) != 0L)
+ return 5;
+ return -1;
+ case 12:
+ if ((active1 & 0xc0000L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 12;
+ return 5;
+ }
+ if ((active0 & 0x20000000L) != 0L || (active1 & 0x100000L) != 0L)
+ return 5;
+ return -1;
+ case 13:
+ if ((active1 & 0x80000L) != 0L)
+ {
+ jjmatchedKind = 100;
+ jjmatchedPos = 13;
+ return 5;
+ }
+ if ((active1 & 0x40000L) != 0L)
+ return 5;
+ return -1;
+ case 14:
+ if ((active1 & 0x80000L) != 0L)
+ return 5;
+ return -1;
+ default :
+ return -1;
+ }
+}
+private final int jjStartNfa_0(int pos, long active0, long active1)
+{
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
+}
+private int jjStopAtPos(int pos, int kind)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+}
+private int jjMoveStringLiteralDfa0_0()
+{
+ switch(curChar)
+ {
+ case 35:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x200000000L);
+ case 40:
+ return jjStopAtPos(0, 13);
+ case 41:
+ return jjStopAtPos(0, 14);
+ case 42:
+ return jjStopAtPos(0, 63);
+ case 43:
+ return jjStopAtPos(0, 65);
+ case 45:
+ return jjStartNfaWithStates_0(0, 66, 5);
+ case 47:
+ jjmatchedKind = 64;
+ return jjMoveStringLiteralDfa1_0(0x120L, 0x0L);
+ case 58:
+ return jjMoveStringLiteralDfa1_0(0x3fffffbc7f60000L, 0x0L);
+ case 59:
+ return jjStopAtPos(0, 6);
+ case 60:
+ jjmatchedKind = 59;
+ return jjMoveStringLiteralDfa1_0(0x2000000000000000L, 0x0L);
+ case 61:
+ return jjStopAtPos(0, 62);
+ case 62:
+ jjmatchedKind = 58;
+ return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L);
+ case 63:
+ jjmatchedKind = 104;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x8924208L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa1_0(0x18000L, 0x80L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0x80000L, 0x2002000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x1000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x600000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x80000440L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x60000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x400000800L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x804000100L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa1_0(0x428000000L, 0x0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x10c8030L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x10000000L);
+ case 87:
+ case 119:
+ return jjMoveStringLiteralDfa1_0(0x10000000L, 0x10000L);
+ default :
+ return jjMoveNfa_0(3, 0);
+ }
+}
+private int jjMoveStringLiteralDfa1_0(long active0, long active1)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0, active1);
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 42:
+ if ((active0 & 0x100L) != 0L)
+ return jjStartNfaWithStates_0(1, 8, 0);
+ break;
+ case 47:
+ if ((active0 & 0x20L) != 0L)
+ return jjStopAtPos(1, 5);
+ break;
+ case 61:
+ if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStopAtPos(1, 60);
+ else if ((active0 & 0x2000000000000000L) != 0L)
+ return jjStopAtPos(1, 61);
+ break;
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000800000L, active1, 0x20000000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x800000000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa2_0(active0, 0x181000100100000L, active1, 0x30L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa2_0(active0, 0x218080ac0000000L, active1, 0x100000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0x300004008000L, active1, 0x80L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000000400000L, active1, 0L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000000L, active1, 0L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa2_0(active0, 0x10000000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2000080000L, active1, 0x40010000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8104000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x400L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0x2000240L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1000010000L, active1, 0x106c9800L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa2_0(active0, 0x40000003200000L, active1, 0L);
+ case 81:
+ case 113:
+ return jjMoveStringLiteralDfa2_0(active0, 0x800000000000L, active1, 0L);
+ case 82:
+ case 114:
+ if ((active1 & 0x100L) != 0L)
+ return jjStartNfaWithStates_0(1, 72, 5);
+ return jjMoveStringLiteralDfa2_0(active0, 0x428020000L, active1, 0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa2_0(active0, 0x10000000000L, active1, 0x80000008L);
+ case 84:
+ case 116:
+ if ((active1 & 0x800000L) != 0L)
+ {
+ jjmatchedKind = 87;
+ jjmatchedPos = 1;
+ }
+ else if ((active1 & 0x200000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 97, 5);
+ return jjMoveStringLiteralDfa2_0(active0, 0x20020000040000L, active1, 0x1020000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000000000L, active1, 0x400000000L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4000000L);
+ case 88:
+ case 120:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(0, active0, active1);
+}
+private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(0, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0, active1);
+ return 2;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x80020000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000L, active1, 0x1000030L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800000L, active1, 0xc0L);
+ case 68:
+ case 100:
+ if ((active1 & 0x200L) != 0L)
+ return jjStartNfaWithStates_0(2, 73, 5);
+ else if ((active1 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 89, 5);
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0x10048218020000L, active1, 0x4000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4008000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20080000000000L, active1, 0x2000L);
+ case 74:
+ case 106:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L);
+ case 76:
+ case 108:
+ if ((active1 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 91, 5);
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000L, active1, 0x600000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa3_0(active0, 0x10000L, active1, 0x4000c8000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0x402000000000L, active1, 0x40000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x181004d20100000L, active1, 0L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x400L);
+ case 81:
+ case 113:
+ return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa3_0(active0, 0x40000002200000L, active1, 0x1000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8L);
+ case 84:
+ case 116:
+ if ((active1 & 0x800L) != 0L)
+ return jjStartNfaWithStates_0(2, 75, 5);
+ return jjMoveStringLiteralDfa3_0(active0, 0x10000080000L, active1, 0x10010000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2088000c0400000L, active1, 0x100000000L);
+ case 87:
+ case 119:
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x104000L);
+ case 88:
+ case 120:
+ return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L, active1, 0x20000000L);
+ case 89:
+ case 121:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000040000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(1, active0, active1);
+}
+private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(1, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0, active1);
+ return 3;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x804000010000L, active1, 0x10105000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x420000000L, active1, 0x400000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x600000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000002200000L, active1, 0x8000c8000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa4_0(active0, 0xc000000L, active1, 0L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L, active1, 0L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000L, active1, 0x10000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active0, 0x602000008000L, active1, 0x60000008L);
+ case 74:
+ case 106:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1000000000L, active1, 0L);
+ case 76:
+ case 108:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return jjStopAtPos(3, 50);
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x430L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000800000000L, active1, 0x20000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 28, 5);
+ return jjMoveStringLiteralDfa4_0(active0, 0x181000100500000L, active1, 0L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000040000L, active1, 0L);
+ case 81:
+ case 113:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000L, active1, 0L);
+ case 82:
+ case 114:
+ if ((active1 & 0x4000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 90, 5);
+ return jjMoveStringLiteralDfa4_0(active0, 0x2180102c1000000L, active1, 0x1010000c0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x2000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000800000L, active1, 0L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa4_0(active0, 0x2100000000000L, active1, 0L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(2, active0, active1);
+}
+private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(2, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0, active1);
+ return 4;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x600000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2081408e1000000L, active1, 0x100000000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2400000L, active1, 0x800000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa5_0(active0, 0x1000100200000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2200100c0c0000L, active1, 0x4000000f0L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L, active1, 0L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10030200810000L, active1, 0x80010000L);
+ case 74:
+ case 106:
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000000000L, active1, 0L);
+ case 76:
+ case 108:
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(4, 38);
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000L, active1, 0x10001000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa5_0(active0, 0x800000008000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x20000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa5_0(active0, 0x8000000000L, active1, 0L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa5_0(active0, 0x80200000100000L, active1, 0L);
+ case 84:
+ case 116:
+ if ((active0 & 0x2000000000L) != 0L)
+ return jjStopAtPos(4, 37);
+ else if ((active1 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 88, 5);
+ return jjMoveStringLiteralDfa5_0(active0, 0x100000000000000L, active1, 0xca000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa5_0(active0, 0x20000L, active1, 0L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa5_0(active0, 0x400000000000L, active1, 0L);
+ case 89:
+ case 121:
+ if ((active1 & 0x400L) != 0L)
+ return jjStartNfaWithStates_0(4, 74, 5);
+ return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x104000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(3, active0, active1);
+}
+private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(3, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0, active1);
+ return 5;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x30L);
+ case 95:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x10000000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000c0L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa6_0(active0, 0x20000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa6_0(active0, 0x1004000000L, active1, 0L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa6_0(active0, 0x20000000000000L, active1, 0x200000L);
+ case 69:
+ case 101:
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(5, 15, 5);
+ return jjMoveStringLiteralDfa6_0(active0, 0x40400400000000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa6_0(active0, 0x101008900220000L, active1, 0x600c8000L);
+ case 76:
+ case 108:
+ if ((active1 & 0x1000L) != 0L)
+ return jjStartNfaWithStates_0(5, 76, 5);
+ return jjMoveStringLiteralDfa6_0(active0, 0x100000000000L, active1, 0L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(5, 16, 5);
+ else if ((active1 & 0x8L) != 0L)
+ return jjStartNfaWithStates_0(5, 67, 5);
+ else if ((active1 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(5, 80, 5);
+ return jjMoveStringLiteralDfa6_0(active0, 0x2020000000000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa6_0(active0, 0x2800000L, active1, 0x80000000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa6_0(active0, 0x10000000000L, active1, 0L);
+ case 82:
+ case 114:
+ if ((active0 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(5, 19, 5);
+ else if ((active1 & 0x400000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 98, 5);
+ return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x40000L) != 0L)
+ return jjStopAtPos(5, 18);
+ else if ((active1 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(5, 77, 5);
+ else if ((active1 & 0x4000L) != 0L)
+ {
+ jjmatchedKind = 78;
+ jjmatchedPos = 5;
+ }
+ return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x120000L);
+ case 84:
+ case 116:
+ if ((active1 & 0x800000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 99, 5);
+ return jjMoveStringLiteralDfa6_0(active0, 0x288a400c0500000L, active1, 0x100000000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa6_0(active0, 0x80000000000L, active1, 0L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa6_0(active0, 0x10000200000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(4, active0, active1);
+}
+private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(4, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0, active1);
+ return 6;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa7_0(active0, 0x20000000000000L, active1, 0x100000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active0, 0x100000L, active1, 0L);
+ case 67:
+ case 99:
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStopAtPos(6, 39);
+ return jjMoveStringLiteralDfa7_0(active0, 0x200000L, active1, 0L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa7_0(active0, 0x10200209000000L, active1, 0L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x400000L);
+ case 71:
+ case 103:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStopAtPos(6, 41);
+ break;
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa7_0(active0, 0x2089400e0400000L, active1, 0x100000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000L);
+ case 77:
+ case 109:
+ if ((active0 & 0x400000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 34, 5);
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0xc8000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x800000L) != 0L)
+ return jjStopAtPos(6, 23);
+ else if ((active0 & 0x800000000L) != 0L)
+ return jjStopAtPos(6, 35);
+ return jjMoveStringLiteralDfa7_0(active0, 0x100080002000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa7_0(active0, 0xc0400000020000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x10000000000L) != 0L)
+ return jjStopAtPos(6, 40);
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0xc0L);
+ case 84:
+ case 116:
+ if ((active0 & 0x4000000L) != 0L)
+ return jjStopAtPos(6, 26);
+ return jjMoveStringLiteralDfa7_0(active0, 0x3001100000000L, active1, 0x10020000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200010L);
+ case 90:
+ case 122:
+ return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x60000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(5, active0, active1);
+}
+private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(5, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0, active1);
+ return 7;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x20000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa8_0(active0, 0x80000000200000L, active1, 0x80000000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa8_0(active0, 0x80000000000L, active1, 0L);
+ case 68:
+ case 100:
+ if ((active0 & 0x200000000L) != 0L)
+ {
+ jjmatchedKind = 33;
+ jjmatchedPos = 7;
+ }
+ return jjMoveStringLiteralDfa8_0(active0, 0x10000002000000L, active1, 0L);
+ case 69:
+ case 101:
+ if ((active1 & 0x40L) != 0L)
+ return jjStartNfaWithStates_0(7, 70, 5);
+ else if ((active1 & 0x80L) != 0L)
+ return jjStartNfaWithStates_0(7, 71, 5);
+ else if ((active1 & 0x8000L) != 0L)
+ {
+ jjmatchedKind = 79;
+ jjmatchedPos = 7;
+ }
+ else if ((active1 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 93, 5);
+ else if ((active1 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 94, 5);
+ return jjMoveStringLiteralDfa8_0(active0, 0x40000000020000L, active1, 0xc0000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa8_0(active0, 0x800000000000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa8_0(active0, 0x21000100000000L, active1, 0x10000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa8_0(active0, 0x20000000L, active1, 0L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa8_0(active0, 0x200008100000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa8_0(active0, 0x200000080400000L, active1, 0x100000020L);
+ case 80:
+ case 112:
+ if ((active1 & 0x10L) != 0L)
+ return jjStartNfaWithStates_0(7, 68, 5);
+ break;
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStopAtPos(7, 36);
+ else if ((active0 & 0x2000000000000L) != 0L)
+ return jjStopAtPos(7, 49);
+ return jjMoveStringLiteralDfa8_0(active0, 0x400000000000L, active1, 0L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa8_0(active0, 0x100001000000L, active1, 0x400000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa8_0(active0, 0x100000000000000L, active1, 0L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa8_0(active0, 0x8040040000000L, active1, 0L);
+ case 87:
+ case 119:
+ return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(6, active0, active1);
+}
+private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(6, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0, active1);
+ return 8;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa9_0(active0, 0x10000000000000L, active1, 0xc0000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa9_0(active0, 0x400000000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa9_0(active0, 0x8000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa9_0(active0, 0x8040041000000L, active1, 0x400000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa9_0(active0, 0x80800022000000L, active1, 0x300000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa9_0(active0, 0x20000L, active1, 0x10000000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x80000000L) != 0L)
+ {
+ jjmatchedKind = 31;
+ jjmatchedPos = 8;
+ }
+ else if ((active1 & 0x100000000L) != 0L)
+ return jjStopAtPos(8, 96);
+ return jjMoveStringLiteralDfa9_0(active0, 0x260000000400000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa9_0(active0, 0x1000100000000L, active1, 0x20000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa9_0(active0, 0x100000000000000L, active1, 0L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa9_0(active0, 0x280000300000L, active1, 0x80000000L);
+ case 87:
+ case 119:
+ return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L);
+ case 89:
+ case 121:
+ if ((active0 & 0x100000000000L) != 0L)
+ return jjStopAtPos(8, 44);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(7, active0, active1);
+}
+private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(7, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0, active1);
+ return 9;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa10_0(active0, 0x208040040000000L, active1, 0L);
+ case 95:
+ return jjMoveStringLiteralDfa10_0(active0, 0x100000000000000L, active1, 0L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x40000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x80000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L, active1, 0L);
+ case 69:
+ case 101:
+ if ((active0 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 27, 5);
+ else if ((active1 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 92, 5);
+ return jjMoveStringLiteralDfa10_0(active0, 0x800000220000L, active1, 0x80000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa10_0(active0, 0x20280000000000L, active1, 0L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa10_0(active0, 0x400000000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x100000000L) != 0L)
+ {
+ jjmatchedKind = 32;
+ jjmatchedPos = 9;
+ }
+ else if ((active1 & 0x20L) != 0L)
+ return jjStartNfaWithStates_0(9, 69, 5);
+ return jjMoveStringLiteralDfa10_0(active0, 0x81000000000000L, active1, 0x220000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa10_0(active0, 0x10000000000000L, active1, 0L);
+ case 82:
+ case 114:
+ if ((active1 & 0x400000L) != 0L)
+ return jjStartNfaWithStates_0(9, 86, 5);
+ return jjMoveStringLiteralDfa10_0(active0, 0x1000000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x100000L) != 0L)
+ return jjStopAtPos(9, 20);
+ else if ((active0 & 0x400000L) != 0L)
+ return jjStopAtPos(9, 22);
+ return jjMoveStringLiteralDfa10_0(active0, 0x20000000L, active1, 0L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa10_0(active0, 0x2000000L, active1, 0x100000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(8, active0, active1);
+}
+private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(8, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, active0, active1);
+ return 10;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa11_0(active0, 0x400000000000L, active1, 0L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa11_0(active0, 0x9200040000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x20000L);
+ case 68:
+ case 100:
+ if ((active1 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(10, 95, 5);
+ return jjMoveStringLiteralDfa11_0(active0, 0x800000000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa11_0(active0, 0x140000000000000L, active1, 0x80000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x40000L);
+ case 71:
+ case 103:
+ if ((active1 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(10, 85, 5);
+ break;
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x100000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa11_0(active0, 0x200000002000000L, active1, 0L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa11_0(active0, 0x20000L, active1, 0L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa11_0(active0, 0x40000000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa11_0(active0, 0x10000000000000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x200000L) != 0L)
+ return jjStopAtPos(10, 21);
+ else if ((active0 & 0x1000000L) != 0L)
+ return jjStopAtPos(10, 24);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa11_0(active0, 0xa0000020000000L, active1, 0L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa11_0(active0, 0x80000000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(9, active0, active1);
+}
+private int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(9, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(10, active0, active1);
+ return 11;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa12_0(active0, 0x800000000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa12_0(active0, 0x8000040000000L, active1, 0L);
+ case 69:
+ case 101:
+ if ((active1 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(11, 81, 5);
+ return jjMoveStringLiteralDfa12_0(active0, 0x10080000000000L, active1, 0L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa12_0(active0, 0x100000000000000L, active1, 0x80000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa12_0(active0, 0x20000020000000L, active1, 0x100000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa12_0(active0, 0x1200000000000L, active1, 0L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa12_0(active0, 0x200000000000000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa12_0(active0, 0x2000000L, active1, 0L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa12_0(active0, 0x400000000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa12_0(active0, 0x40000000000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x40000000000000L) != 0L)
+ return jjStopAtPos(11, 54);
+ else if ((active0 & 0x80000000000000L) != 0L)
+ return jjStopAtPos(11, 55);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa12_0(active0, 0x20000L, active1, 0x40000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(10, active0, active1);
+}
+private int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(10, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(11, active0, active1);
+ return 12;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa13_0(active0, 0x1280000000000L, active1, 0L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa13_0(active0, 0x20000000000000L, active1, 0L);
+ case 67:
+ case 99:
+ if ((active0 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(12, 29, 5);
+ break;
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa13_0(active0, 0x10000000000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa13_0(active0, 0x200040000000000L, active1, 0x40000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa13_0(active0, 0x100000000000000L, active1, 0L);
+ case 78:
+ case 110:
+ if ((active0 & 0x2000000L) != 0L)
+ return jjStopAtPos(12, 25);
+ else if ((active1 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(12, 84, 5);
+ break;
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x80000L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa13_0(active0, 0x800000000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa13_0(active0, 0x400000000000L, active1, 0L);
+ case 83:
+ case 115:
+ if ((active0 & 0x20000L) != 0L)
+ return jjStopAtPos(12, 17);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa13_0(active0, 0x8000040000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(11, active0, active1);
+}
+private int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(11, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(12, active0, active1);
+ return 13;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa14_0(active0, 0x40000000000L, active1, 0L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa14_0(active0, 0x101400000000000L, active1, 0L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa14_0(active0, 0x18000040000000L, active1, 0L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa14_0(active0, 0x20000000000000L, active1, 0L);
+ case 80:
+ case 112:
+ return jjMoveStringLiteralDfa14_0(active0, 0x280000000000L, active1, 0L);
+ case 81:
+ case 113:
+ return jjMoveStringLiteralDfa14_0(active0, 0x200000000000000L, active1, 0L);
+ case 82:
+ case 114:
+ if ((active1 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(13, 82, 5);
+ return jjMoveStringLiteralDfa14_0(active0, 0x800000000000L, active1, 0x80000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(12, active0, active1);
+}
+private int jjMoveStringLiteralDfa14_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(12, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(13, active0, active1);
+ return 14;
+ }
+ switch(curChar)
+ {
+ case 45:
+ return jjMoveStringLiteralDfa15_0(active0, 0x20000000000000L, active1, 0L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa15_0(active0, 0x110400000000000L, active1, 0L);
+ case 69:
+ case 101:
+ if ((active1 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(14, 83, 5);
+ return jjMoveStringLiteralDfa15_0(active0, 0x800000000000L, active1, 0L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa15_0(active0, 0x1000000000000L, active1, 0L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa15_0(active0, 0x8040040000000L, active1, 0L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa15_0(active0, 0x280000000000L, active1, 0L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa15_0(active0, 0x200000000000000L, active1, 0L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(13, active0, active1);
+}
+private int jjMoveStringLiteralDfa15_0(long old0, long active0, long old1, long active1)
+{
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(13, old0, old1);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(14, active0, 0L);
+ return 15;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa16_0(active0, 0x210000000000000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa16_0(active0, 0x800000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa16_0(active0, 0x280000000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa16_0(active0, 0x1000000000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa16_0(active0, 0x20000000000000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x40000000L) != 0L)
+ {
+ jjmatchedKind = 30;
+ jjmatchedPos = 15;
+ }
+ return jjMoveStringLiteralDfa16_0(active0, 0x8040000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa16_0(active0, 0x400000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa16_0(active0, 0x100000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(14, active0, 0L);
+}
+private int jjMoveStringLiteralDfa16_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(14, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(15, active0, 0L);
+ return 16;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa17_0(active0, 0x280000000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa17_0(active0, 0x40000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa17_0(active0, 0x1000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa17_0(active0, 0x20000000000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa17_0(active0, 0x200000000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa17_0(active0, 0x400000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa17_0(active0, 0x800000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStopAtPos(16, 51);
+ else if ((active0 & 0x100000000000000L) != 0L)
+ return jjStopAtPos(16, 56);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa17_0(active0, 0x10000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(15, active0, 0L);
+}
+private int jjMoveStringLiteralDfa17_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(15, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(16, active0, 0L);
+ return 17;
+ }
+ switch(curChar)
+ {
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa18_0(active0, 0x1000000000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa18_0(active0, 0x400000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa18_0(active0, 0x10000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa18_0(active0, 0x200040000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa18_0(active0, 0x800000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa18_0(active0, 0x280000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa18_0(active0, 0x20000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(16, active0, 0L);
+}
+private int jjMoveStringLiteralDfa18_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(16, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(17, active0, 0L);
+ return 18;
+ }
+ switch(curChar)
+ {
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa19_0(active0, 0x800000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa19_0(active0, 0x20000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa19_0(active0, 0x400000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa19_0(active0, 0x280000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x10000000000000L) != 0L)
+ return jjStopAtPos(18, 52);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa19_0(active0, 0x201040000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(17, active0, 0L);
+}
+private int jjMoveStringLiteralDfa19_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(17, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(18, active0, 0L);
+ return 19;
+ }
+ switch(curChar)
+ {
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa20_0(active0, 0x280000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa20_0(active0, 0x200840000000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa20_0(active0, 0x20000000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x1000000000000L) != 0L)
+ return jjStopAtPos(19, 48);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa20_0(active0, 0x400000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(18, active0, 0L);
+}
+private int jjMoveStringLiteralDfa20_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(18, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(19, active0, 0L);
+ return 20;
+ }
+ switch(curChar)
+ {
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa21_0(active0, 0x20000000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa21_0(active0, 0x200000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa21_0(active0, 0x680000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa21_0(active0, 0x40000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa21_0(active0, 0x800000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(19, active0, 0L);
+}
+private int jjMoveStringLiteralDfa21_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(19, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(20, active0, 0L);
+ return 21;
+ }
+ switch(curChar)
+ {
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa22_0(active0, 0x800000000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa22_0(active0, 0x20000000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa22_0(active0, 0x40000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa22_0(active0, 0x400000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x200000000000000L) != 0L)
+ return jjStopAtPos(21, 57);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa22_0(active0, 0x280000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(20, active0, 0L);
+}
+private int jjMoveStringLiteralDfa22_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(20, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(21, active0, 0L);
+ return 22;
+ }
+ switch(curChar)
+ {
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa23_0(active0, 0x280000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa23_0(active0, 0x400000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa23_0(active0, 0x800000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x40000000000L) != 0L)
+ return jjStopAtPos(22, 42);
+ else if ((active0 & 0x20000000000000L) != 0L)
+ return jjStopAtPos(22, 53);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(21, active0, 0L);
+}
+private int jjMoveStringLiteralDfa23_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(21, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(22, active0, 0L);
+ return 23;
+ }
+ switch(curChar)
+ {
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa24_0(active0, 0x800000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa24_0(active0, 0x280000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x400000000000L) != 0L)
+ return jjStopAtPos(23, 46);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(22, active0, 0L);
+}
+private int jjMoveStringLiteralDfa24_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(22, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(23, active0, 0L);
+ return 24;
+ }
+ switch(curChar)
+ {
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa25_0(active0, 0x280000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x800000000000L) != 0L)
+ return jjStopAtPos(24, 47);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(23, active0, 0L);
+}
+private int jjMoveStringLiteralDfa25_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(23, old0, 0L);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(24, active0, 0L);
+ return 25;
+ }
+ switch(curChar)
+ {
+ case 83:
+ case 115:
+ if ((active0 & 0x80000000000L) != 0L)
+ return jjStopAtPos(25, 43);
+ else if ((active0 & 0x200000000000L) != 0L)
+ return jjStopAtPos(25, 45);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(24, active0, 0L);
+}
+private int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return pos + 1; }
+ return jjMoveNfa_0(state, pos + 1);
+}
+static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private int jjMoveNfa_0(int startState, int curPos)
+{
+ int startsAt = 0;
+ jjnewStateCnt = 9;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 3:
+ if ((0x3ff000000000000L & l) != 0L)
+ {
+ if (kind > 101)
+ kind = 101;
+ jjCheckNAddTwoStates(6, 7);
+ }
+ else if ((0x200800000000L & l) != 0L)
+ {
+ if (kind > 100)
+ kind = 100;
+ jjCheckNAdd(5);
+ }
+ else if (curChar == 47)
+ jjstateSet[jjnewStateCnt++] = 2;
+ break;
+ case 0:
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 1:
+ if ((0xffff7fffffffffffL & l) != 0L && kind > 7)
+ kind = 7;
+ break;
+ case 2:
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 0;
+ break;
+ case 4:
+ if ((0x200800000000L & l) == 0L)
+ break;
+ if (kind > 100)
+ kind = 100;
+ jjCheckNAdd(5);
+ break;
+ case 5:
+ if ((0x3ff200800000000L & l) == 0L)
+ break;
+ if (kind > 100)
+ kind = 100;
+ jjCheckNAdd(5);
+ break;
+ case 6:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 101)
+ kind = 101;
+ jjCheckNAddTwoStates(6, 7);
+ break;
+ case 7:
+ if (curChar != 46)
+ break;
+ if (kind > 101)
+ kind = 101;
+ jjCheckNAdd(8);
+ break;
+ case 8:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 101)
+ kind = 101;
+ jjCheckNAdd(8);
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 3:
+ case 5:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 100)
+ kind = 100;
+ jjCheckNAdd(5);
+ break;
+ case 1:
+ if (kind > 7)
+ kind = 7;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 1:
+ if ((jjbitVec0[i2] & l2) != 0L && kind > 7)
+ kind = 7;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 9 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private int jjMoveStringLiteralDfa0_3()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_3(0x800L);
+ default :
+ return 1;
+ }
+}
+private int jjMoveStringLiteralDfa1_3(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x800L) != 0L)
+ return jjStopAtPos(1, 11);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+private int jjMoveStringLiteralDfa0_1()
+{
+ return jjMoveNfa_1(0, 0);
+}
+private int jjMoveNfa_1(int startState, int curPos)
+{
+ int startsAt = 0;
+ jjnewStateCnt = 3;
+ int i = 1;
+ jjstateSet[0] = startState;
+ int kind = 0x7fffffff;
+ for (;;)
+ {
+ if (++jjround == 0x7fffffff)
+ ReInitRounds();
+ if (curChar < 64)
+ {
+ long l = 1L << curChar;
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ case 0:
+ if ((0x2400L & l) != 0L)
+ {
+ if (kind > 9)
+ kind = 9;
+ }
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ case 1:
+ if (curChar == 10 && kind > 9)
+ kind = 9;
+ break;
+ case 2:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 1;
+ break;
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else if (curChar < 128)
+ {
+ long l = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ else
+ {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ do
+ {
+ switch(jjstateSet[--i])
+ {
+ default : break;
+ }
+ } while(i != startsAt);
+ }
+ if (kind != 0x7fffffff)
+ {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) { return curPos; }
+ }
+}
+private int jjMoveStringLiteralDfa0_2()
+{
+ switch(curChar)
+ {
+ case 42:
+ return jjMoveStringLiteralDfa1_2(0x400L);
+ default :
+ return 1;
+ }
+}
+private int jjMoveStringLiteralDfa1_2(long active0)
+{
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ return 1;
+ }
+ switch(curChar)
+ {
+ case 47:
+ if ((active0 & 0x400L) != 0L)
+ return jjStopAtPos(1, 10);
+ break;
+ default :
+ return 2;
+ }
+ return 2;
+}
+static final int[] jjnextStates = {
+};
+
+/** Token literal values. */
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, null, null, null,
+"\50", "\51", null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, "\76", "\74", "\76\75", "\74\75", "\75", "\52", "\57", "\53",
+"\55", null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, "\77", };
+
+/** Lexer state names. */
+public static final String[] lexStateNames = {
+ "DEFAULT",
+ "IN_SINGLE_LINE_COMMENT",
+ "IN_FORMAL_COMMENT",
+ "IN_MULTI_LINE_COMMENT",
+};
+
+/** Lex State array. */
+public static final int[] jjnewLexState = {
+ -1, -1, -1, -1, -1, 1, 1, 2, 3, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1,
+};
+static final long[] jjtoToken = {
+ 0xffffffffffffe001L, 0x13fffffffffL,
+};
+static final long[] jjtoSkip = {
+ 0xe1eL, 0x0L,
+};
+static final long[] jjtoSpecial = {
+ 0xe00L, 0x0L,
+};
+static final long[] jjtoMore = {
+ 0x11e0L, 0x0L,
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[9];
+private final int[] jjstateSet = new int[18];
+private final StringBuffer jjimage = new StringBuffer();
+private StringBuffer image = jjimage;
+private int jjimageLen;
+private int lengthOfMatch;
+protected char curChar;
+/** Constructor. */
+public LexerTokenManager(SimpleCharStream stream){
+ if (SimpleCharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+}
+
+/** Constructor. */
+public LexerTokenManager(SimpleCharStream stream, int lexState){
+ this(stream);
+ SwitchTo(lexState);
+}
+
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream)
+{
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+}
+private void ReInitRounds()
+{
+ int i;
+ jjround = 0x80000001;
+ for (i = 9; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+}
+
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+ ReInit(stream);
+ SwitchTo(lexState);
+}
+
+/** Switch to specified lex state. */
+public void SwitchTo(int lexState)
+{
+ if (lexState >= 4 || lexState < 0)
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+ else
+ curLexState = lexState;
+}
+
+protected Token jjFillToken()
+{
+ final Token t;
+ final String curTokenImage;
+ final int beginLine;
+ final int endLine;
+ final int beginColumn;
+ final int endColumn;
+ String im = jjstrLiteralImages[jjmatchedKind];
+ curTokenImage = (im == null) ? input_stream.GetImage() : im;
+ beginLine = input_stream.getBeginLine();
+ beginColumn = input_stream.getBeginColumn();
+ endLine = input_stream.getEndLine();
+ endColumn = input_stream.getEndColumn();
+ t = Token.newToken(jjmatchedKind, curTokenImage);
+
+ t.beginLine = beginLine;
+ t.endLine = endLine;
+ t.beginColumn = beginColumn;
+ t.endColumn = endColumn;
+
+ return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+/** Get the next Token. */
+public Token getNextToken()
+{
+ Token specialToken = null;
+ Token matchedToken;
+ int curPos = 0;
+
+ EOFLoop :
+ for (;;)
+ {
+ try
+ {
+ curChar = input_stream.BeginToken();
+ }
+ catch(java.io.IOException e)
+ {
+ jjmatchedKind = 0;
+ matchedToken = jjFillToken();
+ matchedToken.specialToken = specialToken;
+ return matchedToken;
+ }
+ image = jjimage;
+ image.setLength(0);
+ jjimageLen = 0;
+
+ for (;;)
+ {
+ switch(curLexState)
+ {
+ case 0:
+ try { input_stream.backup(0);
+ while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) { continue EOFLoop; }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ break;
+ case 1:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ if (jjmatchedPos == 0 && jjmatchedKind > 12)
+ {
+ jjmatchedKind = 12;
+ }
+ break;
+ case 2:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_2();
+ if (jjmatchedPos == 0 && jjmatchedKind > 12)
+ {
+ jjmatchedKind = 12;
+ }
+ break;
+ case 3:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_3();
+ if (jjmatchedPos == 0 && jjmatchedKind > 12)
+ {
+ jjmatchedKind = 12;
+ }
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff)
+ {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ matchedToken.specialToken = specialToken;
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ }
+ else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+ {
+ matchedToken = jjFillToken();
+ if (specialToken == null)
+ specialToken = matchedToken;
+ else
+ {
+ matchedToken.specialToken = specialToken;
+ specialToken = (specialToken.next = matchedToken);
+ }
+ SkipLexicalActions(matchedToken);
+ }
+ else
+ SkipLexicalActions(null);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ MoreLexicalActions();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ curPos = 0;
+ jjmatchedKind = 0x7fffffff;
+ try {
+ curChar = input_stream.readChar();
+ continue;
+ }
+ catch (java.io.IOException e1) { }
+ }
+ int error_line = input_stream.getEndLine();
+ int error_column = input_stream.getEndColumn();
+ String error_after = null;
+ boolean EOFSeen = false;
+ try { input_stream.readChar(); input_stream.backup(1); }
+ catch (java.io.IOException e1) {
+ EOFSeen = true;
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ if (curChar == '\n' || curChar == '\r') {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ if (!EOFSeen) {
+ input_stream.backup(1);
+ error_after = curPos <= 1 ? "" : input_stream.GetImage();
+ }
+ throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+ }
+ }
+}
+
+void SkipLexicalActions(Token matchedToken)
+{
+ switch(jjmatchedKind)
+ {
+ default :
+ break;
+ }
+}
+void MoreLexicalActions()
+{
+ jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
+ switch(jjmatchedKind)
+ {
+ case 7 :
+ image.append(input_stream.GetSuffix(jjimageLen));
+ jjimageLen = 0;
+ input_stream.backup(1);
+ break;
+ default :
+ break;
+ }
+}
+private void jjCheckNAdd(int state)
+{
+ if (jjrounds[state] != jjround)
+ {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+}
+private void jjAddStates(int start, int end)
+{
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+}
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java
new file mode 100644
index 00000000000..ccd0adb3aed
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/LexerTreeConstants.java
@@ -0,0 +1,357 @@
+/* Generated By:JavaCC: Do not edit this line. LexerTreeConstants.java Version 4.1d1 */
+package pddl4j.lexer;
+
+public interface LexerTreeConstants
+{
+ public int JJTROOT = 0;
+ public int JJTDOMAIN = 1;
+ public int JJTREQUIRE_DEF = 2;
+ public int JJTREQUIRE_KEY = 3;
+ public int JJTTYPE_DEF = 4;
+ public int JJTTYPED_LIST = 5;
+ public int JJTTYPE = 6;
+ public int JJTPRIMITIVE_TYPE = 7;
+ public int JJTCONSTANT_DEF = 8;
+ public int JJTCONSTANT = 9;
+ public int JJTPREDICATE_DEF = 10;
+ public int JJTATOMIC_FORMULA_SKELETON = 11;
+ public int JJTPREDICATE = 12;
+ public int JJTVARIABLE = 13;
+ public int JJTFUNCTION_DEF = 14;
+ public int JJTATOMIC_FUNCTION_SKELETON = 15;
+ public int JJTFUNCTOR = 16;
+ public int JJTFUNCTION_TYPED_LIST = 17;
+ public int JJTFUNCTION_TYPE = 18;
+ public int JJTCON_GD = 19;
+ public int JJTAND_CON_GD = 20;
+ public int JJTFORALL_CON_GD = 21;
+ public int JJTAT_END_CON_GD = 22;
+ public int JJTALWAYS_CON_GD = 23;
+ public int JJTSOMETIME_CON_GD = 24;
+ public int JJTWITHIN_CON_GD = 25;
+ public int JJTAT_MOST_ONCE_CON_GD = 26;
+ public int JJTSOMETIME_AFTER_CON_GD = 27;
+ public int JJTSOMETIME_BEFORE_CON_GD = 28;
+ public int JJTALWAYS_WITHIN_CON_GD = 29;
+ public int JJTHOLD_DURING_CON_GD = 30;
+ public int JJTHOLD_AFTER_CON_GD = 31;
+ public int JJTGD = 32;
+ public int JJTAND_GD = 33;
+ public int JJTOR_GD = 34;
+ public int JJTNOT_GD = 35;
+ public int JJTIMPLY_GD = 36;
+ public int JJTEXISTS_GD = 37;
+ public int JJTFORALL_GD = 38;
+ public int JJTATOMIC_FORMULA = 39;
+ public int JJTTERM = 40;
+ public int JJTLITERAL = 41;
+ public int JJTNOT_ATOMIC_FORMULA = 42;
+ public int JJTF_COMP = 43;
+ public int JJTBINARY_COMP = 44;
+ public int JJTGREATER_COMP = 45;
+ public int JJTGREATER_EQUAL_COMP = 46;
+ public int JJTLESS_EQUAL_COMP = 47;
+ public int JJTLESS_COMP = 48;
+ public int JJTEQUAL_COMP = 49;
+ public int JJTF_EXP = 50;
+ public int JJTNUMBER = 51;
+ public int JJTOP = 52;
+ public int JJTBINARY_OPERATION = 53;
+ public int JJTADD_OP = 54;
+ public int JJTSUBSTRACT_OP = 55;
+ public int JJTMULTIPLY_OP = 56;
+ public int JJTDIVIDE_OP = 57;
+ public int JJTUNARY_OP = 58;
+ public int JJTF_HEAD = 59;
+ public int JJTSTRUCTURE_DEF = 60;
+ public int JJTACTION_DEF = 61;
+ public int JJTACTION_NAME = 62;
+ public int JJTACTION_DEF_BODY = 63;
+ public int JJTPRE_GD = 64;
+ public int JJTEMPTY_OR = 65;
+ public int JJTAND_PRE_GD = 66;
+ public int JJTFORALL_PRE_GD = 67;
+ public int JJTPREF_GD = 68;
+ public int JJTNAMED_PREF_GD = 69;
+ public int JJTPREF_NAME = 70;
+ public int JJTEFFECT = 71;
+ public int JJTAND_C_EFFECT = 72;
+ public int JJTPROB_EFFECT = 73;
+ public int JJTPROB_TERM = 74;
+ public int JJTC_EFFECT = 75;
+ public int JJTFORALL_EFFECT = 76;
+ public int JJTWHEN_CON_EFFECT = 77;
+ public int JJTCOND_EFFECT = 78;
+ public int JJTAND_P_EFFECT = 79;
+ public int JJTP_EFFECT = 80;
+ public int JJTASSIGN_OP = 81;
+ public int JJTASSIGN = 82;
+ public int JJTSCALE_UP = 83;
+ public int JJTSCALE_DOWN = 84;
+ public int JJTINCREASE = 85;
+ public int JJTDECREASE = 86;
+ public int JJTDURATION_ACTION_DEF = 87;
+ public int JJTDA_SYMBOL = 88;
+ public int JJTDA_DEF_BODY = 89;
+ public int JJTDURATION_CONSTRAINT = 90;
+ public int JJTAND_SIMPLE_DURATION_CONSTRAINT = 91;
+ public int JJTSIMPLE_DURATION_CONSTRAINT = 92;
+ public int JJTAT_SIMPLE_DURATION_CONSTRAINT = 93;
+ public int JJTAT_START_SIMPLE_DURATION_CONSTRAINT = 94;
+ public int JJTAT_END_SIMPLE_DURATION_CONSTRAINT = 95;
+ public int JJTD_OP = 96;
+ public int JJTEQUAL_D_OP = 97;
+ public int JJTGEQUAL_D_OP = 98;
+ public int JJTLEQUAL_D_OP = 99;
+ public int JJTVAR_DURATION = 100;
+ public int JJTD_VALUE = 101;
+ public int JJTDA_GD = 102;
+ public int JJTFORALL_DA_GD = 103;
+ public int JJTAND_DA_GD = 104;
+ public int JJTPREF_TIMED_GD = 105;
+ public int JJTNAMED_PREF_TIMED_GD = 106;
+ public int JJTTIMED_GD = 107;
+ public int JJTOVER_TIMED_GD = 108;
+ public int JJTOVER_ALL_TIMED_GD = 109;
+ public int JJTAT_TIMED_GD = 110;
+ public int JJTAT_START_TIMED_GD = 111;
+ public int JJTAT_END_TIMED_GD = 112;
+ public int JJTINTERVAL = 113;
+ public int JJTDA_EFFECT = 114;
+ public int JJTDA_ASSIGN_OP = 115;
+ public int JJTDA_ASSIGN = 116;
+ public int JJTDA_SCALE_UP = 117;
+ public int JJTDA_SCALE_DOWN = 118;
+ public int JJTDA_INCREASE = 119;
+ public int JJTDA_DECREASE = 120;
+ public int JJTWHEN_DA_EFFECT = 121;
+ public int JJTFORALL_DA_EFFECT = 122;
+ public int JJTAND_DA_EFFECT = 123;
+ public int JJTTIMED_EFFECT = 124;
+ public int JJTAT_F_ASSIGN_DA_EFFECT = 125;
+ public int JJTAT_START_F_ASSIGN_DA_EFFECT = 126;
+ public int JJTAT_END_F_ASSIGN_DA_EFFECT = 127;
+ public int JJTAT_DA_EFFECT = 128;
+ public int JJTAT_START_DA_EFFECT = 129;
+ public int JJTAT_END_DA_EFFECT = 130;
+ public int JJTASSIGN_OP_T = 131;
+ public int JJTINCREASE_ASSIGN_OP_T = 132;
+ public int JJTDECREASE_ASSIGN_OP_T = 133;
+ public int JJTF_EXP_T = 134;
+ public int JJTCONTINOUS_VARIABLE = 135;
+ public int JJTF_ASSIGN_DA = 136;
+ public int JJTF_EXP_DA = 137;
+ public int JJTDA_BINARY_OP = 138;
+ public int JJTDA_ADD_OP = 139;
+ public int JJTDA_SUBSTRACT_OP = 140;
+ public int JJTDA_MULTIPLY_OP = 141;
+ public int JJTDA_DIVIDE_OP = 142;
+ public int JJTDA_UNARY_OP = 143;
+ public int JJTDERIVED_DEF = 144;
+ public int JJTPROBLEM = 145;
+ public int JJTPROBLEM_NAME = 146;
+ public int JJTDOMAIN_NAME = 147;
+ public int JJTOBJECT_DECLARATION = 148;
+ public int JJTINIT = 149;
+ public int JJTINIT_EL = 150;
+ public int JJTEQUAL_INIT_EL = 151;
+ public int JJTTIMED_LITERAL = 152;
+ public int JJTGOAL = 153;
+ public int JJTCONSTRAINTS = 154;
+ public int JJTPREF_CON_GD = 155;
+ public int JJTAND_PREF_CON_GD = 156;
+ public int JJTNAMED_PREF_CON_GD = 157;
+ public int JJTFORALL_PREF_CON_GD = 158;
+ public int JJTMETRIC_SPEC = 159;
+ public int JJTMAXIMIZE = 160;
+ public int JJTMINIMIZE = 161;
+ public int JJTMETRIC_F_EXP = 162;
+ public int JJTVIOLATED_PREF_EXP = 163;
+ public int JJTCONSTANT_F_HEAD = 164;
+ public int JJTTOTAL_TIME = 165;
+ public int JJTBINARY_OP_METRIC_F_EXP = 166;
+ public int JJTADD_OP_METRIC_F_EXP = 167;
+ public int JJTSUBSTRACT_OP_METRIC_F_EXP = 168;
+ public int JJTMULTI_OP_METRIC_F_EXP = 169;
+ public int JJTMULTIPLY_NARITY_OP_METRIC_F_EXP = 170;
+ public int JJTADD_NARITY_OP_METRIC_F_EXP = 171;
+ public int JJTUNARY_OP_METRIC_F_EXP = 172;
+
+
+ public String[] jjtNodeName = {
+ "ROOT",
+ "DOMAIN",
+ "REQUIRE_DEF",
+ "REQUIRE_KEY",
+ "TYPE_DEF",
+ "TYPED_LIST",
+ "TYPE",
+ "PRIMITIVE_TYPE",
+ "CONSTANT_DEF",
+ "CONSTANT",
+ "PREDICATE_DEF",
+ "ATOMIC_FORMULA_SKELETON",
+ "PREDICATE",
+ "VARIABLE",
+ "FUNCTION_DEF",
+ "ATOMIC_FUNCTION_SKELETON",
+ "FUNCTOR",
+ "FUNCTION_TYPED_LIST",
+ "FUNCTION_TYPE",
+ "CON_GD",
+ "AND_CON_GD",
+ "FORALL_CON_GD",
+ "AT_END_CON_GD",
+ "ALWAYS_CON_GD",
+ "SOMETIME_CON_GD",
+ "WITHIN_CON_GD",
+ "AT_MOST_ONCE_CON_GD",
+ "SOMETIME_AFTER_CON_GD",
+ "SOMETIME_BEFORE_CON_GD",
+ "ALWAYS_WITHIN_CON_GD",
+ "HOLD_DURING_CON_GD",
+ "HOLD_AFTER_CON_GD",
+ "GD",
+ "AND_GD",
+ "OR_GD",
+ "NOT_GD",
+ "IMPLY_GD",
+ "EXISTS_GD",
+ "FORALL_GD",
+ "ATOMIC_FORMULA",
+ "TERM",
+ "LITERAL",
+ "NOT_ATOMIC_FORMULA",
+ "F_COMP",
+ "BINARY_COMP",
+ "GREATER_COMP",
+ "GREATER_EQUAL_COMP",
+ "LESS_EQUAL_COMP",
+ "LESS_COMP",
+ "EQUAL_COMP",
+ "F_EXP",
+ "NUMBER",
+ "OP",
+ "BINARY_OPERATION",
+ "ADD_OP",
+ "SUBSTRACT_OP",
+ "MULTIPLY_OP",
+ "DIVIDE_OP",
+ "UNARY_OP",
+ "F_HEAD",
+ "STRUCTURE_DEF",
+ "ACTION_DEF",
+ "ACTION_NAME",
+ "ACTION_DEF_BODY",
+ "PRE_GD",
+ "EMPTY_OR",
+ "AND_PRE_GD",
+ "FORALL_PRE_GD",
+ "PREF_GD",
+ "NAMED_PREF_GD",
+ "PREF_NAME",
+ "EFFECT",
+ "AND_C_EFFECT",
+ "PROB_EFFECT",
+ "PROB_TERM",
+ "C_EFFECT",
+ "FORALL_EFFECT",
+ "WHEN_CON_EFFECT",
+ "COND_EFFECT",
+ "AND_P_EFFECT",
+ "P_EFFECT",
+ "ASSIGN_OP",
+ "ASSIGN",
+ "SCALE_UP",
+ "SCALE_DOWN",
+ "INCREASE",
+ "DECREASE",
+ "DURATION_ACTION_DEF",
+ "DA_SYMBOL",
+ "DA_DEF_BODY",
+ "DURATION_CONSTRAINT",
+ "AND_SIMPLE_DURATION_CONSTRAINT",
+ "SIMPLE_DURATION_CONSTRAINT",
+ "AT_SIMPLE_DURATION_CONSTRAINT",
+ "AT_START_SIMPLE_DURATION_CONSTRAINT",
+ "AT_END_SIMPLE_DURATION_CONSTRAINT",
+ "D_OP",
+ "EQUAL_D_OP",
+ "GEQUAL_D_OP",
+ "LEQUAL_D_OP",
+ "VAR_DURATION",
+ "D_VALUE",
+ "DA_GD",
+ "FORALL_DA_GD",
+ "AND_DA_GD",
+ "PREF_TIMED_GD",
+ "NAMED_PREF_TIMED_GD",
+ "TIMED_GD",
+ "OVER_TIMED_GD",
+ "OVER_ALL_TIMED_GD",
+ "AT_TIMED_GD",
+ "AT_START_TIMED_GD",
+ "AT_END_TIMED_GD",
+ "INTERVAL",
+ "DA_EFFECT",
+ "DA_ASSIGN_OP",
+ "DA_ASSIGN",
+ "DA_SCALE_UP",
+ "DA_SCALE_DOWN",
+ "DA_INCREASE",
+ "DA_DECREASE",
+ "WHEN_DA_EFFECT",
+ "FORALL_DA_EFFECT",
+ "AND_DA_EFFECT",
+ "TIMED_EFFECT",
+ "AT_F_ASSIGN_DA_EFFECT",
+ "AT_START_F_ASSIGN_DA_EFFECT",
+ "AT_END_F_ASSIGN_DA_EFFECT",
+ "AT_DA_EFFECT",
+ "AT_START_DA_EFFECT",
+ "AT_END_DA_EFFECT",
+ "ASSIGN_OP_T",
+ "INCREASE_ASSIGN_OP_T",
+ "DECREASE_ASSIGN_OP_T",
+ "F_EXP_T",
+ "CONTINOUS_VARIABLE",
+ "F_ASSIGN_DA",
+ "F_EXP_DA",
+ "DA_BINARY_OP",
+ "DA_ADD_OP",
+ "DA_SUBSTRACT_OP",
+ "DA_MULTIPLY_OP",
+ "DA_DIVIDE_OP",
+ "DA_UNARY_OP",
+ "DERIVED_DEF",
+ "PROBLEM",
+ "PROBLEM_NAME",
+ "DOMAIN_NAME",
+ "OBJECT_DECLARATION",
+ "INIT",
+ "INIT_EL",
+ "EQUAL_INIT_EL",
+ "TIMED_LITERAL",
+ "GOAL",
+ "CONSTRAINTS",
+ "PREF_CON_GD",
+ "AND_PREF_CON_GD",
+ "NAMED_PREF_CON_GD",
+ "FORALL_PREF_CON_GD",
+ "METRIC_SPEC",
+ "MAXIMIZE",
+ "MINIMIZE",
+ "METRIC_F_EXP",
+ "VIOLATED_PREF_EXP",
+ "CONSTANT_F_HEAD",
+ "TOTAL_TIME",
+ "BINARY_OP_METRIC_F_EXP",
+ "ADD_OP_METRIC_F_EXP",
+ "SUBSTRACT_OP_METRIC_F_EXP",
+ "MULTI_OP_METRIC_F_EXP",
+ "MULTIPLY_NARITY_OP_METRIC_F_EXP",
+ "ADD_NARITY_OP_METRIC_F_EXP",
+ "UNARY_OP_METRIC_F_EXP",
+ };
+}
+/* JavaCC - OriginalChecksum=63543501f658814e66383e38e8200929 (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java
new file mode 100644
index 00000000000..9413085ed9d
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Node.java
@@ -0,0 +1,34 @@
+/* Generated By:JJTree: Do not edit this line. Node.java */
+
+package pddl4j.lexer;
+
+/* All AST nodes must implement this interface. It provides basic
+ machinery for constructing the parent and child relationships
+ between nodes. */
+
+public interface Node {
+
+ /** This method is called after the node has been made the current
+ node. It indicates that child nodes can now be added to it. */
+ public void jjtOpen();
+
+ /** This method is called after all the child nodes have been
+ added. */
+ public void jjtClose();
+
+ /** This pair of methods are used to inform the node of its
+ parent. */
+ public void jjtSetParent(Node n);
+ public Node jjtGetParent();
+
+ /** This method tells the node to add its argument to the node's
+ list of children. */
+ public void jjtAddChild(Node n, int i);
+
+ /** This method returns a child node. The children are numbered
+ from zero, left to right. */
+ public Node jjtGetChild(int i);
+
+ /** Return the number of children the node has. */
+ public int jjtGetNumChildren();
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java
new file mode 100644
index 00000000000..0221597c168
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/ParseException.java
@@ -0,0 +1,198 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 */
+/* JavaCCOptions:KEEP_LINE_COL=null */
+package pddl4j.lexer;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+ /**
+ * This constructor is used by the method "generateParseException"
+ * in the generated parser. Calling this constructor generates
+ * a new object of this type with the fields "currentToken",
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException: <result of getMessage>
+ */
+ public ParseException(Token currentTokenVal,
+ int[][] expectedTokenSequencesVal,
+ String[] tokenImageVal
+ )
+ {
+ super("");
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /**
+ * The following constructors are for use by you for whatever
+ * purpose you can think of. Constructing the exception in this
+ * manner makes the exception behave in the normal way - i.e., as
+ * documented in the class "Throwable". The fields "errorToken",
+ * "expectedTokenSequences", and "tokenImage" do not contain
+ * relevant information. The JavaCC generated code does not use
+ * these constructors.
+ */
+
+ public ParseException() {
+ super();
+ specialConstructor = false;
+ }
+
+ /** Constructor with message. */
+ public ParseException(String message) {
+ super(message);
+ specialConstructor = false;
+ }
+
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
+
+ /**
+ * This is the last token that has been consumed successfully. If
+ * this object has been created due to a parse error, the token
+ * followng this token will (therefore) be the first error token.
+ */
+ public Token currentToken;
+
+ /**
+ * Each entry in this array is an array of integers. Each array
+ * of integers represents a sequence of tokens (by their ordinal
+ * values) that is expected at this point of the parse.
+ */
+ public int[][] expectedTokenSequences;
+
+ /**
+ * This is a reference to the "tokenImage" array of the generated
+ * parser within which the parse error occurred. This array is
+ * defined in the generated ...Constants interface.
+ */
+ public String[] tokenImage;
+
+ /**
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
+ * error message and returns it. If this object has been created
+ * due to a parse error, and you do not catch it (it gets thrown
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
+ * gets displayed.
+ */
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ StringBuffer expected = new StringBuffer();
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.length; i++) {
+ if (maxSize < expectedTokenSequences[i].length) {
+ maxSize = expectedTokenSequences[i].length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+ expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+ expected.append("...");
+ }
+ expected.append(eol).append(" ");
+ }
+ String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++) {
+ if (i != 0) retval += " ";
+ if (tok.kind == 0) {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += " " + tokenImage[tok.kind];
+ retval += " \"";
+ retval += add_escapes(tok.image);
+ retval += " \"";
+ tok = tok.next;
+ }
+ retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+ retval += "." + eol;
+ if (expectedTokenSequences.length == 1) {
+ retval += "Was expecting:" + eol + " ";
+ } else {
+ retval += "Was expecting one of:" + eol + " ";
+ }
+ retval += expected.toString();
+ return retval;
+ }
+
+ /**
+ * The end of line string for this machine.
+ */
+ protected String eol = System.getProperty("line.separator", "\n");
+
+ /**
+ * Used to convert raw characters to their escaped version
+ * when these raw version cannot be used as part of an ASCII
+ * string literal.
+ */
+ protected String add_escapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+}
+/* JavaCC - OriginalChecksum=315808adef26ee1a95c3bd49bc0c7494 (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java
new file mode 100644
index 00000000000..da4cbaafdff
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleCharStream.java
@@ -0,0 +1,472 @@
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.1 */
+/* JavaCCOptions:STATIC=false */
+package pddl4j.lexer;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public class SimpleCharStream
+{
+/** Whether parser is static. */
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+/** Position in buffer. */
+ public int bufpos = -1;
+ protected int bufline[];
+ protected int bufcolumn[];
+
+ protected int column = 0;
+ protected int line = 1;
+
+ protected boolean prevCharIsCR = false;
+ protected boolean prevCharIsLF = false;
+
+ protected java.io.Reader inputStream;
+
+ protected char[] buffer;
+ protected int maxNextCharInd = 0;
+ protected int inBuf = 0;
+ protected int tabSize = 8;
+
+ protected void setTabSize(int i) { tabSize = i; }
+ protected int getTabSize(int i) { return tabSize; }
+
+
+ protected void ExpandBuff(boolean wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ protected void FillBuff() throws java.io.IOException
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1)
+ {
+ inputStream.close();
+ throw new java.io.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return;
+ }
+ catch(java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+/** Start. */
+ public char BeginToken() throws java.io.IOException
+ {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ protected void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
+
+ switch (c)
+ {
+ case '\r' :
+ prevCharIsCR = true;
+ break;
+ case '\n' :
+ prevCharIsLF = true;
+ break;
+ case '\t' :
+ column--;
+ column += (tabSize - (column % tabSize));
+ break;
+ default :
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+/** Read a character. */
+ public char readChar() throws java.io.IOException
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
+
+ if (++bufpos == bufsize)
+ bufpos = 0;
+
+ return buffer[bufpos];
+ }
+
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
+
+ char c = buffer[bufpos];
+
+ UpdateLineColumn(c);
+ return c;
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndColumn
+ */
+
+ public int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @deprecated
+ * @see #getEndLine
+ */
+
+ public int getLine() {
+ return bufline[bufpos];
+ }
+
+ /** Get token end column number. */
+ public int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /** Get token end line number. */
+ public int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ /** Get token beginning column number. */
+ public int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ /** Get token beginning line number. */
+ public int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+/** Backup a number of characters. */
+ public void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.Reader dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+ {
+ this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn) throws java.io.UnsupportedEncodingException
+ {
+ this(dstream, encoding, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+ {
+ this(dstream, encoding, 1, 1, 4096);
+ }
+
+ /** Constructor. */
+ public SimpleCharStream(java.io.InputStream dstream)
+ {
+ this(dstream, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize)
+ {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(dstream, encoding, 1, 1, 4096);
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn) throws java.io.UnsupportedEncodingException
+ {
+ ReInit(dstream, encoding, startline, startcolumn, 4096);
+ }
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ /** Get token literal value. */
+ public String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ /** Get the suffix. */
+ public char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ /** Reset buffer when finished. */
+ public void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+
+}
+/* JavaCC - OriginalChecksum=6b2a2131d1c8281ea047dbdf2703150c (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java
new file mode 100644
index 00000000000..937c938f26c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/SimpleNode.java
@@ -0,0 +1,211 @@
+/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
+
+package pddl4j.lexer;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public class SimpleNode implements Node, Iterable<SimpleNode> {
+ protected Node parent;
+
+ protected Node[] children;
+
+ protected int id;
+
+ protected Lexer parser;
+
+ protected Token token;
+
+ protected int line;
+
+ protected int column;
+
+ protected String image;
+
+ protected int typeId;
+
+
+
+ public SimpleNode(int id) {
+ this.id = id;
+ this.line = -1;
+ this.column = -1;
+ this.image = "";
+ this.typeId = -1;
+ }
+
+ public SimpleNode(Lexer p, int id) {
+ this(id);
+ parser = p;
+ }
+
+ public void jjtOpen() {
+ }
+
+ public void jjtClose() {
+ }
+
+ public void jjtSetParent(Node n) {
+ parent = n;
+ }
+
+ public Node jjtGetParent() {
+ return parent;
+ }
+
+ public void jjtAddChild(Node n, int i) {
+ if (children == null) {
+ children = new Node[i + 1];
+ } else if (i >= children.length) {
+ Node c[] = new Node[i + 1];
+ System.arraycopy(children, 0, c, 0, children.length);
+ children = c;
+ }
+ children[i] = n;
+ }
+
+ public Node jjtGetChild(int i) {
+ return children[i];
+ }
+
+ public int jjtGetNumChildren() {
+ return (children == null) ? 0 : children.length;
+ }
+
+ /*
+ * You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the
+ * tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding
+ * toString() is probably all you need to do.
+ */
+
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ str.append("[");
+ str.append(this.getLabel());
+
+ if (!this.image.equals("")) {
+ str.append(", image=\"" + this.image + "\"");
+ }
+ str.append(", line=" + this.line);
+ str.append(", column=" + this.column);
+ if (this.typeId != -1) {
+ str.append(", type=" + LexerTreeConstants.jjtNodeName[this.typeId]);
+ }
+ str.append("]");
+ return str.toString();
+
+ }
+
+ public String toString(String prefix) {
+ return prefix + toString();
+ }
+
+ public int getDepth() {
+ int depth = 0;
+ SimpleNode pred = (SimpleNode) this.parent;
+ while (pred != null) {
+ depth++;
+ pred = (SimpleNode) pred.parent;
+ }
+ return depth;
+ }
+ /*
+ * Override this method if you want to customize how the node dumps out its children.
+ */
+
+ public void dump(String prefix) {
+ System.out.println(toString(prefix));
+ if (children != null) {
+ for (int i = 0; i < children.length; ++i) {
+ SimpleNode n = (SimpleNode) children[i];
+ if (n != null) {
+ n.dump(prefix + " ");
+ }
+ }
+ }
+ }
+
+ public void setToken(Token token) {
+ this.token = token;
+ }
+
+ public final String getLabel() {
+ return LexerTreeConstants.jjtNodeName[id];
+ }
+
+ public final void setLine(int line) {
+ this.line = line;
+ }
+
+ public final int getLine() {
+ return this.line;
+ }
+
+ public final void setColumn(int column) {
+ this.column = column;
+ }
+
+ public final int getColumn() {
+ return this.column;
+ }
+
+ public void setTypeId(int typeId) {
+ this.typeId = typeId;
+ }
+
+ public int getTypeId() {
+ return this.typeId;
+ }
+
+ /**
+ * @return Returns the image.
+ */
+ public final String getImage() {
+ return image;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ /**
+ * @param image The image to set.
+ */
+ public final void setImage(String image) {
+ this.image = image.toLowerCase();
+ }
+
+ private class TreeIterator implements Iterator<SimpleNode> {
+
+ private LinkedList<SimpleNode> nodes;
+
+ public TreeIterator() {
+ this.nodes = new LinkedList<SimpleNode>();
+ this.nodes.add(SimpleNode.this);
+ }
+ public boolean hasNext() {
+ return !this.nodes.isEmpty();
+ }
+
+ public SimpleNode next() {
+ SimpleNode node = null;
+ if (this.hasNext()) {
+ node = nodes.poll();
+ for (int i = 0; i < node.jjtGetNumChildren(); i++) {
+ nodes.add(i, (SimpleNode) node.jjtGetChild(i));
+ }
+ }
+ return node;
+ }
+
+ public void remove() {
+ return;
+ }
+
+ }
+
+ public Iterator<SimpleNode> iterator() {
+ return new TreeIterator();
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java
new file mode 100644
index 00000000000..33d86b68a58
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/Token.java
@@ -0,0 +1,124 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
+package pddl4j.lexer;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /** The line number of the first character of this Token. */
+ public int beginLine;
+ /** The column number of the first character of this Token. */
+ public int beginColumn;
+ /** The line number of the last character of this Token. */
+ public int endLine;
+ /** The column number of the last character of this Token. */
+ public int endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * An optional attribute value of the Token.
+ * Tokens which are not used as syntactic sugar will often contain
+ * meaningful values that will be used later on by the compiler or
+ * interpreter. This attribute value is often different from the image.
+ * Any subclass of Token that actually wants to return a non-null value can
+ * override this method as appropriate.
+ */
+ public Object getValue() {
+ return null;
+ }
+
+ /**
+ * No-argument constructor
+ */
+ public Token() {}
+
+ /**
+ * Constructs a new token for the specified Image.
+ */
+ public Token(int kind)
+ {
+ this(kind, null);
+ }
+
+ /**
+ * Constructs a new token for the specified Image and Kind.
+ */
+ public Token(int kind, String image)
+ {
+ this.kind = kind;
+ this.image = image;
+ }
+
+ /**
+ * Returns the image.
+ */
+ public String toString()
+ {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simply add something like :
+ *
+ * case MyParserConstants.ID : return new IDToken(ofKind, image);
+ *
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use sit in your lexical actions.
+ */
+ public static Token newToken(int ofKind, String image)
+ {
+ switch(ofKind)
+ {
+ default : return new Token(ofKind, image);
+ }
+ }
+
+ public static Token newToken(int ofKind)
+ {
+ return newToken(ofKind, null);
+ }
+
+}
+/* JavaCC - OriginalChecksum=25f564df9e313b43b960343a8a0a31e9 (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java
new file mode 100644
index 00000000000..e7aacfdac90
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/TokenMgrError.java
@@ -0,0 +1,140 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 */
+/* JavaCCOptions: */
+package pddl4j.lexer;
+
+/** Token Manager Error. */
+public class TokenMgrError extends Error
+{
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their escaped (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexical error
+ * curLexState : lexical state in which this error occurred
+ * errorLine : line number when the error occurred
+ * errorColumn : column number when the error occurred
+ * errorAfter : prefix that was seen before this error occurred
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** Constructor with message and reason. */
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ /** Full Constructor. */
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
+/* JavaCC - OriginalChecksum=4ee9b485172dfaa0038728998591a931 (do not edit this line) */
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html
new file mode 100644
index 00000000000..311e1e26bb9
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/lexer/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes of the pddl lexer. This code is automatically generated with javacc 4.0 from the grammar description file Lexer.jjt.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html
new file mode 100644
index 00000000000..6d2b9a8f51c
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/overview.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<h1>PDDL4J beta API Specification.</h1>
+<p>PDDL4J is an open source library under licence CECILL (<a href=
+"http://www.cecill.info/licences/Licence_CeCILL_V2-en.html">http://www.cecill.info/</a>).
+The purpose of the PDDL4J is to facilitate the java implementation of planners
+based on the PDDL (Planning Description Language). The library contains a
+parser on the last version of PDDL 3.0 and all the classes need to manipulate its
+concepts. The parser can be configured to accept only specified requirements of
+PDDL langage. The list of requirements accepted are as follow:
+
+<ul>
+<li>:strips - Basic STRIPS-style.</li>
+<li>:typing - Allows type names in declaration of variables</li>
+<li>:negative-preconditions - Allows not in goal and preconditions descriptions.</li>
+<li>:disjunctive-preconditions - Allows or in goal and preconditions descriptions.</li>
+<li>:equality - Supports = as built-in predicate.</li>
+<li>:existential-preconditions - Allows exists in goal and preconditions descriptions.</li>
+<li>:universal-preconditions - Allows forall in goal and preconditions descriptions.</li>
+<li>:quantified-preconditions - Is equivalent to :existential-preconditions +
+ :universal-preconditions.</li>
+<li>:conditional-effects - Allows when clause in actionCtx effects.
+<li>:fluents - Allows function definitions and use of effects using assignement
+ operators and numeric preconditions.</li>
+<li>:adl - Is equivalent to :strips + :typing + :negative-preconditions +
+ :disjunctive-preconditions + :equality + :quantified-preconditions +
+ :conditional-effects.</li>
+<li>:durative-actions - Allows durative actions. Note that this does note imply
+ :fluents.</li>
+<li>:derived-predicate - Allows predicates whose truth value is defined by a formula.
+<li>:time-initial-literals - Allows the initial state to specify literals that will
+ become true at a specified time point implies durative-actions.</li>
+<li>:preferences - Allows use of preferences in actionCtx preconditions and goals.
+<li>:constraints - Allows use of constraints fields in domain and problem description.
+ These may contain modal operator supporting trajectory constraints.</li>
+</ul>
+</p>
+
+<p>PDDL was originally developed by Drew McDermott and the 1998 planning competition
+committee. It was inspired by the need to encourage the empirical comparison of
+planning systems and the exchange of planning benchmarks within the community.
+Its development improved the communication of research results and triggered an
+ explosion in performance, expressivity and robustness of planning systems.</p>
+
+<p>PDDL has now been used in all 3 planning competitions, undergoing various
+revisions for each. In the most recent competition PDDL was extended by Maria Fox,
+Derek Long and the 2002 committee to handle time and duration (PDDL2.1). Further
+enrichments to the modelling of hybrid and real-time systems (PDDL+) were proposed,
+ while another committee is currently investigating extensions to probabilistic
+planning.</p>
+
+<p>PDDL has become a de facto standard language for describing planning domains,
+not only for the competition but more widely, as it offers an opportunity to carry
+out empirical evaluation of planning systems on a growing collection of generally
+adopted standard benchmark domains. The emergence of a language standard will have
+ an impact on the entire field, influencing what is seen as central and what
+peripheral in the development of planning systems. </p>
+
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html
new file mode 100644
index 00000000000..d677043e4de
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/package.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title></title>
+ <meta name="Generator" content="Cocoa HTML Writer">
+ <meta name="CocoaVersion" content="824.42">
+ <style type="text/css">
+ p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Times}
+ </style>
+</head>
+<body>
+<p>This package contains the classes relative to the pddl4j librairy.</p>
+</body>
+</html>
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java
new file mode 100644
index 00000000000..89773dca704
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/Test.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is a computer program whose purpose is to propose an
+ * environment for multi-agent planning.
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.tests;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Iterator;
+import java.util.Properties;
+
+import pddl4j.ErrorManager;
+import pddl4j.PDDLObject;
+import pddl4j.Parser;
+import pddl4j.ParserException;
+import pddl4j.RequireKey;
+import pddl4j.Source;
+import pddl4j.ErrorManager.Message;
+import pddl4j.exp.action.ActionDef;
+
+public class Test {
+
+ public static void main(String[] args) {
+ try {
+ // Creates an instance of the java pddl parser
+ Parser parser = new Parser(getParserOptions());
+ // Gets the error manager of the pddl parser
+ ErrorManager mgr = parser.getErrorManager();
+
+ boolean success;
+ PDDLObject domain = parser.parse(new File(args[0]));
+
+ if (mgr.contains(Message.ERROR)) {
+ mgr.print(Message.ALL);
+ } // else we print the warning and start the planning process
+ else {
+ mgr.print(Message.WARNING);
+ System.out.println("\nParsing domain \"" + domain.getDomainName()
+ + "\" done successfully ...");
+ //System.out.println(domain);
+
+
+ PDDLObject problem = parser.parse(new File(args[1]));
+ if (mgr.contains(Message.ERROR)) {
+ mgr.print(Message.ALL);
+ } // else we print the warning and start the planning process
+ else {
+ mgr.print(Message.WARNING);
+ System.out.println("\nParsing problem \"" + problem.getProblemName()
+ + "\" done successfully ...");
+ //System.out.println(problem);
+
+
+ PDDLObject obj = parser.link(domain, problem);
+
+ if (mgr.contains(Message.LINKER_ERROR)) {
+ mgr.print(Message.LINKER_ERROR);
+ } // else we print the warning and start the planning process
+ else {
+ mgr.print(Message.LINKER_WARNING);
+ System.out.println("Linking \"" + domain.getDomainName() + "\" with \"" + problem.getProblemName()
+ + "\" done successfully ...");
+ System.out.println(obj);
+
+ /*Iterator<ActionDef> i = obj.actionsIterator();
+ while (i.hasNext()) {
+ ActionDef action = i.next();
+ System.out.println(action.toTypedString());
+ System.out.println(action.normalize().toTypedString());
+
+ }*/
+
+
+ }
+ }
+ }
+
+ // If the parser produces errors we print it and stop
+
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ /**
+ * Returns the default options of the compiler.
+ *
+ * @return the default options.
+ */
+ private static Properties getParserOptions() {
+ Properties options = new Properties();
+ options.put("source", Source.V3_0);
+ options.put(RequireKey.STRIPS, true);
+ options.put(RequireKey.TYPING, true);
+ options.put(RequireKey.EQUALITY, true);
+ options.put(RequireKey.FLUENTS, false);
+ options.put(RequireKey.NEGATIVE_PRECONDITIONS, true);
+ options.put(RequireKey.DISJUNCTIVE_PRECONDITIONS, true);
+ options.put(RequireKey.EXISTENTIAL_PRECONDITIONS, true);
+ options.put(RequireKey.UNIVERSAL_PRECONDITIONS, true);
+ options.put(RequireKey.QUANTIFIED_PRECONDITIONS, true);
+ options.put(RequireKey.CONDITIONAL_EFFECTS, true);
+ options.put(RequireKey.DURATIVE_ACTIONS, true);
+ options.put(RequireKey.ADL, true);
+ return options;
+ }
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java
new file mode 100644
index 00000000000..ebf3c0dec1b
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/src/pddl4j/tests/TestCNF.java
@@ -0,0 +1,285 @@
+/*
+ * Copyright Dept. of Mathematics & Computer Science Univ. Paris-Descartes
+ *
+ * This software is a computer program whose purpose is to propose an
+ * environment for multi-agent planning.
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package pddl4j.tests;
+
+import pddl4j.exp.AndExp;
+import pddl4j.exp.AtomicFormula;
+import pddl4j.exp.ExistsExp;
+import pddl4j.exp.Exp;
+import pddl4j.exp.ForallExp;
+import pddl4j.exp.ImplyExp;
+import pddl4j.exp.NotAtomicFormula;
+import pddl4j.exp.NotExp;
+import pddl4j.exp.OrExp;
+import pddl4j.exp.term.Constant;
+import pddl4j.exp.term.Variable;
+import pddl4j.exp.type.Type;
+
+public class TestCNF {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ // (and (forall (?x) (p1 ?x ?y)) (p2 ?x ?y))
+
+ Variable x = new Variable("?x");
+ Variable y = new Variable("?y");
+
+ AtomicFormula p1 = new AtomicFormula("p1");
+ p1.add(x);
+ p1.add(y);
+
+ AtomicFormula p2 = new AtomicFormula("p2");
+ p2.add(x);
+ p2.add(y);
+
+ ForallExp forall = new ForallExp();
+ forall.add(x);
+ forall.setExp(p1);
+
+ AndExp and = new AndExp();
+ and.add(forall);
+ and.add(p2);
+
+ System.out.println(and);
+ System.out.println(and.standardize());
+ //System.out.println(and.getFreeVariables());
+
+ AndExp a2 = new AndExp();
+ a2.add(p1);
+ a2.add(p2);
+
+ //System.out.println(a2);
+ //System.out.println(a2.standardize());
+
+
+ ExistsExp e1 = new ExistsExp();
+ e1.add(y);
+ e1.setExp(p1);
+
+ ForallExp f1 = new ForallExp();
+ f1.add(x);
+ f1.setExp(e1);
+
+ ExistsExp e2 = new ExistsExp();
+ e2.add(x);
+ e2.add(y);
+ e2.setExp(p2);
+
+ AndExp a1 = new AndExp();
+ a1.add(f1);
+ a1.add(e2);
+
+ //System.out.println(a1);
+ //System.out.println(a1.standardize());
+
+
+
+ //System.out.println(a1.getFreeVariables());
+
+
+
+ /*Variable x = new Variable("?x");
+ Variable y = new Variable("?y");
+ Variable z = new Variable("?z");
+
+ AtomicFormula animal = new AtomicFormula("animal");
+ animal.add(y);
+
+ AtomicFormula loves1 = new AtomicFormula("loves");
+ loves1.add(x);
+ loves1.add(y);
+
+ System.out.println(loves1);
+ System.out.println(loves1.normalize());
+
+
+ /*AtomicFormula loves2 = new AtomicFormula("loves");
+ loves2.add(y);
+ loves2.add(x);
+
+ ExistsExp e1 = new ExistsExp();
+ e1.add(y);
+ e1.setExp(loves2);
+
+ ImplyExp e3 = new ImplyExp(animal, loves1);
+
+ ForallExp e2 = new ForallExp();
+ e2.add(y);
+ e2.setExp(e3);
+
+ ImplyExp e4 = new ImplyExp(e2, e1);
+
+ ForallExp e5 = new ForallExp();
+ e5.add(x);
+ e5.setExp(e4);
+
+ ForallExp e7 = new ForallExp();
+ e7.add(x);
+ e7.setExp(loves2);
+
+
+ AndExp e6 = new AndExp();
+ e6.add(e7);
+ e6.add(loves1);
+ e6.add(e1);
+
+ //System.out.println(e6);
+ //Exp e8 = e6.toPNF();
+ //System.out.println(e8);
+ //System.out.println(e8.toPNF());
+
+
+
+
+
+ System.out.println("INIT: \n" + e5);
+ System.out.println(e5.standardize());
+ System.out.println(e5.standardize().moveQuantifierOutward());
+ //System.out.println(e5.standardize().moveQuantifierOutward().toNNF());
+ //System.out.println(e5.toNNF());
+ Exp e9 = e5.toPrenexNormaForm();
+ System.out.println("PNF:\n" + e9);
+ //System.out.println(e9.toNNF());
+ System.out.println("CNF:\n" + e9.toConjunctiveNormalForm());
+
+
+ /*Variable v1 = new Variable("v1");
+ Variable v2 = new Variable("v2");
+
+ Constant c1 = new Constant("c1");
+ Constant c2 = new Constant("c2");
+
+ AtomicFormula a1 = new AtomicFormula("a1");
+ a1.add(v1);
+ a1.add(v2);
+
+ AtomicFormula a2 = new AtomicFormula("a2");
+ a2.add(c1);
+ a2.add(c2);
+
+ NotAtomicFormula nota2 = new NotAtomicFormula(a2);
+
+ AndExp and = new AndExp();
+ and.add(a1);
+ and.add(nota2);
+
+ OrExp or = new OrExp();
+ or.add(a1);
+ or.add(nota2);
+
+
+
+ ForallExp forall = new ForallExp(or);
+ forall.add(v1);
+ forall.add(v2);
+
+ NotExp not = new NotExp(forall);
+
+ System.out.println(not);
+ System.out.println(not.standardize());*/
+
+ /*AtomicFormula A = new AtomicFormula("A");
+ AtomicFormula B = new AtomicFormula("B");
+ AtomicFormula C = new AtomicFormula("C");
+ AtomicFormula D = new AtomicFormula("D");
+ AtomicFormula E = new AtomicFormula("E");
+ AtomicFormula F = new AtomicFormula("F");
+
+
+ AndExp AetB = new AndExp();
+ AetB.add(A);
+ AetB.add(B);
+
+ AndExp CetD = new AndExp();
+ CetD.add(C);
+ CetD.add(D);
+
+ OrExp CouD = new OrExp();
+ CouD.add(C);
+ CouD.add(D);
+
+ OrExp AouB = new OrExp();
+ AouB.add(A);
+ AouB.add(B);
+
+
+ AndExp AouBetCouD = new AndExp();
+ AouBetCouD.add(AouB);
+ AouBetCouD.add(CouD);
+
+ OrExp AetBouCetD = new OrExp();
+ AetBouCetD.add(AetB);
+ AetBouCetD.add(CetD);
+
+ OrExp AetBouCouD = new OrExp();
+ AetBouCouD.add(AetB);
+ AetBouCouD.add(CouD);
+
+ AndExp and1 = new AndExp();
+ and1.add(F);
+ and1.add(AetBouCetD);
+ //and1.add(F);
+
+ ImplyExp AimplyAnd1 = new ImplyExp(A, and1);
+
+ NotExp notE = new NotExp(E);
+
+
+ //and2.add(F);
+
+ AndExp and3 = new AndExp();
+ and3.add(A);
+ and3.add(CouD);
+
+ AndExp and2 = new AndExp();
+ and2.add(F);
+ and2.add(and3);
+
+
+ System.out.println("IN: "+ AimplyAnd1);
+ System.out.println("IN: "+ AimplyAnd1.standardize());
+ System.out.println("DNF: "+ AimplyAnd1.toDNF());
+
+ /*System.out.println("IN: "+ and1);
+ Exp nnf = and1.toNNF();
+ System.out.println("NNF: " + nnf);
+ Exp cnf = nnf.toDNF();
+ System.out.println("CNF: " + cnf);*/
+
+ }
+
+}
diff --git a/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/travel.pddl b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/travel.pddl
new file mode 100644
index 00000000000..49ae8847356
--- /dev/null
+++ b/SA_POP/utils/PDDLtoSANetTranslator/PDDLParser/travel.pddl
@@ -0,0 +1,51 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Simple Vehicle domain where a person has to get in to a vehicle,
+;;; drive it somewhere, get out, and return to some other location.
+;;; Recursion is a problem in this domain because the roads and
+;;; bridges go both directions.
+
+(define (domain travel)
+ (:requirements :strips :equality)
+ (:predicates (road ?from ?to)
+ (at ?thing ?place)
+ (mobile ?thing)
+ (bridge ?from ?to)
+ (person ?p)
+ (vehicle ?v)
+ (driving ?p ?v))
+
+ (:action Drive
+ :parameters (?thing ?from ?to)
+ :precondition (and (road ?from ?to)
+ (at ?thing ?from)
+ (mobile ?thing)
+ (not (= ?from ?to)))
+ :effect (and (at ?thing ?to) (not (at ?thing ?from))))
+ (:action Cross
+ :parameters (?thing ?from ?to)
+ :precondition (and (bridge ?from ?to)
+ (at ?thing ?from)
+ (mobile ?thing)
+ (not (= ?from ?to)))
+ :effect (and (at ?thing ?to) (not (at ?thing ?from))))
+ (:action Board
+ :parameters (?person ?place ?vehicle)
+ :precondition (and (at ?person ?place)
+ (person ?person)
+ (vehicle ?vehicle)
+ (at ?vehicle ?place))
+ :effect (and (driving ?person ?vehicle)
+ (mobile ?vehicle)
+ (not (at ?person ?place))
+ (not (mobile ?person))))
+ (:action Disembark
+ :parameters (?person ?place ?vehicle)
+ :precondition (and (person ?person)
+ (vehicle ?vehicle)
+ (driving ?person ?vehicle)
+ (at ?vehicle ?place))
+ :effect (and (at ?person ?place)
+ (mobile ?person)
+ (not (driving ?person ?vehicle))
+ (not (mobile ?vehicle))))
+ ) \ No newline at end of file
diff --git a/SA_POP/utils/SANetGenerator/Net_Skeleton.py b/SA_POP/utils/SANetGenerator/Net_Skeleton.py
new file mode 100755
index 00000000000..502e95eab8b
--- /dev/null
+++ b/SA_POP/utils/SANetGenerator/Net_Skeleton.py
@@ -0,0 +1,56 @@
+#Daniel L.C. Mack
+#Build Random Skeletons for SA_POP
+
+import networkx as nx
+import re
+import sys
+import random as rand
+import Rand_Skeletons as RS
+
+Ntasks = int(sys.argv[1])
+Nconds = int(sys.argv[2])
+inDegree = float(sys.argv[3])
+outDegree = float(sys.argv[4])
+rGen = int(sys.argv[5])
+output = sys.argv[6]
+
+ofile = open(output, 'w')
+ofile.write("strict digraph testGraph {\n")
+
+SANet = nx.DiGraph()
+tasks = []
+conds = []
+
+#Build and record different types of nodes
+for each in range(0,Ntasks+1):
+ tname = "task" + str(each)
+ SANet.add_node(tname)
+ tasks.append(tname)
+
+for each in range(0,Nconds+1):
+ cname = "cond" + str(each)
+ SANet.add_node(cname)
+ conds.append(cname)
+
+#Choose function to generate from
+if rGen == 1:
+ SANet = RS.erdosGen(SANet, tasks, conds, inDegree, outDegree)
+
+#Print out the graph currently into something resembling an SANet, for GraphViz to render
+for each in tasks:
+ ofile.write("\"" + each + "\" [shape = box, style=filled, color = grey];\n" )
+
+for each in conds:
+ ofile.write("\"" + each +"\" [ style=filled, color = grey];\n")
+
+for edge in SANet.edges():
+ ofile.write("\"" + edge[0] + "\" -> \"" + edge[1] + "\";\n")
+ofile.write("}\n")
+ofile.close()
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/SA_POP/utils/SANetGenerator/Rand_Skeletons.py b/SA_POP/utils/SANetGenerator/Rand_Skeletons.py
new file mode 100755
index 00000000000..76b1ea05932
--- /dev/null
+++ b/SA_POP/utils/SANetGenerator/Rand_Skeletons.py
@@ -0,0 +1,75 @@
+#Daniel Mack
+#Random Skeleton Generators
+
+import networkx as nx
+import random as rand
+
+
+#Modified Erdos-Renyi Graph Generator
+def erdosGen(SANet, tasks, conds, inDegree, outDegree):
+ inD = {}
+ outD = {}
+ pairs = {}
+ haltGen = 0;
+ haltOut = 0;
+ haltIn = 0;
+
+ #continue until the graph has met the in/out degreee limits
+ while haltGen == 0:
+ ctask = ""
+ ccond = ""
+ found = 0
+ while found == 0:
+ #Choose Task
+ ctask = tasks[rand.randrange(len(tasks))]
+ #Choose Cond
+ ccond = conds[rand.randrange(len(conds))]
+ key = ctask + "," + ccond
+ #if already been used as either an effect or precondition
+ if key in pairs:
+ found = 0
+ else:
+ #valid pair for random pairing
+ found = 1
+ pairs[key] = 1
+
+ #choose direction
+ EfforPre = rand.randrange(2)
+
+ #If 0 then it's a precondition link
+ if EfforPre == 0 and haltIn == 0:
+ SANet.add_edge(ccond, ctask)
+ if ctask in inD:
+ inD[ctask] += 1
+ else:
+ inD[ctask] = 1
+ elif haltOut == 0:
+ #otherwise it's an effect
+ SANet.add_edge(ctask, ccond)
+ if ctask in outD:
+ outD[ctask] += 1
+ else:
+ outD[ctask] = 1
+
+ #Check for Stopping Conditions
+ totalIn = 0.0
+ totalOut = 0.0
+ for each in tasks:
+ if each in inD:
+ totalIn += inD[each]
+ if each in outD:
+ totalOut += outD[each]
+ avgIn = totalIn/len(tasks)
+ avgOut = totalOut/len(tasks)
+
+
+ if avgIn >= inDegree:
+ haltIn = 1
+ if avgOut >= outDegree:
+ haltOut = 1
+ if haltIn == 1 and haltOut == 1:
+ print avgIn
+ print avgOut
+ haltGen = 1
+
+ return SANet \ No newline at end of file