java.lang.Object
java.lang.Enum<Terrain>
edu.ntnu.idatt2001.carljgu.battle.Terrain
All Implemented Interfaces:
Serializable, Comparable<Terrain>, Constable

public enum Terrain extends Enum<Terrain>
An enum that represents the different terrains that the battles can occur on.
Version:
1.2 15.05.2022
Author:
Carl Gützkow
  • Enum Constant Details

    • PLAINS

      public static final Terrain PLAINS
    • FOREST

      public static final Terrain FOREST
    • HILLS

      public static final Terrain HILLS
  • Field Details

    • readableName

      private final String readableName
    • terrains

      private static final Map<String,Terrain> terrains
  • Constructor Details

    • Terrain

      private Terrain(String readableName)
      The enum constructor
      Parameters:
      readableName - String - the enum in PascalCase
  • Method Details

    • values

      public static Terrain[] 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 Terrain 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
    • getReadableName

      public String getReadableName()
      Gets the name from the enum
      Returns:
      readableName - String - enum in PascalCase
    • getTerrain

      public static Terrain getTerrain(String readableName)
      Gets a Terrain enum from a string. If a terrain was not found, null is returned instead.
      Parameters:
      readableName - String - the enum in PascalCase
      Returns:
      UnitType - the enum respective to the readable name