GNU Prolog for Java

gnu.prolog.term
Class CompoundTermTag

java.lang.Object
  extended by gnu.prolog.term.CompoundTermTag
All Implemented Interfaces:
Serializable

public final class CompoundTermTag
extends Object
implements Serializable

A tag of compound term. A tag consists of functor and arity. All tags are unique in one JVM.

Version:
0.0.1
Author:
Constatine Plotinikov
See Also:
Serialized Form

Field Summary
 int arity
          arity of term.
static CompoundTermTag comma
          comma tag
static CompoundTermTag curly1
          '{}'/1 tag
static CompoundTermTag divide2
          '/'/2 tag
 AtomTerm functor
          a functor of term
static CompoundTermTag minus2
          '-'/2 tag
 
Constructor Summary
protected CompoundTermTag(AtomTerm f, int a)
          a constructor
 
Method Summary
 boolean equals(Object obj)
           
static CompoundTermTag get(AtomTerm functor, int arity)
          get compound term tag
static CompoundTermTag get(CompoundTerm predicateIndicator)
          get compound term tag
static CompoundTermTag get(String functor, int arity)
          get compound term tag
 CompoundTerm getPredicateIndicator()
          get predicate indicator for this tag
 int hashCode()
           
static boolean isPredicateIndicator(Term term)
          check if term is predicate indicator
 Object readResolve()
          Return an object to replace the object extracted from the stream.
 String toString()
          convert tag to string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

comma

public static final CompoundTermTag comma
comma tag


curly1

public static final CompoundTermTag curly1
'{}'/1 tag


minus2

public static final CompoundTermTag minus2
'-'/2 tag


divide2

public static final CompoundTermTag divide2
'/'/2 tag


functor

public final AtomTerm functor
a functor of term


arity

public final int arity
arity of term. Arity of tag could be 0. But in this case this tag could not be used to cunstruct the compound terms.

Constructor Detail

CompoundTermTag

protected CompoundTermTag(AtomTerm f,
                          int a)
a constructor

Parameters:
f - functor of term
a - arity of term
Method Detail

getPredicateIndicator

public CompoundTerm getPredicateIndicator()
get predicate indicator for this tag

Returns:
the predicate indicator for this tag

get

public static CompoundTermTag get(CompoundTerm predicateIndicator)
get compound term tag

Parameters:
predicateIndicator - a term which represent a predicate indicator of term
Returns:
a tag that have specified by a term which represent a predicate indicator of term
Throws:
IllegalArgumentException - if term is not a valid predicate indicator

isPredicateIndicator

public static boolean isPredicateIndicator(Term term)
check if term is predicate indicator

Parameters:
term - term to check
Returns:
true if term is predicate indicator

get

public static CompoundTermTag get(String functor,
                                  int arity)
get compound term tag

Parameters:
functor - functor of tag
arity - arity of tag
Returns:
a tag that have specified arity ond functor

get

public static CompoundTermTag get(AtomTerm functor,
                                  int arity)
get compound term tag

Parameters:
functor - functor of tag
arity - arity of tag
Returns:
a tag that have specified arity ond functor

readResolve

public Object readResolve()
Return an object to replace the object extracted from the stream. The object will be used in the graph in place of the original.

Returns:
resolved object
See Also:
Resolvable

toString

public String toString()
convert tag to string

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

GNU Prolog for Java