Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## alice.tuprolog
Class Struct

    java.lang.Object
      alice.tuprolog.Term
          alice.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
`void` | `append(Term t)` Appends an element to this structure supposed to be a list
`void` | `free()` dummy method
`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
`PrimitiveInfo` | `getPrimitive()` Get primitive behaviour associated at 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()` Check is this struct is clause or directive
`boolean` | `isCompound()` is this term a prolog compound term?
`boolean` | `isEmptyList()` Is this structure an empty list?
`boolean` | `isEqual(Term t)` Test if a term is equal to other
`boolean` | `isGreater(Term t)` Test if a term is greater than other
`boolean` | `isGround()` is this term a ground term?
`boolean` | `isList()` is this term a prolog list?
`boolean` | `isNumber()` is this term a prolog numeric term?
`boolean` | `isPrimitive()` Check if this term is a primitive struct
`boolean` | `isStruct()` is this term a struct
`boolean` | `isVar()` is this term a variable
`Term` | `iteratedGoalTerm()` The iterated-goal term G of a term T is a term defined recursively as follows: if T unifies with ^(_, Goal) then G is the iterated-goal term of Goal else G is T
`Term` | `listHead()` Gets the head of this structure, which is supposed to be a list.
`java.util.Iterator` | `listIterator()` Gets an iterator on the elements of this structure, which is supposed to be a list.
`int` | `listSize()` Gets the number of elements of this structure, which is supposed to be a list.
`Struct` | `listTail()` Gets the tail of this structure, which is supposed to be a list.
`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
`copyGoal, copyResult, createTerm, createTerm, equals, getIterator, match, parse, parse, resolveTerm, unify`

Methods inherited from class java.lang.Object
`clone, finalize, 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`

### 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()

  Check is this struct is clause or directive

### 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)

  Test if a term is greater than other

  Specified by:
    `isGreater` in class `Term`

### isEqual

    public boolean isEqual(Term t)

  Test if a term is equal to other

  Specified by:
    `isEqual` in class `Term`

### isEmptyList

    public boolean isEmptyList()

  Is this structure an empty list?

  Specified by:
    `isEmptyList` in class `Term`

### listHead

    public Term listHead()

  Gets the head of this structure, which is supposed to be a list.

  Gets the head of this structure, which is supposed to be a list. If the callee structure is not a list, throws an `UnsupportedOperationException`

### listTail

    public Struct listTail()

  Gets the tail of this structure, which is supposed to be a list.

  Gets the tail of this structure, which is supposed to be a list. If the callee structure is not a list, throws an `UnsupportedOperationException`

### listSize

    public int listSize()

  Gets the number of elements of this structure, which is supposed to be a list.

  Gets the number of elements of this structure, which is supposed to be a list. If the callee structure is not a list, throws an `UnsupportedOperationException`

### listIterator

    public java.util.Iterator listIterator()

  Gets an iterator on the elements of this structure, which is supposed to be a list.

  Gets an iterator on the elements of this structure, which is supposed to be a list. If the callee structure is not a list, throws an `UnsupportedOperationException`

### append

    public void append(Term t)

  Appends an element to this structure supposed to be a list

### free

    public void free()

  dummy method

  Specified by:
    `free` in class `Term`

### getPrimitive

    public PrimitiveInfo getPrimitive()

  Get primitive behaviour associated at structure

### isPrimitive

    public boolean isPrimitive()

  Check if this term is a primitive struct

### 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.

### iteratedGoalTerm

    public Term iteratedGoalTerm()

  Description copied from class: `Term`
  The iterated-goal term G of a term T is a term defined recursively as follows:
  - if T unifies with ^(_, Goal) then G is the iterated-goal term of Goal
  - else G is T

  Overrides:
    `iteratedGoalTerm` in class `Term`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD