Package alice.tuprolog
Class SolveInfo
- java.lang.Object
-
- alice.tuprolog.SolveInfo
-
- All Implemented Interfaces:
java.io.Serializable
public class SolveInfo extends java.lang.Object implements java.io.Serializable
SolveInfo class represents the result of a solve request made to the engine, providing information about the solution- See Also:
- Serialized Form
-
-
Method Summary
Modifier and Type Method Description java.util.List<Var>
getBindingVars()
Gets the list of the variables in the solution.Term
getQuery()
Gets the queryTerm
getSolution()
Gets the solution of the requestTerm
getTerm(java.lang.String varName)
Gets the value of a variable in the substitution.Term
getVarValue(java.lang.String varName)
Gets the value of a variable in the substitution.boolean
hasOpenAlternatives()
Checks if the solve request was haltedboolean
isHalted()
Checks if the solve request was haltedboolean
isSuccess()
Checks if the solve request was successfulboolean
isTimeout()
java.lang.String
toString()
Returns the string representation of the result of the demonstration.
-
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
Checks if the solve request was successful- Returns:
- true if the solve was successful
-
isHalted
public boolean isHalted()
Checks if the solve request was halted- Returns:
- true if the solve was successful
-
isTimeout
public boolean isTimeout()
-
hasOpenAlternatives
public boolean hasOpenAlternatives()
Checks if the solve request was halted- Returns:
- true if the solve was successful
-
getQuery
public Term getQuery()
Gets the query- Returns:
- the query
-
getSolution
public Term getSolution() throws NoSolutionException
Gets the solution of the request- Throws:
NoSolutionException
- if the solve request has not solution
-
getBindingVars
public java.util.List<Var> getBindingVars() throws NoSolutionException
Gets the list of the variables in the solution.- Returns:
- the array of variables.
- Throws:
NoSolutionException
- if current solve information does not concern a successful
-
getTerm
public Term getTerm(java.lang.String varName) throws NoSolutionException, UnknownVarException
Gets the value of a variable in the substitution.- Throws:
NoSolutionException
- if the solve request has no solutionUnknownVarException
- if the variable does not appear in the substitution.
-
getVarValue
public Term getVarValue(java.lang.String varName) throws NoSolutionException
Gets the value of a variable in the substitution. Returnsnull
if the variable does not appear in the substitution.- Throws:
NoSolutionException
-
toString
public java.lang.String toString()
Returns the string representation of the result of the demonstration.For successful demonstration, the representation concerns variables with bindings. For failed demo, the method returns false string.
- Overrides:
toString
in classjava.lang.Object
-
-