All Packages  This Package  Class Hierarchy  Class Search  Index

Class aima.logic.Variable

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();
}



Constructors


Variable

   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



Variable

   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.




Methods


hashCode

   public int hashCode() 

Calculates hashCode of this Variable. Needed so that one can successfully hash a Variable object in a java.util.Hashtable

Returns:
The hash code.
Overrides:
hashCode in class Object

See Also: Hashtable



equals

   public boolean equals(Object other) 

Determine if this Variable object is equal to the other passed Object.

Note: the signature of the passed parameter is in terms of an Object as opposed to simply a Variable because we want this method to match the signature of the equals predicate in used to put and get entries in a java.util.Hashtable.

Parameter Description
other The Object to compare with.

Returns:
If other is equal to this Variable.
Overrides:
equals in class Object

See Also: Hashtable



getPrefix

   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 a Variable object.

Returns:
The prefix character denoting a Variable.


toString

   public String toString() 

Creates a String representation of this Variable.

Returns:
The String representation of this Variable.
Overrides:
toString in class Object


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4