public class Bindings
extends java.lang.Object
Bindings
handles the variable bindings in the
communication with the prolog server. Using variable bindings ensures that
the values are properly quoted when sent to the prolog server.Constructor and Description |
---|
Bindings()
Creates a new
Bindings instance with no
variable bindings. |
Bindings(Bindings binds)
Creates a new
Bindings instance and copies
all existing variable bindings from the specified bindings. |
Modifier and Type | Method and Description |
---|---|
Bindings |
bind(java.lang.String name,
double doublevalue)
Adds the specified variable binding.
|
Bindings |
bind(java.lang.String name,
float floatvalue)
Adds the specified variable binding.
|
Bindings |
bind(java.lang.String name,
int intvalue)
Adds the specified variable binding.
|
Bindings |
bind(java.lang.String name,
long longvalue)
Adds the specified variable binding.
|
Bindings |
bind(java.lang.String name,
PBTerm termvalue)
Adds the specified variable binding.
|
Bindings |
bind(java.lang.String name,
java.lang.String stringvalue)
Adds the specified variable binding.
|
Bindings |
bindAtom(java.lang.String name,
java.lang.String atomvalue)
Adds the specified variable binding.
|
PBTerm |
getValue(java.lang.String name)
Returns the value for the specified variable or
null if the
variable is not bound. |
java.lang.String |
toString() |
public Bindings()
Bindings
instance with no
variable bindings.public Bindings bind(java.lang.String name, int intvalue)
name
- a prolog variable nameintvalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bind(java.lang.String name, long longvalue)
name
- a prolog variable namelongvalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bind(java.lang.String name, float floatvalue)
name
- a prolog variable namefloatvalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bind(java.lang.String name, double doublevalue)
name
- a prolog variable namedoublevalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bind(java.lang.String name, java.lang.String stringvalue)
name
- a prolog variable namestringvalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bind(java.lang.String name, PBTerm termvalue)
name
- a prolog variable nametermvalue
- the value to bind to the variableBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic Bindings bindAtom(java.lang.String name, java.lang.String atomvalue)
name
- a prolog variable nameatomvalue
- the value to bind to the variable as an atomBindings
object{@if.java
- java.lang. }IllegalArgumentException if the name is not
a valid prolog variable namepublic PBTerm getValue(java.lang.String name)
null
if the
variable is not bound.name
- the name of the variablePBTerm
or null
if the variable is not boundpublic java.lang.String toString()
toString
in class java.lang.Object