Package battleship

Enum Class Compass

All Implemented Interfaces:
Serializable, Comparable<Compass>, Constable

public enum Compass extends Enum<Compass>
The enum Compass.
Author:
fba
  • Enum Constant Details

    • NORTH

      public static final Compass NORTH
      North compass.
    • SOUTH

      public static final Compass SOUTH
      South compass.
    • EAST

      public static final Compass EAST
      East compass.
    • WEST

      public static final Compass WEST
      West compass.
  • Method Details

    • values

      public static Compass[] 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 Compass 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
    • randomBearing

      public static Compass randomBearing()
      Generate a random compass direction (bearing).
      Returns:
      A random compass direction.
    • getDirection

      public char getDirection()
      Gets direction.
      Returns:
      the direction
    • toString

      public String toString()
      To string string.
      Overrides:
      toString in class Enum<Compass>
      Returns:
      the string