alice.tuprolog
Class Term

java.lang.Object
  extended byalice.tuprolog.Term
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NullTerm, 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
abstract  Term copy()
          gets a copy of this term.
 boolean equals(java.lang.Object t)
          Tests for the equality of two object terms The comparison follows the same semantic of the isEQU method.
static java.util.Iterator getIterator(java.lang.String text)
          Gets an iterator providing a term stream from a source text
 Term getRenamedCopy()
          Gets a renamed copy of this term All the variables in the term are unlinked and renamed
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 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 isNull()
          is this term a null term?
abstract  boolean isNumber()
          is this term a prolog numeric term?
abstract  boolean isStruct()
          is this term a struct?
abstract  boolean isVar()
          is this term a variable?
 boolean match(Term t)
          Tests if this term is unifiable with an other term.
static Term parse(java.lang.String st)
          Static service to parse a Term from a string.
static Term parse(java.lang.String st, OperatorManager op)
          Parse a Term from a string.
 void resolveVariables()
          Resolves variables inside the term If the variables has been already resolved, no renaming is done.
 boolean unify(Term t)
          Tries to unify two terms The unification is done outside a demonstration context.
 
Methods inherited from class java.lang.Object
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()
is this term a prolog numeric term?


isStruct

public abstract boolean isStruct()
is this term a struct?


isVar

public abstract boolean isVar()
is this term a variable?


isNull

public abstract boolean isNull()
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


copy

public abstract Term copy()
gets a copy of this term.


getRenamedCopy

public Term getRenamedCopy()
Gets a renamed copy of this term All the variables in the term are unlinked and renamed


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


resolveVariables

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


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

unify

public boolean unify(Term t)
Tries to unify two terms The unification is done outside a demonstration context.

Parameters:
t - the term to be unified with this one
Returns:
true if the two terms have been successfully unified

parse

public static Term parse(java.lang.String st)
                  throws InvalidTermException
Static service to parse 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,
                         OperatorManager op)
                  throws InvalidTermException
Parse a Term from a string.

Throws:
InvalidTermException

getIterator

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



DEIS, Universita' di Bologna, Sede di Cesena