jpl

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


Field Summary
Stringname
Constructor Summary
Variable(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.
Variable()
Create a new Variable with new sequential name of the form "_261".
Method Summary
Term[]args()
The (nonexistent) args of this Variable
StringdebugString()
Returns a debug-friendly String representation of an Atom.
booleanequals(Object obj)
A Variable is equal to another if their names are the same and they are not anonymous.
Stringname()
returns the lexical name of this Variable
StringtoString()
Returns a Prolog source text representation of this Variable
inttype()
returns the type of this subclass of Term, i.e.
StringtypeName()
returns the typeName of this subclass of Term, i.e.

Field Detail

name

public final String name

Constructor Detail

Variable

public Variable(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()
Create a new Variable with new sequential name of the form "_261".

Method Detail

args

public Term[] args()
The (nonexistent) args of this Variable

Returns: the (nonexistent) args of this Variable (never)

Throws: JPLException

debugString

public String debugString()

Deprecated:

Returns a debug-friendly String representation of an Atom.

Returns: a debug-friendly String representation of an Atom

equals

public final boolean equals(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.

name

public final String name()
returns the lexical name of this Variable

Returns: the lexical name of this Variable

toString

public String toString()
Returns a Prolog source text representation of this Variable

Returns: a Prolog source text representation of this Variable

type

public final int type()
returns the type of this subclass of Term, i.e. Prolog.VARIABLE

Returns: the type of this subclass of Term, i.e. Prolog.VARIABLE

typeName

public String typeName()
returns the typeName of this subclass of Term, i.e. "Variable"

Returns: the typeName of this subclass of Term, i.e. "Variable"