Package dev.zemco.codegame.evaluation
Class EvaluationService
java.lang.Object
dev.zemco.codegame.evaluation.EvaluationService
- All Implemented Interfaces:
IEvaluationService
Implementation of business logic related to evaluation of solutions of
problems.
This implementation uses an evaluation strategy for the evaluation,
and the SolutionEvaluator for controlling the flow of the evaluation.- Author:
- Erik Zemčík
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEvaluationService(IExecutionService executionService, IEvaluationStrategy evaluationStrategy) Creates an instance ofEvaluationService. -
Method Summary
Modifier and TypeMethodDescriptionbooleanevaluateSolutionOnAllProblemCases(Program solution, Problem problem) getEvaluatorForProblemCaseSolution(Program solution, ProblemCase problemCase)
-
Constructor Details
-
EvaluationService
public EvaluationService(IExecutionService executionService, IEvaluationStrategy evaluationStrategy) Creates an instance ofEvaluationService.- Parameters:
executionService- execution service for creating the underlying executions to be evaluatedevaluationStrategy- evaluation strategy to use for evaluation- Throws:
IllegalArgumentException- ifexecutionServiceisnullor ifevaluationStrategyisnull
-
-
Method Details
-
evaluateSolutionOnAllProblemCases
Description copied from interface:IEvaluationService- Specified by:
evaluateSolutionOnAllProblemCasesin interfaceIEvaluationService- Parameters:
solution- solution program to evaluateproblem- problem to evaluate against- Returns:
- true if the solution has passed all the problems cases, else false
-
getEvaluatorForProblemCaseSolution
public ISolutionEvaluator getEvaluatorForProblemCaseSolution(Program solution, ProblemCase problemCase) Description copied from interface:IEvaluationServiceProvides anevalutorfor the solutionprogramagainst the given specificproblem case. This approach is recommended when the state of the underlying execution needs to be observed during the evaluation.- Specified by:
getEvaluatorForProblemCaseSolutionin interfaceIEvaluationService- Parameters:
solution- solution program to evaluateproblemCase- problem case to evaluate against- Returns:
- evaluator for the given problem case
-