se.sics.prologbeans
Class Bindings


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 Summary
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.
 
Method Summary
public Bindings bind(string name, int intvalue)
Adds the specified variable binding.
public Bindings bind(string name, long longvalue)
Adds the specified variable binding.
public Bindings bind(string name, float floatvalue)
Adds the specified variable binding.
public Bindings bind(string name, double doublevalue)
Adds the specified variable binding.
public Bindings bind(string name, string stringvalue)
Adds the specified variable binding.
public Bindings bind(string name, PBTerm termvalue)
Adds the specified variable binding.
public Bindings bindAtom(string name, string atomvalue)
Adds the specified variable binding.
public PBTerm getValue(string name)
Returns the value for the specified variable or null if the variable is not bound.
public string toString()
   
Constructor Detail

Bindings

Bindings()
Creates a new Bindings instance with no variable bindings.


Bindings

Bindings(Bindings binds)
Creates a new Bindings instance and copies all existing variable bindings from the specified bindings.

Parameters:
binds - the variable bindings to copy

 
Method Detail

bind

public Bindings bind(string name, int intvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
intvalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bind

public Bindings bind(string name, long longvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
longvalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bind

public Bindings bind(string name, float floatvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
floatvalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bind

public Bindings bind(string name, double doublevalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
doublevalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bind

public Bindings bind(string name, string stringvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
stringvalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bind

public Bindings bind(string name, PBTerm termvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'.

Parameters:
name - a prolog variable name
termvalue - the value to bind to the variable
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

bindAtom

public Bindings bindAtom(string name, string atomvalue)
Adds the specified variable binding. The variable name must start with an upper case letter or '_'. The value will be bound as an atom.

Parameters:
name - a prolog variable name
atomvalue - the value to bind to the variable as an atom
Returns:
a reference to this Bindings object
Throws:
{@if.java - java.lang.}IllegalArgumentException if the name is not a valid prolog variable name

getValue

public PBTerm getValue(string name)
Returns the value for the specified variable or null if the variable is not bound.

Parameters:
name - the name of the variable
Returns:
the value of the variable as a Term or null if the variable is not bound

toString

public string toString()