GNU Prolog for Java

gnu.prolog.term
Class CompoundTerm

java.lang.Object
  extended by gnu.prolog.term.Term
      extended by gnu.prolog.term.CompoundTerm
All Implemented Interfaces:
Serializable, Cloneable

public class CompoundTerm
extends Term

compound term.

Version:
0.0.1
Author:
Constantine Plotnilkov
See Also:
Serialized Form

Field Summary
 Term[] args
          term argumets
 CompoundTermTag tag
          term tag
 
Fields inherited from class gnu.prolog.term.Term
ATOM, COMPOUND, FLOAT, INTEGER, JAVA_OBJECT, UNKNOWN, VARIABLE
 
Constructor Summary
CompoundTerm(AtomTerm functor, int arity)
          get term with specified functor and arity
CompoundTerm(AtomTerm functor, Term[] args)
          get term with specified term functor and arguments.
CompoundTerm(CompoundTermTag tag)
          a contructor
CompoundTerm(CompoundTermTag tg, Term arg1)
          get term with specified term tag and arguments.
CompoundTerm(CompoundTermTag tag, Term[] args)
          a constructor
CompoundTerm(CompoundTermTag tg, Term arg1, Term arg2)
          get term with specified term tag and arguments.
CompoundTerm(CompoundTermTag tg, Term arg1, Term arg2, Term arg3)
          get term with specified term tag and arguments.
CompoundTerm(String functor, int arity)
          get term with specified functor and arity
CompoundTerm(String functor, Term[] args)
          get term with specified term functor and arguments.
 
Method Summary
 Term clone(TermCloneContext context)
          clone the object using clone context
static CompoundTerm getConjunction(Term head, Term tail)
          get conjunction term
static CompoundTerm getDisjunction(Term head, Term tail)
          get disjunction term
static Term getList(List<Term> list)
          get prolog list by java list
static Term getList(Term[] list)
          get prolog list by java array
static CompoundTerm getList(Term head, Term tail)
          get list pair
 int getTermType()
          get type of term
static boolean isListPair(Term term)
           
static boolean toCollection(Term term, Collection<Term> col)
           
 
Methods inherited from class gnu.prolog.term.Term
clone, dereference, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tag

public final CompoundTermTag tag
term tag


args

public final Term[] args
term argumets

Constructor Detail

CompoundTerm

public CompoundTerm(CompoundTermTag tg,
                    Term arg1)
get term with specified term tag and arguments.

Parameters:
tg - tag of new term
arg1 - 1st argument of term

CompoundTerm

public CompoundTerm(CompoundTermTag tg,
                    Term arg1,
                    Term arg2)
get term with specified term tag and arguments.

Parameters:
tg - tag of new term
arg1 - 1st argument of term
arg2 - 2nd argument of term

CompoundTerm

public CompoundTerm(CompoundTermTag tg,
                    Term arg1,
                    Term arg2,
                    Term arg3)
get term with specified term tag and arguments.

Parameters:
tg - tag of new term
arg1 - 1st argument of term
arg2 - 2nd argument of term
arg3 - 3rd argument of term

CompoundTerm

public CompoundTerm(String functor,
                    int arity)
get term with specified functor and arity

Parameters:
functor - a functor of new term
arity - arity of new term

CompoundTerm

public CompoundTerm(AtomTerm functor,
                    int arity)
get term with specified functor and arity

Parameters:
functor - a functor of new term
arity - arity of new term

CompoundTerm

public CompoundTerm(AtomTerm functor,
                    Term[] args)
get term with specified term functor and arguments.

Parameters:
functor - a functor of new term
args - arguments of term, this array is directly assigned to term and any changes that are done to array change term.

CompoundTerm

public CompoundTerm(String functor,
                    Term[] args)
get term with specified term functor and arguments.

Parameters:
functor - a functor of new term
args - arguments of term, this array is directly assigned to term and any changes that are done to array change term.

CompoundTerm

public CompoundTerm(CompoundTermTag tag)
a contructor

Parameters:
tag - tag of term

CompoundTerm

public CompoundTerm(CompoundTermTag tag,
                    Term[] args)
a constructor

Parameters:
tag - tag of term
args - arguments of term
Method Detail

isListPair

public static boolean isListPair(Term term)

getList

public static CompoundTerm getList(Term head,
                                   Term tail)
get list pair

Parameters:
head - head term
tail - tail term
Returns:
'.'(head, tail) term

getList

public static Term getList(Term[] list)
get prolog list by java array

Parameters:
list -
Returns:
a Term representation of the list

getList

public static Term getList(List<Term> list)
get prolog list by java list

Parameters:
list -
Returns:
a Term representation of the list

toCollection

public static boolean toCollection(Term term,
                                   Collection<Term> col)

getConjunction

public static CompoundTerm getConjunction(Term head,
                                          Term tail)
get conjunction term

Parameters:
head - head term
tail - tail term
Returns:
','(head, tail) term

getDisjunction

public static CompoundTerm getDisjunction(Term head,
                                          Term tail)
get disjunction term

Parameters:
head - head term
tail - tail term
Returns:
';'(head, tail) term

clone

public Term clone(TermCloneContext context)
clone the object using clone context

Specified by:
clone in class Term
Parameters:
context - clone context
Returns:
cloned term

getTermType

public int getTermType()
get type of term

Overrides:
getTermType in class Term
Returns:
type of term

GNU Prolog for Java