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 Var

    java.lang.Object
      alice.tuprolog.Term
          alice.tuprolog.Var

All Implemented Interfaces:
  java.io.Serializable

public class Var
extends Term

This class represents a variable term. Variables are identified by a name (which must starts with an upper case letter) or the anonymous ('_') name.

See Also:
  `Term`, Serialized Form

Field Summary

Fields inherited from class alice.tuprolog.Term
`FALSE, TRUE`

Constructor Summary
`Var()` Creates an anonymous variable This is equivalent to build a variable with name _
`Var(java.lang.String n)` Creates a variable identified by a name.

Method Summary
`void` | `free()` De-unify the variable
`static void` | `free(java.util.List varsUnified)` De-unify the variables of list
`java.lang.String` | `getName()` Gets the name of the variable
`java.lang.String` | `getOriginalName()` Gets the name of the variable
`Term` | `getTerm()` Gets the term which is referred by the variable.
`boolean` | `isAnonymous()` Tests if this variable is ANY
`boolean` | `isAtom()` is this term a prolog (alphanumeric) atom?
`boolean` | `isAtomic()` is this term a constant prolog term?
`boolean` | `isBound()` Tests if this variable is bound
`boolean` | `isCompound()` is this term a prolog compound term?
`boolean` | `isEmptyList()` is this term a null term?
`boolean` | `isEqual(Term t)` Tests if this term is (logically) equal to another
`boolean` | `isGreater(Term t)` Gets a copy of this variable
`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` | `isStruct()` is this term a struct?
`boolean` | `isVar()` is this term a variable?
`java.lang.String` | `toString()` Gets the string representation of this variable.
`java.lang.String` | `toStringFlattened()` Gets the string representation of this variable, providing the string representation of the linked term in the case of bound variable

Methods inherited from class alice.tuprolog.Term
`copyGoal, copyResult, createTerm, createTerm, equals, getIterator, iteratedGoalTerm, match, parse, parse, resolveTerm, unify`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Var

    public Var(java.lang.String n)
        throws InvalidTermException

  Creates a variable identified by a name. The name must starts with an upper case letter or the underscore. If an underscore is specified as a name, the variable is anonymous.

Parameters:
  `n` - is the name
Throws:
  `InvalidTermException` - if n is not a valid name

### Var

    public Var()

  Creates an anonymous variable This is equivalent to build a variable with name _

Method Detail

### free

    public void free()

  De-unify the variable

  Specified by:
    `free` in class `Term`

### free

    public static void free(java.util.List varsUnified)

  De-unify the variables of list

### getName

    public java.lang.String getName()

  Gets the name of the variable

### getOriginalName

    public java.lang.String getOriginalName()

  Gets the name of the variable

### getTerm

    public Term getTerm()

  Gets the term which is referred by the variable. For unbound variable it is the variable itself, while for bound variable it is the bound term.

  Specified by:
    `getTerm` in class `Term`

### isNumber

    public boolean isNumber()

  Description copied from class: `Term`
  is this term a prolog numeric term?

  Specified by:
    `isNumber` in class `Term`

### isStruct

    public boolean isStruct()

  Description copied from class: `Term`
  is this term a struct?

  Specified by:
    `isStruct` in class `Term`

### isVar

    public boolean isVar()

  Description copied from class: `Term`
  is this term a variable?

  Specified by:
    `isVar` in class `Term`

### isEmptyList

    public boolean isEmptyList()

  Description copied from class: `Term`
  is this term a null term?

  Specified by:
    `isEmptyList` 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`

### isAnonymous

    public boolean isAnonymous()

  Tests if this variable is ANY

### isBound

    public boolean isBound()

  Tests if this variable is bound

### isGreater

    public boolean isGreater(Term t)

  Gets a copy of this variable

  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`

### toString

    public java.lang.String toString()

  Gets the string representation of this variable. For bounded variables, the string is /.

### toStringFlattened

    public java.lang.String toStringFlattened()

  Gets the string representation of this variable, providing the string representation of the linked term in the case of bound variable

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