alice.tuprolog
Class Struct

java.lang.Object
  extended byalice.tuprolog.Term
      extended byalice.tuprolog.Struct
All Implemented Interfaces:
java.io.Serializable

public class Struct
extends Term

Struct class represents both compound prolog term and atom term (considered as 0-arity compound).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class alice.tuprolog.Term
FALSE, TRUE
 
Constructor Summary
Struct()
          Builds a structure representing an empty list
Struct(java.lang.String f)
          Builds a Struct representing an atom
Struct(java.lang.String f, Term at0)
          Builds a compound, with one argument
Struct(java.lang.String f, Term[] argList)
          Builds a compound, with an array of arguments
Struct(java.lang.String f, Term at0, Term at1)
          Builds a compound, with two arguments
Struct(java.lang.String f, Term at0, Term at1, Term at2)
          Builds a compound, with three arguments
Struct(java.lang.String f, Term at0, Term at1, Term at2, Term at3)
          Builds a compound, with four arguments
Struct(java.lang.String f, Term at0, Term at1, Term at2, Term at3, Term at4)
          Builds a compound, with five arguments
Struct(java.lang.String f, Term at0, Term at1, Term at2, Term at3, Term at4, Term at5)
          Builds a compound, with six arguments
Struct(java.lang.String f, Term at0, Term at1, Term at2, Term at3, Term at4, Term at5, Term at6)
          Builds a compound, with seven arguments
Struct(Term[] argList)
          Builds a list specifying the elements
Struct(Term h, Term t)
          Builds a list providing head and tail
 
Method Summary
 Term copy()
          Gets a copy of this structure
 Term getArg(int index)
          Gets the i-th element of this structure No bound check is done
 Struct getArg(java.lang.String name)
          Gets an argument inside this structure, given its name
 int getArity()
          Gets the number of elements of this structure
 java.lang.String getName()
          Gets the functor name of this structure
 Term getTerm()
          Gets the actual term referred by this Term.
 Term getTerm(int index)
          Gets the i-th element of this structure No bound check is done.
 boolean isAtom()
          is this term a prolog (alphanumeric) atom?
 boolean isAtomic()
          is this term a constant prolog term?
 boolean isClause()
           
 boolean isCompound()
          is this term a prolog compound term?
 boolean isEmptyList()
          Is this structure an empty list?
 boolean isEqual(Term t)
          Tests if this term is (logically) equal to another
 boolean isGreater(Term t)
          is term greater than term t?
 boolean isGround()
          is this term a ground term?
 boolean isList()
          is this term a prolog list?
 boolean isNull()
          is this term a null term?
 boolean isNumber()
          is this term a prolog numeric term?
 boolean isStruct()
          is this term a struct
 boolean isVar()
          is this term a variable
 Term listHead()
          Gets the head of this structure supposed to be a list
 java.util.Iterator listIterator()
          Gets an iterator on the elements of this structure supposed to be a list
 int listSize()
          Gets the number of elements of this structure supposed to be a list
 Struct listTail()
          Gets the tail of this structure supposed to be alist
 java.lang.String toString()
          Gets the string representation of this structure Specific representations are provided for lists and atoms.
 
Methods inherited from class alice.tuprolog.Term
equals, getIterator, getRenamedCopy, match, parse, parse, resolveVariables, unify
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Struct

public Struct(java.lang.String f)
Builds a Struct representing an atom


Struct

public Struct(java.lang.String f,
              Term at0)
Builds a compound, with one argument


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1)
Builds a compound, with two arguments


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1,
              Term at2)
Builds a compound, with three arguments


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1,
              Term at2,
              Term at3)
Builds a compound, with four arguments


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1,
              Term at2,
              Term at3,
              Term at4)
Builds a compound, with five arguments


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1,
              Term at2,
              Term at3,
              Term at4,
              Term at5)
Builds a compound, with six arguments


Struct

public Struct(java.lang.String f,
              Term at0,
              Term at1,
              Term at2,
              Term at3,
              Term at4,
              Term at5,
              Term at6)
Builds a compound, with seven arguments


Struct

public Struct(java.lang.String f,
              Term[] argList)
Builds a compound, with an array of arguments


Struct

public Struct()
Builds a structure representing an empty list


Struct

public Struct(Term h,
              Term t)
Builds a list providing head and tail


Struct

public Struct(Term[] argList)
Builds a list specifying the elements

Method Detail

getArity

public int getArity()
Gets the number of elements of this structure


getName

public java.lang.String getName()
Gets the functor name of this structure


getArg

public Term getArg(int index)
Gets the i-th element of this structure No bound check is done


getTerm

public Term getTerm(int index)
Gets the i-th element of this structure No bound check is done. It is equivalent to getArg(index).getTerm()


isNumber

public boolean isNumber()
is this term a prolog numeric term?

Specified by:
isNumber in class Term

isStruct

public boolean isStruct()
is this term a struct

Specified by:
isStruct in class Term

isVar

public boolean isVar()
is this term a variable

Specified by:
isVar in class Term

isNull

public boolean isNull()
Description copied from class: Term
is this term a null term?

Specified by:
isNull in class Term

isAtomic

public boolean isAtomic()
Description copied from class: Term
is this term a constant prolog term?

Specified by:
isAtomic in class Term

isCompound

public boolean isCompound()
Description copied from class: Term
is this term a prolog compound term?

Specified by:
isCompound in class Term

isAtom

public boolean isAtom()
Description copied from class: Term
is this term a prolog (alphanumeric) atom?

Specified by:
isAtom in class Term

isList

public boolean isList()
Description copied from class: Term
is this term a prolog list?

Specified by:
isList in class Term

isGround

public boolean isGround()
Description copied from class: Term
is this term a ground term?

Specified by:
isGround in class Term

isClause

public boolean isClause()

getTerm

public Term getTerm()
Description copied from class: Term
Gets the actual term referred by this Term. if the Term is a bound variable, the method gets the Term linked to the variable

Specified by:
getTerm in class Term

getArg

public Struct getArg(java.lang.String name)
Gets an argument inside this structure, given its name

Parameters:
name - name of the structure
Returns:
the argument or null if not found

isGreater

public boolean isGreater(Term t)
Description copied from class: Term
is term greater than term t?

Specified by:
isGreater in class Term

isEqual

public boolean isEqual(Term t)
Description copied from class: Term
Tests if this term is (logically) equal to another

Specified by:
isEqual in class Term

copy

public Term copy()
Gets a copy of this structure

Specified by:
copy in class Term

isEmptyList

public boolean isEmptyList()
Is this structure an empty list?


listHead

public Term listHead()
Gets the head of this structure supposed to be a list


listTail

public Struct listTail()
Gets the tail of this structure supposed to be alist


listSize

public int listSize()
Gets the number of elements of this structure supposed to be a list


listIterator

public java.util.Iterator listIterator()
Gets an iterator on the elements of this structure supposed to be a list


toString

public java.lang.String toString()
Gets the string representation of this structure Specific representations are provided for lists and atoms. Names starting with upper case letter are enclosed in apices.



DEIS, Universita' di Bologna, Sede di Cesena