public class QueryAnswer extends Bindings
The QueryAnswer
is returned by PrologSession
in response to a
query and contains variable bindings, errors, and success/failure
information. It also contains the variable bindings specified in the query.
Note that this implementation is not synchronized.
Constructor and Description |
---|
QueryAnswer(PBTerm answer,
Bindings bindings)
Creates a new
QueryAnswer instance with the specified
information. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getError()
Returns the error reason or
null if an error has not occurred or
if no error reason is known. |
PBTerm |
getValue(java.lang.String variable)
Returns the value of the specified variable or
null if the
variable is not bound. |
boolean |
isError()
Returns
true if an error occurred while processing the query and
false otherwise. |
boolean |
queryFailed()
Returns
true if the query failed (i.e. the Prolog responded with
'no') and false otherwise. |
java.lang.String |
toString()
Returns a string description of this answer.
|
public PBTerm getValue(java.lang.String variable)
null
if the
variable is not bound.public boolean queryFailed()
true
if the query failed (i.e. the Prolog responded with
'no') and false
otherwise.public boolean isError()
true
if an error occurred while processing the query and
false
otherwise.public java.lang.String getError()
null
if an error has not occurred or
if no error reason is known.