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
the name of this Variable
|
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[] |
args()
The (nonexistent) args of this Variable
|
int |
arity()
returns, as an int, the arity of a Term
|
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.String |
name()
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.
|
arg, atomType, bigValue, doubleValue, floatValue, intValue, isAtom, isBigInteger, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isListNil, isListPair, isVariable, jrefToObject, listLength, longValue, objectToJRef, putParams, putTerm, toString, toTermArray
public Variable()
public Variable(java.lang.String name)
name
- the source name of this Variablepublic Term[] args()
args
in class Term
JPLException
public int arity()
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The Object to compare.public boolean hasFunctor(java.lang.String name, int arity)
Term
hasFunctor
in class Term
public boolean hasFunctor(int value, int arity)
Term
hasFunctor
in class Term
public boolean hasFunctor(double value, int arity)
Term
hasFunctor
in class Term
public final java.lang.String name()
public java.lang.String toString()
toString
in class java.lang.Object
public final int type()