## jpl
Class Variable

    java.lang.Object
      jpl.Term
          jpl.Variable

public class Variable
extends Term

This class supports Java representations of Prolog variables.

A jpl.Variable instance is equivalent to a variable in a fragment of Prolog source text: it is *not* a "live" variable within a Prolog stack or heap. A corresponding Prolog variable is created only upon opening a Query whose goal refers to a Variable (and then only temporarily).

Copyright (C) 2004 Paul Singleton

Copyright (C) 1998 Fred Dushin

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.

Version:
  $Revision: 1.2 $

Field Summary
`java.lang.String` `name`

Constructor Summary
`Variable()` Deprecated. use Variable(String name) instead
`Variable(java.lang.String name)` Create a new Variable with 'name' (which must not be null or ""), and may one day be constrained to comply with traditional Prolog syntax.

Method Summary
`Term[]` `args()` Deprecated.
`java.lang.String` `debugString()` Deprecated.
`boolean` `equals(java.lang.Object obj)` A Variable is equal to another if their names are the same and they are not anonymous.
`java.lang.String` `name()` returns the lexical name of this Variable
`java.lang.String` `toString()` Returns a Prolog source text representation of this Variable
`int` `type()` returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
`java.lang.String` `typeName()` returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc

Methods inherited from class jpl.Term
`arg, arity, debugString, doubleValue, floatValue, hasFunctor, hasFunctor, hasFunctor, intValue, isAtom, isCompound, isFloat, isInteger, isJBoolean, isJRef, isJVoid, isVariable, listLength, longValue, putParams, putParams, toString, toTermArray`

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

Field Detail

### name

    public final java.lang.String name

Constructor Detail

### Variable

    public Variable(java.lang.String name)

  Create a new Variable with 'name' (which must not be null or ""), and may one day be constrained to comply with traditional Prolog syntax.

Parameters:
  `name` - the source name of this Variable

### Variable

    public Variable()

  Deprecated. use Variable(String name) instead

  Create a new Variable with new sequential name of the form "_261".

Method Detail

### name

    public final java.lang.String name()

  returns the lexical name of this Variable

  Overrides:
    `name` in class `Term`
  Returns:
    the lexical name of this Variable

### toString

    public java.lang.String toString()

  Returns a Prolog source text representation of this Variable

  Returns:
    a Prolog source text representation of this Variable

### equals

    public final boolean equals(java.lang.Object obj)

  A Variable is equal to another if their names are the same and they are not anonymous.

  Parameters:
    `obj` - The Object to compare.
  Returns:
    true if the Object is a Variable and the above condition apply.

### type

    public final int type()

  Description copied from class: `Term`
  returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc

  Specified by:
    `type` in class `Term`
  Returns:
    the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc

### typeName

    public java.lang.String typeName()

  Description copied from class: `Term`
  returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc

  Specified by:
    `typeName` in class `Term`
  Returns:
    the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc

### args

    public Term[] args()

  Deprecated.

  The (nonexistent) args of this Variable

  Specified by:
    `args` in class `Term`
  Returns:
    the (nonexistent) args of this Variable

### debugString

    public java.lang.String debugString()

  Deprecated.

  Returns a debug-friendly String representation of an Atom.

  Specified by:
    `debugString` in class `Term`
  Returns:
    a debug-friendly String representation of an Atom