edu.buffalo.sneps
Class Substitution

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.String>
          extended by edu.buffalo.sneps.Substitution
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.String>

public class Substitution
extends java.util.HashMap<java.lang.String,java.lang.String>

Represents a substitution (a set of pairs, each of which is a variable and a term). Used by the askwh and askwhnot methods to represent substitutions. A HashSet of these are returned by these methods as there can be multiple substitutions that satisfy a particular query.

See Also:
Serialized Form

Constructor Summary
Substitution(int capacity)
          Creates an instance of the substitution with the specified capacity (number of substitution pairs).
 
Method Summary
 void addSubstitutionPair(java.lang.String var, java.lang.String val)
          Adds a substitution pair to this substitution of the specified variable and value.
 java.lang.String getValFromVar(java.lang.String var)
          Returns the value that unifies with the specified variable in this substitution.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Substitution

public Substitution(int capacity)
Creates an instance of the substitution with the specified capacity (number of substitution pairs).

Parameters:
capacity - The capacity for this substitution
Method Detail

addSubstitutionPair

public void addSubstitutionPair(java.lang.String var,
                                java.lang.String val)
Adds a substitution pair to this substitution of the specified variable and value.

Parameters:
var - The variable identifier.
val - The value that unifies with that variable

getValFromVar

public java.lang.String getValFromVar(java.lang.String var)
Returns the value that unifies with the specified variable in this substitution.

Parameters:
var - The variable identifier to retrieve the value from.
Returns:
The value that unifies with var, or the empty string is no such variable is found in this set.