net.jprolog.structure
Interface JPTerm

All Known Implementing Classes:
Div, JPAtom, JPAtom.Default, JPAtomicTerm, JPAtomicTerm.Default, JPAtomicTerm.Null, JPAtomicTerm.Unknown, JPCompoundTerm, JPCompoundTerm.Default, JPNumber, JPNumber.Default, JPNumber.Infinity, JPNumber.NaN, JPNumber.NegativeInfinity, JPNumber.PositiveInfinity, JPOperator, JPOperator.Default, JPPredicate, JPPredicate.Default, JPVariable, JPVariable.Default, JPVariable.Free, Minus, Mult, NewOperator, Plus

public interface JPTerm

This is the interface for all the JProlog data structure. There is some object-inherited method that must be overwritten, because they will be use a lot's, such as equals(), hashcode() or clone().

Version:
0.0.1
Author:
CARTAPANIS Alexandre <earendil@jprolog.net>

Field Summary
static int ATOM
          The atom type.
static int ATOMIC_TERM
          The atomic term type.
static int COMPOUND_TERM
          The compound term type.
static int NULL
          The null type.
static int NUMBER
          The number type.
static int OPERATOR
          The operator type.
static int PREDICATE
          The predicate type.
static int TERM
          The term type.
static java.lang.String[] TYPE
          A String array that contains the type name.
static int UNKNOWN
          The unknow type.
static int VARIABLE
          The variable type.
 
Method Summary
 java.lang.Object clone()
          Return a copy of this object.
 boolean equals(java.lang.Object _obj)
          Say if two terms are equals.
 void finalize()
          Finalize and delete the term.
 int getType()
          Return the term's type.
 java.lang.String getValue()
          Return the term's value
 int hashcode()
          Return a term's hashcode.
 long randomHashcode()
          Return a randomized hashcode.
 void setType(int _type)
          Change the term's type.
 void setValue(java.lang.String _value)
          Change the term's type.
 java.lang.String toString()
          Return a String representation of the term.
 

Field Detail

UNKNOWN

public static final int UNKNOWN
The unknow type.

See Also:
Constant Field Values

NULL

public static final int NULL
The null type.

See Also:
Constant Field Values

TERM

public static final int TERM
The term type.

See Also:
Constant Field Values

ATOMIC_TERM

public static final int ATOMIC_TERM
The atomic term type.

See Also:
Constant Field Values

COMPOUND_TERM

public static final int COMPOUND_TERM
The compound term type.

See Also:
Constant Field Values

ATOM

public static final int ATOM
The atom type.

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
The number type.

See Also:
Constant Field Values

VARIABLE

public static final int VARIABLE
The variable type.

See Also:
Constant Field Values

OPERATOR

public static final int OPERATOR
The operator type.

See Also:
Constant Field Values

PREDICATE

public static final int PREDICATE
The predicate type.

See Also:
Constant Field Values

TYPE

public static final java.lang.String[] TYPE
A String array that contains the type name.

Method Detail

getType

public int getType()
Return the term's type.

Returns:
int - The term's type.

setType

public void setType(int _type)
Change the term's type.

Parameters:
_type - The new type.

getValue

public java.lang.String getValue()
Return the term's value

Returns:
String - The term's value.

setValue

public void setValue(java.lang.String _value)
Change the term's type.

Parameters:
_value - The new value.

randomHashcode

public long randomHashcode()
Return a randomized hashcode. The hashcode method will return the same value for two equals term. But equals term exist in prolog, so we need a method that return different value for the same term.

Returns:
int - A randomized hashcode.

hashcode

public int hashcode()
Return a term's hashcode.

Returns:
int - The hashcode.

toString

public java.lang.String toString()
Return a String representation of the term.

Overrides:
toString in class java.lang.Object
Returns:
String - The String representation of the term.

equals

public boolean equals(java.lang.Object _obj)
Say if two terms are equals.

Overrides:
equals in class java.lang.Object
Parameters:
_obj - The object to compare with.
Returns:
boolean - True if the specified object is equals to this one, false oterwise.

clone

public java.lang.Object clone()
Return a copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
Object - A copy of this object.

finalize

public void finalize()
Finalize and delete the term.

Overrides:
finalize in class java.lang.Object


Copyright © 2002 CARTAPANIS Alexandre