Inherits Callable< Result >.
Public Member Functions | |
Result | call () throws SyntaxException, EvaluationException |
boolean | isValid () |
boolean | cancel () |
boolean | isDone () |
boolean | isCancelled () |
Result | get () |
Result | get_ () throws SyntaxException, EvaluationException |
Static Public Member Functions | |
static void | shutDown () |
static Solver | evaluate (String line) |
static Solver | evaluate (String[] lines) |
static Solver | evaluate (List< String > lines) |
static Solver | evaluate (Script script) |
static Result | evaluate (String line) |
static Result | evaluate (List< String > lines) |
static Result | evaluate (String[] lines) |
static Result | evaluate (Script script) |
static Result | evaluate_ (String line) throws SyntaxException, EvaluationException |
static Result | evaluate_ (String[] lines) throws SyntaxException, EvaluationException |
static Result | evaluate_ (List< String > lines) throws SyntaxException, EvaluationException |
This class is similar to Solver in that it has static evaluate() methods to evaluate an expression or script, but now done in its own thread. These methods are suitable for very complex expressions and algorithms that may block the main process thread.
Since the script is being evaluated in their own thread the result will not be known until some future time. It is only when the user attempts to retrieve the evaluation result that any errors have to be dealt with.
All the evaluate methods return a Solve$ object. This object can be used to retrieve the evaluation result using either the get() or get_() methods. Calling either of these two methods will block the calling thread until the task has completed, either because the evaluation ended normally, was cancelled or a syntax / evaluation error occurred. The Solve$ object can also be used (in a non-blocking way) to cancel the task, see if task is done or has been cancelled.
If the get() method is used to retrieve the result any errors are simply outputted to the Java console (BASIC mode). If the get_() method is used (EXPERT mode) then the user much catch any SyntaxException or EvaluationException thrown.
the script has completed The methods fall into two categories depending on how exceptions (initialization and runtime errors) are handled -
This class has static methods to provide a simple API for users to evaluate an expression or script in the main process thread. They should only be used when the expected evaluation time is to be very short. A long evaluation time can make the application unresponsive.
The methods fall into two categories depending on how exceptions (parsing and runtime errors) are handled -
Result org.qscript.Solver.call | ( | ) | throws SyntaxException, EvaluationException |
Call by the
boolean org.qscript.Solver.cancel | ( | ) |
/** Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel
is called, this task should never run.
After this method returns, subsequent calls to isDone will always return true. Subsequent calls to isCancelled will always return true if this method returned true.
|
static |
Basic Mode:
Evaluate a single line of q-script.
line | a single line of q-script |
|
static |
Basic Mode:
Evaluate a single line of q-script.
line | a single line of q-script |
|
static |
Basic Mode:
Evaluate multiple lines of q-script.
lines | a list of lines of q-script |
|
static |
Basic Mode:
Evaluate multiple lines of q-script.
lines | an array of lines of q-script |
|
static |
Basic Mode:
Evaluate multiple lines of q-script.
lines | an array of lines of q-script |
|
static |
Basic Mode:
Evaluate multiple lines of q-script.
lines | a list of lines of q-script |
Basic Mode:
Evaluate a q-script.
script | a q-script |
|
static |
Expert Mode:
If you use this method then you are responsible to catch any exceptions thrown.
line | a single line of q-script |
SyntaxException | |
EvaluationException |
|
static |
Expert Mode:
If you use this method then you are responsible to catch any exceptions thrown.
Evaluate multiple lines of q-script.
lines | an array of lines of q-script |
SyntaxException | |
EvaluationException |
|
static |
Expert Mode:
If you use this method then you are responsible to catch any exceptions thrown.
Evaluate multiple lines of q-script.
lines | a list of lines of q-script |
SyntaxException | |
EvaluationException |
Result org.qscript.Solver.get | ( | ) |
Get the result of the evaluation if it is not ready yet then it will block the calling thread until the evaluation is complete.
Result org.qscript.Solver.get_ | ( | ) | throws SyntaxException, EvaluationException |
Get the result of the evaluation if it is not ready yet then it will block the calling thread until the evaluation is complete.
SyntaxException | |
EvaluationException |
boolean org.qscript.Solver.isCancelled | ( | ) |
Returns true if this task was cancelled before it completed normally.
boolean org.qscript.Solver.isDone | ( | ) |
Returns true if this task has completed (for any reason)
boolean org.qscript.Solver.isValid | ( | ) |
Returns true if this is a valid Solver$ object i.e. has a script
|
static |
Need to call this to release resources