prolog.implementation
Class Value

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

public class Value
extends java.lang.Object
implements IAtom

This class encapsulates a constant value, one item of a relation. 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 "dan" a value


Field Summary
protected  int value
          the interpreter internal representation of the constant. this is the index for the symboltable
 
Constructor Summary
Value(int value)
          creates a new Value
 
Method Summary
 boolean equals(java.lang.Object o)
          overrides equals in java.lang.Object. if the given Object o is of the same class, the compare action is done, if not, it returns false
 int getName()
          the key in symboltable of the name
 int hashCode()
          returns a hashcode ;-) WOW ;-)
 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, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

value

protected int value
the interpreter internal representation of the constant. this is the index for the symboltable
Constructor Detail

Value

public Value(int value)
creates a new Value
Parameters:
value - is the name used by the programer
Method Detail

equals

public boolean equals(java.lang.Object o)
overrides equals in java.lang.Object. if the given Object o is of the same class, the compare action is done, if not, it returns false
Overrides:
equals in class java.lang.Object
Returns:
true if the two values are the same in symboltable

getName

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

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

toString

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

hashCode

public int hashCode()
returns a hashcode ;-) WOW ;-)
Overrides:
hashCode in class java.lang.Object