Prolog Cafe v1.2

jp.ac.kobe_u.cs.prolog.lang
Class Term

java.lang.Object
  extended by jp.ac.kobe_u.cs.prolog.lang.Term
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Term>
Direct Known Subclasses:
ClosureTerm, JavaObjectTerm, ListTerm, NumberTerm, StructureTerm, SymbolTerm, VariableTerm

public abstract class Term
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Term>

The superclass of classes for term structures. The subclasses of Term must override the unify method.

See Also:
Serialized Form

Field Summary
static int AFTER
          Holds an integer value 1.
static int BEFORE
          Holds an integer value -1.
static int EQUAL
          Holds an integer value 0.
 
Constructor Summary
Term()
           
 
Method Summary
 boolean convertible(java.lang.Class type)
          Check whether this object is convertible with the given Java class type.
protected static boolean convertible(java.lang.Class from, java.lang.Class<?> to)
          Check whether there is a widening conversion from from to to.
protected  Term copy(Prolog engine)
          Returns a copy of this object.
 Term dereference()
          Returns the dereference value of this term.
static boolean instanceOfTerm(java.lang.Object obj)
          Checks whether a given object is an instance of Prolog term.
 boolean isClosure()
          Check whether this term is a closure term.
 boolean isDouble()
          Check whether this term is a float.
 boolean isGround()
          Check whether this term is a ground term.
 boolean isInteger()
          Check whether this term is an integer.
 boolean isJavaObject()
          Check whether this term is a java term.
 boolean isList()
          Check whether this term is a list structure.
 boolean isNil()
          Check whether this term is an empty list.
 boolean isNumber()
          Check whether this term is a number.
 boolean isStructure()
          Check whether this term is a compound term.
 boolean isSymbol()
          Check whether this term is an atom.
 boolean isVariable()
          Check whether this term is a logical variable.
 java.lang.Object toJava()
          Returns a Java object that corresponds to this term if defined in Prolog Cafe interoperability with Java.
 java.lang.String toQuotedString()
          Returns a quoted string representation of this term.
abstract  boolean unify(Term t, Trail trail)
          Checks whether the argument term is unified with this one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

EQUAL

public static int EQUAL
Holds an integer value 0.


AFTER

public static int AFTER
Holds an integer value 1.


BEFORE

public static int BEFORE
Holds an integer value -1.

Constructor Detail

Term

public Term()
Method Detail

unify

public abstract boolean unify(Term t,
                              Trail trail)
Checks whether the argument term is unified with this one.

Parameters:
t - the term to be unified with.
trail - Trail Stack.
Returns:
true if succeeds, otherwise false.

isVariable

public boolean isVariable()
Check whether this term is a logical variable.

Returns:
true if this instanceof VariableTerm, otherwise false.
See Also:
VariableTerm

isInteger

public boolean isInteger()
Check whether this term is an integer.

Returns:
true if this instanceof IntegerTerm, otherwise false.
See Also:
IntegerTerm

isDouble

public boolean isDouble()
Check whether this term is a float.

Returns:
true if this instanceof DoubleTerm, otherwise false.
See Also:
DoubleTerm

isNumber

public boolean isNumber()
Check whether this term is a number.

Returns:
true if this instanceof IntegerTerm || this instanceof DoubleTerm, otherwise false.
See Also:
IntegerTerm, DoubleTerm

isSymbol

public boolean isSymbol()
Check whether this term is an atom.

Returns:
true if this instanceof SymbolTerm, otherwise false.
See Also:
SymbolTerm

isNil

public boolean isNil()
Check whether this term is an empty list.


isList

public boolean isList()
Check whether this term is a list structure.

Returns:
true if this instanceof ListTerm, otherwise false.
See Also:
ListTerm

isStructure

public boolean isStructure()
Check whether this term is a compound term.

Returns:
true if this instanceof StructureTerm, otherwise false.
See Also:
StructureTerm

isJavaObject

public boolean isJavaObject()
Check whether this term is a java term.

Returns:
true if this instanceof JavaObjectTerm, otherwise false.
See Also:
JavaObjectTerm

isClosure

public boolean isClosure()
Check whether this term is a closure term.

Returns:
true if this instanceof ClosureTerm, otherwise false.
See Also:
ClosureTerm

convertible

public boolean convertible(java.lang.Class type)
Check whether this object is convertible with the given Java class type.

Parameters:
type - the Java class type to compare with.
Returns:
true if this is convertible with type. Otherwise false.
See Also:
convertible(Class, Class)

copy

protected Term copy(Prolog engine)
Returns a copy of this object.


dereference

public Term dereference()
Returns the dereference value of this term.


isGround

public boolean isGround()
Check whether this term is a ground term.

Returns:
true if ground, otherwise false.

toJava

public java.lang.Object toJava()
Returns a Java object that corresponds to this term if defined in Prolog Cafe interoperability with Java. Otherwise, returns this.

Returns:
a Java object if defined in Prolog Cafe interoperability with Java, otherwise this.

toQuotedString

public java.lang.String toQuotedString()
Returns a quoted string representation of this term.


convertible

protected static boolean convertible(java.lang.Class from,
                                     java.lang.Class<?> to)
Check whether there is a widening conversion from from to to.


instanceOfTerm

public static boolean instanceOfTerm(java.lang.Object obj)
Checks whether a given object is an instance of Prolog term.


Prolog Cafe v1.2

Copyright (C) 1997-2008 M.BANBARA and N.TAMURA