prolog.implementation
Class Variable

java.lang.Object
  |
  +--prolog.implementation.Variable
All Implemented Interfaces:
IAtom

public class Variable
extends java.lang.Object
implements IAtom

This class encapsulates a variable value used in queries. Because all names in the coder's program are replaced by integers, the internal representation of a atom is a integer value. This integer value can be decoded using the symboltable generated by the parser. A value can be compared with a filled cell in a database table row

prolog: myFact(dan,X).

in this example, a atom would be "X" a variable


Field Summary
protected  int name
          the interpreter internal representation of the variable. this is the index for the symboltable.
 
Constructor Summary
Variable(int name)
          creates a new Variable
 
Method Summary
 boolean equals(java.lang.Object o)
          !!!
 int getName()
          the key in symboltable of the name
 java.lang.String toString()
          returns a string representation of the atom.
 java.lang.String toString(ISymbolTable table)
          returns a string representation of the atom. because all names of the programmer's programm are replaced by integers, this function requires the additional stringtable to decode the integers into strings again.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

name

protected int name
the interpreter internal representation of the variable. this is the index for the symboltable.
Constructor Detail

Variable

public Variable(int name)
creates a new Variable
Parameters:
name - is the name ;-)
Method Detail

getName

public int getName()
the key in symboltable of the name
Specified by:
getName in interface IAtom

equals

public boolean equals(java.lang.Object o)
!!! a variable is equal to anything !!!
Overrides:
equals in class java.lang.Object
Returns:
allways true !!!

toString

public java.lang.String toString()
returns a string representation of the atom.
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(ISymbolTable table)
returns a string representation of the atom. because all names of the programmer's programm are replaced by integers, this function requires the additional stringtable to decode the integers into strings again.
Specified by:
toString in interface IAtom