# Enum Class Good

java.lang.Object
java.lang.Enum<Good>
it.polimi.ingsw.is25am31.model.components.Good

All Implemented Interfaces:
  `Serializable`, `Comparable<Good>`, `Constable`

public enum Good extends Enum<Good>
Enumeration representing different types of goods with their associated values. This enum defines the various goods that can be collected, traded, or used within the game system. Each good has both a color identifier and a numerical value that represents its worth, rarity, or importance in the game mechanics. The goods are ordered by their value in descending order, with RED being the most valuable and BLUE being the least valuable. This value system can be used for scoring, trading calculations, or determining the relative importance of different goods. The available goods and their values are: `RED` - Value: 4 (highest value), `YELLOW` - Value: 3, `GREEN` - Value: 2, `BLUE` - Value: 1 (lowest value).

See Also:
  - `Color`

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `BLUE`
  `GREEN`
  `RED`
  `YELLOW`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getValue()`
  Returns the numerical value of this good.
  `static Good`
  `parseGood(String good)`
  Parses a string representation of a good and returns the corresponding Good enum.
  `static Good`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static Good[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### RED

    public static final Good RED

  - ### YELLOW

    public static final Good YELLOW

  - ### GREEN

    public static final Good GREEN

  - ### BLUE

    public static final Good BLUE

- ## Method Details

  - ### values

    public static Good[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static Good valueOf(String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum class has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### getValue

    public int getValue()
    Returns the numerical value of this good.
    Returns:
      the numerical value of this good

  - ### parseGood

    public static Good parseGood(String good)
    Parses a string representation of a good and returns the corresponding Good enum. Supported string values: "red" -> `RED`, "yellow" -> `YELLOW`, "green" -> `GREEN`, "blue" -> `BLUE`.
    Parameters:
      `good` - the string representation of the good (must be lowercase)
    Returns:
      the Good enum constant corresponding to the input string
    Throws:
      `RuntimeException` - if the input string does not match any valid good
    See Also:
      - `RED`
      - `YELLOW`
      - `GREEN`
      - `BLUE`