com.ugos.JIProlog.engine
Class JIPTerm

java.lang.Object
  |
  +--com.ugos.JIProlog.engine.JIPTerm
All Implemented Interfaces:
com.ugos.JIProlog.engine.Clearable, java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
JIPAtom, JIPClause, JIPCons, JIPFunctor, JIPList, JIPNumber, JIPString, JIPVariable

public class JIPTerm
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, com.ugos.JIProlog.engine.Clearable

JIPTerm wraps generic prolog terms (atoms, functors, lists, etc.)

Version:
2.0
Author:
Ugo Chirico 2002
Home Page: http://www.ugosweb.com/jiprolog
See Also:
Serialized Form

Method Summary
 void clear()
          Clears all variables in this JIPTerm object.
 java.lang.Object clone()
          Clones this JIPTerm object.
 JIPVariable[] getVariables()
          Gets an array of JIPVariable objects containing the variables in this JIPTerm object
 java.util.Hashtable getVariablesTable()
          Gets an hashtable of JIPVariable objects containing the variables in this JIPTerm object.
 java.lang.String toString()
          Returns a canonical representation of this JIPTerm object i.e. it ignores operator declarations.
 java.lang.String toString(JIPEngine engine)
          Returns a string representation of this JIPTerm object using the operator declarations contained in JIPEngine object.
 java.lang.String toStringq(JIPEngine engine)
          Returns a quoted string representation of this JIPTerm object using the operator declarations contained in JIPEngine object.
 boolean unifiable(JIPTerm term)
          Checks if this JIPTerm object unifies with the specified term.
 boolean unify(JIPTerm term, java.util.Hashtable varTable)
          Unifies this JIPTerm object with the specified term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

unifiable

public final boolean unifiable(JIPTerm term)
Checks if this JIPTerm object unifies with the specified term. Remarks: this method doesn't bind any variable. To actually unifies the terms use the other method unify.

Parameters:
term - term to unify
Returns:
true if the this object unify with the specified term.

clone

public final java.lang.Object clone()
Clones this JIPTerm object.

Overrides:
clone in class java.lang.Object
Returns:
Copy of this JIPTerm object .

clear

public final void clear()
Clears all variables in this JIPTerm object.

Specified by:
clear in interface com.ugos.JIProlog.engine.Clearable

unify

public final boolean unify(JIPTerm term,
                           java.util.Hashtable varTable)
Unifies this JIPTerm object with the specified term. If this JIPTerm object unifies with the specified term this method unifies the terms and varTable will contains the variables that has been bound.

Parameters:
term - term to unify
varTable - the hashtable containing the variable that has been bound.
Returns:
true if the this object unify with the specified term.

toString

public java.lang.String toString()
Returns a canonical representation of this JIPTerm object i.e. it ignores operator declarations. It has the same behaviour as write_canonical/1

Overrides:
toString in class java.lang.Object
Returns:
a canonical representation of this JIPTerm object

toString

public java.lang.String toString(JIPEngine engine)
Returns a string representation of this JIPTerm object using the operator declarations contained in JIPEngine object. It has the same behaviour as write/1

Parameters:
engine - the JIPEngine object containing operator declarations
Returns:
a string representation of this JIPTerm object

toStringq

public java.lang.String toStringq(JIPEngine engine)
Returns a quoted string representation of this JIPTerm object using the operator declarations contained in JIPEngine object. It has the same behaviour as writeq/1

Parameters:
engine - the JIPEngine object containing operator declarations
Returns:
a string representation of this JIPTerm object

getVariables

public final JIPVariable[] getVariables()
Gets an array of JIPVariable objects containing the variables in this JIPTerm object

Returns:
an array of JIPVariable objects containing the variables in this JIPTerm object
See Also:
JIPVariable

getVariablesTable

public final java.util.Hashtable getVariablesTable()
Gets an hashtable of JIPVariable objects containing the variables in this JIPTerm object.
Variable names are the keys to access to the hashtable.

Returns:
an hashtable of JIPVariable objects containing the variables in this JIPTerm object.
See Also:
JIPVariable