public class Variable extends Term
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) 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.
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
name |
| Constructor and Description |
|---|
Variable()
Create a new Variable with new sequential name of the form "_261".
|
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.
|
| Modifier and Type | Method and Description |
|---|---|
Term |
arg(int i)
throws a JPLException (arg(int) is defined only for Compound and Atom)
|
Term[] |
args()
The (nonexistent) args of this Variable
|
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.
|
boolean |
hasFunctor(double value,
int arity)
Tests whether this Term's functor has (double) 'name' and 'arity'
Returns false if called inappropriately
|
boolean |
hasFunctor(int value,
int arity)
Tests whether this Term's functor has (int) 'name' and 'arity'
Returns false if called inappropriately
|
boolean |
hasFunctor(java.lang.String name,
int arity)
Tests whether this Term's functor has (String) 'name' and 'arity'
Returns false if called inappropriately
|
java.lang.Object |
jrefToObject() |
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 subclass of Term, i.e.
|
java.lang.String |
typeName()
returns the typeName of this subclass of Term, i.e.
|
arity, debugString, doubleValue, floatValue, intValue, isAtom, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isVariable, listLength, longValue, objectToJRef, put, putParams, putParams, putTerm, toString, toTermArraypublic Variable(java.lang.String name)
name - the source name of this Variablepublic Variable()
public Term[] args()
args in class TermJPLExceptionpublic boolean hasFunctor(java.lang.String name,
int arity)
TermhasFunctor in class Termpublic boolean hasFunctor(int value,
int arity)
TermhasFunctor in class Termpublic boolean hasFunctor(double value,
int arity)
TermhasFunctor in class Termpublic java.lang.Object jrefToObject()
jrefToObject in class Termpublic final java.lang.String name()
public final int type()
public java.lang.String typeName()
public java.lang.String toString()
toString in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The Object to compare.public final Term arg(int i)
public java.lang.String debugString()
debugString in class Term