Package dev.zemco.codegame.problems
Class Problem
java.lang.Object
dev.zemco.codegame.problems.Problem
Problem is a challenge solvable by player.
Each problem consists of its
unique id, name,
description, difficulty, and problem cases.
Problems are immutable, and may be deserialized from JSON thanks to bindings from Jackson library.
- Author:
- Erik Zemčík
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCases()Returnsproblem casesused for validation of this problem's solution.Returns description of this problem.intReturns positive difficulty of this problem.getId()Returns unique identifier associated with this problem.getName()Returns name of this problem.toString()Returns formatted string identifying this problem.
-
Constructor Details
-
Problem
Creates an instance ofProblem.- Parameters:
id- unique identifier of the problemname- name of the problemdescription- description of the problemdifficulty- difficulty of the problemcases-listofproblem casesfor validating problem's solution- Throws:
IllegalArgumentException- if any parameter is null, ifnameorcasesare empty, ifdifficultyis not positive
-
-
Method Details
-
getId
Returns unique identifier associated with this problem.- Returns:
- unique identifier
-
getName
Returns name of this problem.- Returns:
- name
-
getDescription
Returns description of this problem.- Returns:
- description
-
getDifficulty
public int getDifficulty()Returns positive difficulty of this problem.- Returns:
- difficulty
-
getCases
Returnsproblem casesused for validation of this problem's solution.- Returns:
- unmodifiable
listofproblem cases
-
toString
Returns formatted string identifying this problem. This string is not guaranteed to be unique.
-