Package dev.zemco.codegame.evaluation
Class SolutionEvaluator
java.lang.Object
dev.zemco.codegame.evaluation.SolutionEvaluator
- All Implemented Interfaces:
ISolutionEvaluator
Implementation of a
solution evaluator that evaluates an underlying
execution context against a specific problem case using
an evaluation strategy.- Author:
- Erik Zemčík
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionEvaluator(IExecutionContext executionContext, IEvaluationStrategy evaluationStrategy, ProblemCase problemCase) Creates an instance ofSolutionEvaluator. -
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.
-
Constructor Details
-
SolutionEvaluator
public SolutionEvaluator(IExecutionContext executionContext, IEvaluationStrategy evaluationStrategy, ProblemCase problemCase) Creates an instance ofSolutionEvaluator.- Parameters:
executionContext- execution context to evaluateevaluationStrategy- evaluation strategy to use for evaluationproblemCase- problem case to evaluate against- Throws:
IllegalArgumentException- if any parameter isnull
-
-
Method Details
-
hasFinished
public boolean hasFinished()Description copied from interface:ISolutionEvaluatorChecks if the evaluator has finished its evaluation.- Specified by:
hasFinishedin interfaceISolutionEvaluator- Returns:
- true if evaluator has finished, else false
-
isSuccessful
public boolean isSuccessful()Description copied from interface:ISolutionEvaluatorChecks if the evaluation of theexecution contextis successful. Result of this method should only be considered if the evaluatorhas finishedits evaluation.- Specified by:
isSuccessfulin interfaceISolutionEvaluator- Returns:
- true if the evaluation has ended and is successful, else false
-
getExecutionContext
Description copied from interface:ISolutionEvaluatorReturns theexecution contextthat is being evaluated by the evaluator.- Specified by:
getExecutionContextin interfaceISolutionEvaluator- Returns:
- evaluated execution context
-
step
public void step()Description copied from interface:ISolutionEvaluatorSteps 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.- Specified by:
stepin interfaceISolutionEvaluator
-