Class Problem

java.lang.Object
dev.zemco.codegame.problems.Problem

public class Problem extends Object
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 Details

    • Problem

      public Problem(UUID id, String name, String description, int difficulty, List<ProblemCase> cases)
      Creates an instance of Problem.
      Parameters:
      id - unique identifier of the problem
      name - name of the problem
      description - description of the problem
      difficulty - difficulty of the problem
      cases - list of problem cases for validating problem's solution
      Throws:
      IllegalArgumentException - if any parameter is null, if name or cases are empty, if difficulty is not positive
  • Method Details

    • getId

      public UUID getId()
      Returns unique identifier associated with this problem.
      Returns:
      unique identifier
    • getName

      public String getName()
      Returns name of this problem.
      Returns:
      name
    • getDescription

      public String getDescription()
      Returns description of this problem.
      Returns:
      description
    • getDifficulty

      public int getDifficulty()
      Returns positive difficulty of this problem.
      Returns:
      difficulty
    • getCases

      public List<ProblemCase> getCases()
      Returns problem cases used for validation of this problem's solution.
      Returns:
      unmodifiable list of problem cases
    • toString

      public String toString()
      Returns formatted string identifying this problem. This string is not guaranteed to be unique.
      Overrides:
      toString in class Object
      Returns:
      non-unique string identifying this problem