Interface ISolutionModel
- All Known Implementing Classes:
SolutionModel
problem.
Problem being solved is accessible via problemProperty().
A new solution should be triggered by resetAttempt().
Each solution attempt to be compiled via compileSolution(String). Availability of compilation
should be checked through canCompileProperty(). If the compilation fails, related error
information is accessible through syntaxErrorProperty().
For a given solution attempt, test evaluation is possible, and can be started using startTestEvaluation().
Availability of starting the test evaluation should be checked through canEvaluateProperty().
Information about the state of the evaluation is available through nextInstructionLinePositionProperty(),
memoryCellsProperty(), and evaluationRunningProperty().
Evaluation can be stepped via stepTestEvaluation(), when indicated via canStepProperty().
If the evaluation encounters an execution error, the error becomes available through
executionErrorProperty(). Evaluation can be stopped via stopTestEvaluation().
Solution can be submitted via submitSolution(), when indicated via canSubmitProperty().
- Author:
- Erik Zemčík
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.value.ObservableBooleanValueProperty indicating if compilation of player's solution is available.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution is available.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution can be stepped.javafx.beans.value.ObservableBooleanValueProperty indicating if of player's solution can be submitted.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution is running.javafx.beans.value.ObservableObjectValue<ISolutionErrorModel>Property holding the lastsolution error modelindicating error during execution of the test evaluation of player's solution.javafx.beans.value.ObservableObjectValue<javafx.collections.ObservableList<IMemoryCellObserver>>Property holdingmemory cell observersfor observing memory state during the test evaluation.javafx.beans.value.ObservableObjectValue<Integer>Property indicating next instruction line position to execute during test evaluation of player's solution.javafx.beans.value.ObservableObjectValue<Problem>Property holding the targetproblemthat is being solved.javafx.beans.value.ObservableObjectValue<ISolutionErrorModel>Property holding the lastsolution error modelindicating syntax error in the player's solution source code. -
Method Summary
Modifier and TypeMethodDescriptionjavafx.beans.value.ObservableBooleanValueProperty indicating if compilation of player's solution is available.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution is available.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution can be stepped.javafx.beans.value.ObservableBooleanValueProperty indicating if of player's solution can be submitted.voidcompileSolution(String sourceCode) Attempts to compile the player's solution.javafx.beans.value.ObservableBooleanValueProperty indicating if test evaluation of player's solution is running.javafx.beans.value.ObservableObjectValue<ISolutionErrorModel>Property holding the lastsolution error modelindicating error during execution of the test evaluation of player's solution.javafx.beans.value.ObservableObjectValue<javafx.collections.ObservableList<IMemoryCellObserver>>Property holdingmemory cell observersfor observing memory state during the test evaluation.javafx.beans.value.ObservableObjectValue<Integer>Property indicating next instruction line position to execute during test evaluation of player's solution.javafx.beans.value.ObservableObjectValue<Problem>Property holding the targetproblemthat is being solved.voidTriggers a new solution attempt.voidStarts test evaluation of the player's solution on test problem case.voidSteps test evaluation of the player's solution.voidStops test evaluation of the player's solution.booleanAttempts to submit the player's solution.javafx.beans.value.ObservableObjectValue<ISolutionErrorModel>Property holding the lastsolution error modelindicating syntax error in the player's solution source code.
-
Property Details
-
problem
javafx.beans.value.ObservableObjectValue<Problem> problemPropertyProperty holding the targetproblemthat is being solved. -
canCompile
javafx.beans.value.ObservableBooleanValue canCompilePropertyProperty indicating if compilation of player's solution is available. -
canEvaluate
javafx.beans.value.ObservableBooleanValue canEvaluatePropertyProperty indicating if test evaluation of player's solution is available. -
canStep
javafx.beans.value.ObservableBooleanValue canStepPropertyProperty indicating if test evaluation of player's solution can be stepped. -
evaluationRunning
javafx.beans.value.ObservableBooleanValue evaluationRunningPropertyProperty indicating if test evaluation of player's solution is running. -
canSubmit
javafx.beans.value.ObservableBooleanValue canSubmitPropertyProperty indicating if of player's solution can be submitted. -
nextInstructionLinePosition
javafx.beans.value.ObservableObjectValue<Integer> nextInstructionLinePositionPropertyProperty indicating next instruction line position to execute during test evaluation of player's solution. This property may holdnullwhen the position is not available. -
memoryCells
javafx.beans.value.ObservableObjectValue<javafx.collections.ObservableList<IMemoryCellObserver>> memoryCellsPropertyProperty holdingmemory cell observersfor observing memory state during the test evaluation. This property may holdnullwhen the evaluation is not running. -
syntaxError
javafx.beans.value.ObservableObjectValue<ISolutionErrorModel> syntaxErrorPropertyProperty holding the lastsolution error modelindicating syntax error in the player's solution source code. This property may holdnullif no syntax error was found for the current solution. -
executionError
javafx.beans.value.ObservableObjectValue<ISolutionErrorModel> executionErrorPropertyProperty holding the lastsolution error modelindicating error during execution of the test evaluation of player's solution. This property may holdnullif no execution error was found at the current state of evaluation.
-
-
Method Details
-
resetAttempt
void resetAttempt()Triggers a new solution attempt. -
compileSolution
Attempts to compile the player's solution. Availability of compilation can be checked via thecan compile property.- Parameters:
sourceCode- source code of the player's solution- Throws:
IllegalArgumentException- ifsourceCodeisnullIllegalStateException- if compilation is not available
-
startTestEvaluation
void startTestEvaluation()Starts test evaluation of the player's solution on test problem case. Availability of test evaluation can be checked via thecan evaluate property.- Throws:
IllegalStateException- if starting of test evaluation is not available
-
stepTestEvaluation
void stepTestEvaluation()Steps test evaluation of the player's solution. Test evaluation can be stepped when it isrunning.- Throws:
IllegalStateException- if the execution is not running
-
stopTestEvaluation
void stopTestEvaluation()Stops test evaluation of the player's solution. Test evaluation can be stopped when it isrunning.- Throws:
IllegalStateException- if the execution is not running
-
submitSolution
boolean submitSolution()Attempts to submit the player's solution. If the submission succeeds, the solution is considered valid for the givenproblem. Availability of submission can be checked via thecan submit property.- Returns:
- true if the submission succeeded, else false
-
problemProperty
javafx.beans.value.ObservableObjectValue<Problem> problemProperty()Property holding the targetproblemthat is being solved. -
canCompileProperty
javafx.beans.value.ObservableBooleanValue canCompileProperty()Property indicating if compilation of player's solution is available. -
canEvaluateProperty
javafx.beans.value.ObservableBooleanValue canEvaluateProperty()Property indicating if test evaluation of player's solution is available. -
canStepProperty
javafx.beans.value.ObservableBooleanValue canStepProperty()Property indicating if test evaluation of player's solution can be stepped. -
evaluationRunningProperty
javafx.beans.value.ObservableBooleanValue evaluationRunningProperty()Property indicating if test evaluation of player's solution is running. -
canSubmitProperty
javafx.beans.value.ObservableBooleanValue canSubmitProperty()Property indicating if of player's solution can be submitted. -
nextInstructionLinePositionProperty
javafx.beans.value.ObservableObjectValue<Integer> nextInstructionLinePositionProperty()Property indicating next instruction line position to execute during test evaluation of player's solution. This property may holdnullwhen the position is not available. -
memoryCellsProperty
javafx.beans.value.ObservableObjectValue<javafx.collections.ObservableList<IMemoryCellObserver>> memoryCellsProperty()Property holdingmemory cell observersfor observing memory state during the test evaluation. This property may holdnullwhen the evaluation is not running. -
syntaxErrorProperty
javafx.beans.value.ObservableObjectValue<ISolutionErrorModel> syntaxErrorProperty()Property holding the lastsolution error modelindicating syntax error in the player's solution source code. This property may holdnullif no syntax error was found for the current solution. -
executionErrorProperty
javafx.beans.value.ObservableObjectValue<ISolutionErrorModel> executionErrorProperty()Property holding the lastsolution error modelindicating error during execution of the test evaluation of player's solution. This property may holdnullif no execution error was found at the current state of evaluation.
-