Prolog Cafe v1.2

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

java.lang.Object
  extended by jp.ac.kobe_u.cs.prolog.lang.Term
      extended by jp.ac.kobe_u.cs.prolog.lang.ClosureTerm
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Term>

public class ClosureTerm
extends Term

Closure.
The class ClosureTerm represents a closure structure.

See Also:
Serialized Form

Field Summary
protected  Predicate code
          Holds a Predicate object that represents a Prolog goal.
 
Fields inherited from class jp.ac.kobe_u.cs.prolog.lang.Term
AFTER, BEFORE, EQUAL
 
Constructor Summary
ClosureTerm(Predicate _code)
          Constructs a new closure structure for the given Prolog goal.
 
Method Summary
 int compareTo(Term anotherTerm)
          Compares two terms in Prolog standard order of terms.
 boolean equals(java.lang.Object obj)
          Checks term equality of two terms.
 Predicate getCode()
          Returns the Prolog goal of this ClosureTerm.
 int hashCode()
           
 java.lang.String toQuotedString()
          Returns a quoted string representation of this term.
 java.lang.String toString()
          Returns a string representation of this ClosureTerm.
 boolean unify(Term t, Trail trail)
          Checks whether the argument term is unified with this one.
 
Methods inherited from class jp.ac.kobe_u.cs.prolog.lang.Term
convertible, convertible, copy, dereference, instanceOfTerm, isClosure, isDouble, isGround, isInteger, isJavaObject, isList, isNil, isNumber, isStructure, isSymbol, isVariable, toJava
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

code

protected Predicate code
Holds a Predicate object that represents a Prolog goal.

Constructor Detail

ClosureTerm

public ClosureTerm(Predicate _code)
Constructs a new closure structure for the given Prolog goal.

Method Detail

getCode

public Predicate getCode()
Returns the Prolog goal of this ClosureTerm.


unify

public boolean unify(Term t,
                     Trail trail)
Description copied from class: Term
Checks whether the argument term is unified with this one.

Specified by:
unify in class Term
Parameters:
t - the term to be unified with.
trail - Trail Stack.
Returns:
true if succeeds, otherwise false.

toQuotedString

public java.lang.String toQuotedString()
Description copied from class: Term
Returns a quoted string representation of this term.

Overrides:
toQuotedString in class Term

equals

public boolean equals(java.lang.Object obj)
Checks term equality of two terms. The result is true if and only if the argument is an instance of ClosureTerm, and the pairs of goals in the two closures are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with. This must be dereferenced.
Returns:
true if the given object represents a closure equivalent to this ClosureTerm, false otherwise.
See Also:
compareTo(jp.ac.kobe_u.cs.prolog.lang.Term)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of this ClosureTerm.

Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Term anotherTerm)
Compares two terms in Prolog standard order of terms.
It is noted that t1.compareTo(t2) == 0 has the same boolean value as t1.equals(t2).

Parameters:
anotherTerm - the term to compared with. It must be dereferenced.
Returns:
the value 0 if two terms are identical; a value less than 0 if this term is before the anotherTerm; and a value greater than 0 if this term is after the anotherTerm.

Prolog Cafe v1.2

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