Term rightArg = functor.arguments[i]; if (!leftArg.structuralEquals(rightArg))
Term rightArg = functor.arguments[i]; if (!leftArg.structuralEquals(rightArg))
/** * Compares this term for structural equality with another. Two terms are structurally equal if they are the same * functor with the same arguments, or are the same unbound variable, or the bound values of the left or right * variable operands are structurally equal. Structural equality is a stronger equality than unification and unlike * unification it does not produce any variable bindings. Two unified terms will always be structurally equal. * * @param term The term to compare with this one for structural equality. * * @return <tt>true</tt> if the two terms are structurally eqaul, <tt>false</tt> otherwise. */ public boolean structuralEquals(Term term) { Term comparator = term.getValue(); Term value = getValue(); // Check if this is an unbound variable in which case the comparator must be the same variable. if (value == this) { return this.equals(comparator); } else { return value.structuralEquals(comparator); } }
/** * Compares this term for structural equality with another. Two terms are structurally equal if they are the same * functor with the same arguments, or are the same unbound variable, or the bound values of the left or right * variable operands are structurally equal. Structural equality is a stronger equality than unification and unlike * unification it does not produce any variable bindings. Two unified terms will always be structurally equal. * * @param term The term to compare with this one for structural equality. * * @return <tt>true</tt> if the two terms are structurally eqaul, <tt>false</tt> otherwise. */ public boolean structuralEquals(Term term) { Term comparator = term.getValue(); Term value = getValue(); // Check if this is an unbound variable in which case the comparator must be the same variable. if (value == this) { return this.equals(comparator); } else { return value.structuralEquals(comparator); } }