package org.simantics.scl.compiler.elaboration.chr;
+import java.util.ArrayList;
+
+import org.junit.runners.ParentRunner;
import org.simantics.scl.compiler.compilation.CompilationContext;
-import org.simantics.scl.compiler.elaboration.chr.plan.PlanOp;
-import org.simantics.scl.compiler.elaboration.chr.plan.PrioritizedPlan;
+import org.simantics.scl.compiler.elaboration.chr.plan.CHRSearchPlan;
import org.simantics.scl.compiler.elaboration.chr.planning.QueryPlanningContext;
import org.simantics.scl.compiler.elaboration.chr.relations.CHRConstraint;
import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
public Variable[] existentialVariables;
// Analysis
- public int firstPriorityExecuted;
+ //public int firstPriorityExecuted;
public int lastPriorityExecuted;
+ // Plans
+ public ArrayList<CHRSearchPlan> plans = new ArrayList<CHRSearchPlan>();
+
+ // Code generation, move to CHRPriority
+ public String containerClassName;
+
public CHRRule(long location, CHRQuery head, CHRQuery body, Variable[] existentialVariables) {
this.location = location;
this.head = head;
if(!head.createQueryPlan(context, new EVariable(activeFact), i))
return;
body.createEnforcePlan(context, priority);
- constraint.plans.add(new PrioritizedPlan(priority, activeFact, context.getPlanOps()));
+ addPlan(new CHRSearchPlan(constraint, activeFact, context.getPlanOps()));
hasActiveLiteral = true;
}
/*System.out.println(this);
for(PlanOp planOp : context.getPlanOps())
System.out.println(" " + planOp);*/
- initConstraint.plans.add(new PrioritizedPlan(priority, activeFact, context.getPlanOps()));
+ addPlan(new CHRSearchPlan(initConstraint, activeFact, context.getPlanOps()));
}
}
+ private void addPlan(CHRSearchPlan plan) {
+ plans.add(plan);
+ }
+
public String toString() {
StringBuilder b = new StringBuilder();
ExpressionToStringVisitor visitor = new ExpressionToStringVisitor(b);