com.grack.prologmachine
Class MostGeneralUnifier
java.lang.Object
|
+--com.grack.prologmachine.MostGeneralUnifier
- public class MostGeneralUnifier
- extends java.lang.Object
A class which contains the Most General Unifier (MGU) set: the set which
unifies two terms.
Method Summary |
void |
addSubstitution(Variable v,
Unifiable u)
Adds a new substitution to the MGU, as well as updating the old
substitutions with the new variable. |
void |
applySubstitution(Predicate p)
Applies the current substitution set to the given Predicate. |
java.lang.String |
toString()
Converts the MGU to a string represenation. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
MostGeneralUnifier
public MostGeneralUnifier()
- Creates an empty MGU.
addSubstitution
public void addSubstitution(Variable v,
Unifiable u)
- Adds a new substitution to the MGU, as well as updating the old
substitutions with the new variable.
- Parameters:
v
- The variable to replace.u
- The value to replace the variable with.
applySubstitution
public void applySubstitution(Predicate p)
- Applies the current substitution set to the given Predicate.
- Parameters:
p
- The Predicate to substiture.
toString
public java.lang.String toString()
- Converts the MGU to a string represenation.
- Returns:
- The string representation.
- Overrides:
- toString in class java.lang.Object