standup.unify
Class Bindings
java.lang.Object
standup.unify.Bindings
public class Bindings
- extends Object
Stores the results of a unification.
Provides dereference(Unifiable)
, a method of obtaining the result
of a unification.
- Author:
- Ruli Manurung
FAIL
public static final int FAIL
- See Also:
- Constant Field Values
bindings
Hashtable<UnifiableVariable,Unifiable> bindings
failure
private boolean failure
Bindings
public Bindings()
Bindings
public Bindings(int x)
Bindings
public Bindings(Hashtable<UnifiableVariable,Unifiable> BB)
destructivelyUpdate
public void destructivelyUpdate(Bindings newB)
- Updates the current bindings hashtable with the one in the given
Bindings. Use with caution!
- Parameters:
newB
-
replace
public boolean replace(UnifiableVariable variable,
Unifiable oldValue,
Unifiable newValue)
- Replaces all bindings to
oldValue
with bindings to
newValue
. This is rather untypical unification operation, but is
required for the 'lexlinks' in joke graph building. It should only be
called to replace Lexeme
s and WordForm
s to
{code standup.joke.JokeGraphNode}s...
- Parameters:
oldValue
- newValue
-
- Returns:
true
if successfully replaced the values, false
otherwise
isFailure
public boolean isFailure()
get
Unifiable get(UnifiableVariable key)
put
void put(UnifiableVariable Key,
Unifiable Value)
copy
public Bindings copy()
toString
public String toString()
- Overrides:
toString
in class Object
dereference
public Unifiable dereference(Unifiable old)
- Returns the result of unification by applying the values in this bindings
to the given
Unifiable
. Returns a new instance -- it does not
affect the given value.
- Parameters:
old
-
- Returns:
dereference
private UnifiableCompound dereference(UnifiableCompound old)
dereference
private UnifiableList dereference(UnifiableList old)
dereference
private Unifiable dereference(UnifiableVariable W)