alice.tuprolog
Class Term

java.lang.Object
  extended byalice.tuprolog.Term
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Number, Struct, Var

public abstract class Term
extends java.lang.Object
implements java.io.Serializable

Term class is the root abstract class for prolog data type

See Also:
Struct, Var, Number, Serialized Form

Field Summary
static Term FALSE
           
static Term TRUE
           
 
Constructor Summary
Term()
           
 
Method Summary
 Term copyGoal(java.util.AbstractMap vars, int idExecCtx)
          gets a engine's copy of this term.
 Term copyResult(java.util.Collection goalVars, java.util.List resultVars)
          gets a copy of this term for the output
static Term createTerm(java.lang.String st)
          Static service to create a Term from a string.
static Term createTerm(java.lang.String st, alice.tuprolog.OperatorManager op)
          Static service to create a Term from a string, providing an external operator manager.
 boolean equals(java.lang.Object t)
          Tests for the equality of two object terms The comparison follows the same semantic of the isEQU method.
abstract  void free()
          Unlink variables inside the term
static java.util.Iterator getIterator(java.lang.String text)
          Gets an iterator providing a term stream from a source text
abstract  Term getTerm()
          Gets the actual term referred by this Term.
abstract  boolean isAtom()
          is this term a prolog (alphanumeric) atom?
abstract  boolean isAtomic()
          is this term a constant prolog term?
abstract  boolean isCompound()
          is this term a prolog compound term?
abstract  boolean isEmptyList()
          is this term a null term?
abstract  boolean isEqual(Term t)
          Tests if this term is (logically) equal to another
abstract  boolean isGreater(Term t)
          is term greater than term t?
abstract  boolean isGround()
          is this term a ground term?
abstract  boolean isList()
          is this term a prolog list?
abstract  boolean isNumber()
          Deprecated. Use instanceof Number instead.
abstract  boolean isStruct()
          Deprecated. Use instanceof Struct instead.
abstract  boolean isVar()
          Deprecated. Use instanceof Var instead.
 Term iteratedGoalTerm()
          The iterated-goal term G of a term T is a term defined recursively as follows: if T unifies with ^(_, Goal) then G is the iterated-goal term of Goal else G is T
 boolean match(Term t)
          Tests if this term is unifiable with an other term.
static Term parse(java.lang.String st)
          Deprecated. Use createTerm(String) instead.
static Term parse(java.lang.String st, alice.tuprolog.OperatorManager op)
          Deprecated. Use createTerm(String, OperatorManager) instead.
 void resolveTerm()
          Resolves variables inside the term If the variables has been already resolved, no renaming is done.
 boolean unify(Prolog mediator, Term t1)
          Try to unify two terms
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final Term TRUE

FALSE

public static final Term FALSE
Constructor Detail

Term

public Term()
Method Detail

isNumber

public abstract boolean isNumber()
Deprecated. Use instanceof Number instead.

is this term a prolog numeric term?


isStruct

public abstract boolean isStruct()
Deprecated. Use instanceof Struct instead.

is this term a struct?


isVar

public abstract boolean isVar()
Deprecated. Use instanceof Var instead.

is this term a variable?


isEmptyList

public abstract boolean isEmptyList()
is this term a null term?


isAtomic

public abstract boolean isAtomic()
is this term a constant prolog term?


isCompound

public abstract boolean isCompound()
is this term a prolog compound term?


isAtom

public abstract boolean isAtom()
is this term a prolog (alphanumeric) atom?


isList

public abstract boolean isList()
is this term a prolog list?


isGround

public abstract boolean isGround()
is this term a ground term?


equals

public boolean equals(java.lang.Object t)
Tests for the equality of two object terms The comparison follows the same semantic of the isEQU method.


isGreater

public abstract boolean isGreater(Term t)
is term greater than term t?


isEqual

public abstract boolean isEqual(Term t)
Tests if this term is (logically) equal to another


getTerm

public abstract Term getTerm()
Gets the actual term referred by this Term. if the Term is a bound variable, the method gets the Term linked to the variable


free

public abstract void free()
Unlink variables inside the term


resolveTerm

public void resolveTerm()
Resolves variables inside the term If the variables has been already resolved, no renaming is done.


copyGoal

public Term copyGoal(java.util.AbstractMap vars,
                     int idExecCtx)
gets a engine's copy of this term.

Parameters:
idExecCtx - Execution Context identified

copyResult

public Term copyResult(java.util.Collection goalVars,
                       java.util.List resultVars)
gets a copy of this term for the output


unify

public boolean unify(Prolog mediator,
                     Term t1)
Try to unify two terms

Parameters:
mediator - have the reference of EngineManager
t1 - the term to unify
Returns:
true if the term is unifiable with this one

match

public boolean match(Term t)
Tests if this term is unifiable with an other term. No unification is done. The test is done outside any demonstration context

Parameters:
t - the term to checked
Returns:
true if the term is unifiable with this one

createTerm

public static Term createTerm(java.lang.String st)
                       throws InvalidTermException
Static service to create a Term from a string.

Parameters:
st - the string representation of the term
Returns:
the term represented by the string
Throws:
InvalidTermException - if the string does not represent a valid term

parse

public static Term parse(java.lang.String st)
                  throws InvalidTermException
Deprecated. Use createTerm(String) instead.

Throws:
InvalidTermException

createTerm

public static Term createTerm(java.lang.String st,
                              alice.tuprolog.OperatorManager op)
                       throws InvalidTermException
Static service to create a Term from a string, providing an external operator manager.

Parameters:
st - the string representation of the term
op - the operator manager used to build the term
Returns:
the term represented by the string
Throws:
InvalidTermException - if the string does not represent a valid term

parse

public static Term parse(java.lang.String st,
                         alice.tuprolog.OperatorManager op)
                  throws InvalidTermException
Deprecated. Use createTerm(String, OperatorManager) instead.

Throws:
InvalidTermException

getIterator

public static java.util.Iterator getIterator(java.lang.String text)
Gets an iterator providing a term stream from a source text


iteratedGoalTerm

public Term iteratedGoalTerm()
The iterated-goal term G of a term T is a term defined recursively as follows: