import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
import gnu.trove.set.hash.TIntHashSet;
public class CHRRuleset extends Symbol {
rule.collectVars(allVars, vars);
}
- public void collectFreeVariables(THashSet<Variable> vars) {
- for(IncludeStatement include : includes)
- include.value.collectFreeVariables(vars);
- for(CHRRule rule : rules)
- rule.collectFreeVariables(vars);
- }
-
public void setLocationDeep(long loc) {
if(location == Locations.NO_LOCATION) {
this.location = loc;
PlanRealizer realizer = new PlanRealizer(cachedContext, this, runtimeRulesetVariable, implementationParameters[0], plan.ops);
realizer.nextOp(methodWriter);
if(methodWriter.isUnfinished())
- methodWriter.return_(BooleanConstant.TRUE);
+ methodWriter.return_(rule.location, BooleanConstant.TRUE);
}
}
if(!includes.isEmpty() || extensible) {
methodWriter.apply(Locations.NO_LOCATION,
new JavaMethod(true, runtimeRulesetClassName, "register", Types.PROC, Types.UNIT, new Type[] {runtimeRulesetType, Types.CHRContext}),
object.getTarget(), methodWriter.getParameters()[0]);
- methodWriter.return_(NoRepConstant.UNIT);
+ methodWriter.return_(location, NoRepConstant.UNIT);
}
{
CodeWriter methodWriter = object.createMethod(w.getModuleWriter(), TVar.EMPTY_ARRAY, Types.PROC, Types.UNIT, new Type[] {Types.CHRContext});
methodWriter.apply(Locations.NO_LOCATION,
new JavaMethod(true, runtimeRulesetClassName, "unregister", Types.PROC, Types.UNIT, new Type[] {runtimeRulesetType, Types.CHRContext}),
object.getTarget(), methodWriter.getParameters()[0]);
- methodWriter.return_(NoRepConstant.UNIT);
+ methodWriter.return_(location, NoRepConstant.UNIT);
}
}
if(initConstraint != null) {
return runtimeRulesetVariable;
}
- public void collectEffects(THashSet<Type> effects) {
- for(CHRRule rule : rules) {
- for(CHRLiteral literal : rule.head.literals)
- literal.collectQueryEffects(effects);
- for(CHRLiteral literal : rule.head.literals)
- literal.collectEnforceEffects(effects);
- }
- }
-
public void addRule(CHRRule rule) {
rules.add(rule);
rule.parentRuleset = this;