import org.simantics.scl.compiler.types.Types;
import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.set.hash.THashSet;
public class CHRConstraint extends Symbol implements CHRRelation {
public final String name;
public final Type[] parameterTypes;
+ public String[] fieldNames;
public boolean implicitlyDeclared;
this.name = name;
this.parameterTypes = parameterTypes;
}
+
+ public void setParent(CHRRuleset parentRuleset) {
+ this.parentRuleset = parentRuleset;
+ }
public void initializeCodeGeneration(CompilationContext context, CHRRuleset parentRuleset) {
JavaTypeTranslator jtt = context.javaTypeTranslator;
- this.parentRuleset = parentRuleset;
this.factClassName = parentRuleset.runtimeRulesetClassName + "$" + name;
TCon factTypeConstructor = Types.con(parentRuleset.runtimeRulesetType.module, parentRuleset.runtimeRulesetType.name + "$" + name);
this.factType = Types.apply(factTypeConstructor, TVar.EMPTY_ARRAY);
else
return w.apply(location, accessor, fact);
}
+
+ @Override
+ public String[] getFieldNames() {
+ return fieldNames;
+ }
+
+ @Override
+ public void collectEnforceEffects(THashSet<Type> effects) {
+ effects.add(Types.PROC);
+ }
+
+ @Override
+ public void collectQueryEffects(THashSet<Type> effects) {
+ effects.add(Types.PROC);
+ }
}