Package dev.zemco.codegame.evaluation
Interface ISolutionEvaluator
- All Known Implementing Classes:
SolutionEvaluator,TimeoutSolutionEvaluatorDecorator
public interface ISolutionEvaluator
Evaluates an underlying
execution context on set rules.
These rules typically match a specific problem case, which
solution for is being evaluated for.- Author:
- Erik Zemčík
-
Method Summary
Modifier and TypeMethodDescriptionReturns theexecution contextthat is being evaluated by the evaluator.booleanChecks if the evaluator has finished its evaluation.booleanChecks if the evaluation of theexecution contextis successful.voidstep()Steps the underlying execution and checks if the new state satisfies the rules being evaluated.
-
Method Details
-
hasFinished
boolean hasFinished()Checks if the evaluator has finished its evaluation.- Returns:
- true if evaluator has finished, else false
-
isSuccessful
boolean isSuccessful()Checks if the evaluation of theexecution contextis successful. Result of this method should only be considered if the evaluatorhas finishedits evaluation.- Returns:
- true if the evaluation has ended and is successful, else false
-
getExecutionContext
IExecutionContext getExecutionContext()Returns theexecution contextthat is being evaluated by the evaluator.- Returns:
- evaluated execution context
-
step
void step()Steps the underlying execution and checks if the new state satisfies the rules being evaluated. If the underlying execution throws an exception, the evaluation is considered finished as a failure and theStepEvaluationExceptionis thrown with the details of the failure.- Throws:
StepEvaluationException- if underlying execution threw an exception during the stepIllegalStateException- if step was attempted when evaluation has already finished
-