Prolog Cafe v1.2

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

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

public class SymbolTerm
extends Term

Atom.
The SymbolTerm class represents a Prolog atom.

   Term t = SymbolTerm.makeSymbol("kobe");
   String name = ((SymbolTerm)t).name();
 

See Also:
Serialized Form

Field Summary
protected  int arity
          Holds the arity of this SymbolTerm.
protected  java.lang.String name
          Holds a string representation of this SymbolTerm.
protected static java.util.Hashtable<java.lang.String,SymbolTerm> SYMBOL_TABLE
          Symbol table.
 
Fields inherited from class jp.ac.kobe_u.cs.prolog.lang.Term
AFTER, BEFORE, EQUAL
 
Constructor Summary
protected SymbolTerm(java.lang.String _name, int _arity)
          Constructs a new Prolog atom (or functor) with the given symbol name and arity.
 
Method Summary
 int arity()
          Returns the arity of this SymbolTerm.
 int compareTo(Term anotherTerm)
          Compares two terms in Prolog standard order of terms.
 boolean convertible(java.lang.Class type)
          Check whether this object is convertible with the given Java class type.
static SymbolTerm makeSymbol(java.lang.String _name)
          Returns a Prolog atom for the given name.
static SymbolTerm makeSymbol(java.lang.String _name, int _arity)
          Returns a Prolog functor for the given name and arity.
 java.lang.String name()
          Returns the string representation of this SymbolTerm.
 java.lang.Object toJava()
          Returns a java.lang.String corresponds to this SymbolTerm according to Prolog Cafe interoperability with Java.
 java.lang.String toQuotedString()
          Returns a quoted string representation of this term.
 java.lang.String toString()
          Returns a string representation of this SymbolTerm.
 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, copy, dereference, instanceOfTerm, isClosure, isDouble, isGround, isInteger, isJavaObject, isList, isNil, isNumber, isStructure, isSymbol, isVariable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SYMBOL_TABLE

protected static java.util.Hashtable<java.lang.String,SymbolTerm> SYMBOL_TABLE
Symbol table.


name

protected java.lang.String name
Holds a string representation of this SymbolTerm.


arity

protected int arity
Holds the arity of this SymbolTerm.

Constructor Detail

SymbolTerm

protected SymbolTerm(java.lang.String _name,
                     int _arity)
Constructs a new Prolog atom (or functor) with the given symbol name and arity.

Method Detail

makeSymbol

public static SymbolTerm makeSymbol(java.lang.String _name)
Returns a Prolog atom for the given name.


makeSymbol

public static SymbolTerm makeSymbol(java.lang.String _name,
                                    int _arity)
Returns a Prolog functor for the given name and arity.


arity

public int arity()
Returns the arity of this SymbolTerm.

Returns:
the value of arity.
See Also:
arity

name

public java.lang.String name()
Returns the string representation of this SymbolTerm.

Returns:
the value of name.
See Also:
name

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.

convertible

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

Overrides:
convertible in class Term
Parameters:
type - the Java class type to compare with.
Returns:
the boolean whose value is convertible(String.class, type).
See Also:
Term.convertible(Class, Class)

toJava

public java.lang.Object toJava()
Returns a java.lang.String corresponds to this SymbolTerm according to Prolog Cafe interoperability with Java.

Overrides:
toJava in class Term
Returns:
a java.lang.String object equivalent to this SymbolTerm.

toQuotedString

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

Overrides:
toQuotedString in class Term

toString

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

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