@Override public Collection<Atomic> getAtomics() { ArrayList<Atomic> r = new ArrayList<Atomic>(); r.add(from.getVariable()); r.add(to.getVariable()); return r; }
@Override public Collection<Term> getGroundTerms() { ArrayList<Term> r = new ArrayList<Term>(); r.addAll(from.getGroundTerms()); r.addAll(to.getGroundTerms()); return r; }
@Override public Collection<Term> getVariableTerms() { Set<Term> r = new HashSet<Term>(); r.addAll(from.getVariableTerms()); r.addAll(to.getVariableTerms()); return r; }
/** * Replace all interval terms that are variables by unique ground terms. Used to assure that * intervals added by resolvers do not exist in the constraint database they are added to. */ public void makeUniqueGroundKeys() { long ID = UniqueID.getID(); Substitution sub = new Substitution(); for (Statement s : this.getCondition().get(Statement.class)) { if (s.getKey().isVariable()) { sub.add(s.getKey(), Term.createConstant(s.getKey().toString().replace("?", "") + "#" + ID)); } } for (OpenGoal s : this.getCondition().get(OpenGoal.class)) { if (s.getStatement().getKey().isVariable()) { sub.add( s.getStatement().getKey(), Term.createConstant(s.getStatement().getKey().toString().replace("?", "") + "#" + ID)); } } for (ConstraintDatabase resolver : this.getResolvers()) { for (Statement s : resolver.get(Statement.class)) { if (s.getKey().isVariable()) { sub.add( s.getKey(), Term.createConstant(s.getKey().toString().replace("?", "") + "#" + ID)); } } for (OpenGoal s : resolver.get(OpenGoal.class)) { if (s.getStatement().getKey().isVariable()) { sub.add( s.getStatement().getKey(), Term.createConstant( s.getStatement().getKey().toString().replace("?", "") + "#" + ID)); } } } this.substitute(sub); }
@Override public Expression substitute(Substitution theta) { return new StateVariableOverride(from.substitute(theta), to.substitute(theta)); }