All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----aima.logic.Variable
The Variable class provides a class of objects to represent variables inside expressions that are to be unified.
See Also: Unify
public class Variable extends java.lang.Object { // Constructors 2 public Variable(Variable); public Variable(String); // Methods 4 public boolean equals(Object); public static final char getPrefix(); public int hashCode(); public String toString(); }
public Variable(String baseName)
Creates a new variable with the given name. The implementation guarantees that two variables created with the same name will be equal according to the
equals
predicate.
Parameter Description baseName the name to give the variable.
See Also: equals
public Variable(Variable oldVar)
Creates a new variable based on the name of the given existing variable, but which is not equal to that variable in any way. This constructor method is useful in renaming variables inside expressions, where you want the resulting renamed expression to contain similar looking variables that are actually unique from the variables in the original expression.
Parameter Description oldVar the variable whose name is to be used as a basis for the name of the newly created Variable
.
public int hashCode()
Calculates hashCode of this
Variable
. Needed so that one can successfully hash aVariable
object in ajava.util.Hashtable
- Returns:
- The hash code.
- Overrides:
- hashCode in class Object
See Also: Hashtable
public boolean equals(Object other)
Determine if this
Variable
object is equal to theother
passed Object.Note: the signature of the passed parameter is in terms of an
Object
as opposed to simply aVariable
because we want this method to match the signature of theequals
predicate in used toput
andget
entries in ajava.util.Hashtable
.
Parameter Description other The Object
to compare with.
- Returns:
- If
other
is equal to thisVariable
.- Overrides:
- equals in class Object
See Also: Hashtable
public static final char getPrefix()
Return the prefix character that should be used in the printed representation of all
Variable
objects and is used on input to flag an atom as one that should be converted to aVariable
object.
- Returns:
- The prefix character denoting a
Variable
.
public String toString()
Creates a
String
representation of thisVariable
.
- Returns:
- The
String
representation of thisVariable
.- Overrides:
- toString in class Object
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4