/** Helper method for groundedUnify. */ private boolean groundedUnify(APLVar t, SubstList<Term> theta) { Term subst = theta.get(t.getName()); if (subst != null) return groundedUnify(subst, theta); else { theta.put(t.getName(), this); return true; } }
/** * Test whether this number is equal to another number. * * @param other the number to compare with * @return true if equal, false otherwise */ public boolean equals(Term other) { if (other instanceof APLNum) { APLNum term = (APLNum) other; return val.equals(term.getVal()); } else if (other instanceof APLVar) { APLVar term = (APLVar) other; if (!term.isBounded()) return false; else return equals(term.getSubst()); } else return false; }