Enum Class MooreNeighbourhood

java.lang.Object
java.lang.Enum<MooreNeighbourhood>
org.refcodes.checkerboard.MooreNeighbourhood
All Implemented Interfaces:
Serializable, Comparable<MooreNeighbourhood>, Constable, Neighbourhood<MooreNeighbourhood>, org.refcodes.graphical.Position, org.refcodes.graphical.PosXAccessor, org.refcodes.graphical.PosYAccessor

public enum MooreNeighbourhood extends Enum<MooreNeighbourhood> implements Neighbourhood<MooreNeighbourhood>
Definitions of the Moore neighbourhood.
  • Nested Class Summary

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

    Enum.EnumDesc<E extends Enum<E>>

    Nested classes/interfaces inherited from interface org.refcodes.graphical.Position

    org.refcodes.graphical.Position.PositionBuilder<B extends org.refcodes.graphical.Position.PositionBuilder<B>>, org.refcodes.graphical.Position.PositionMutator, org.refcodes.graphical.Position.PositionProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.PosXAccessor

    org.refcodes.graphical.PosXAccessor.PosXBuilder<B extends org.refcodes.graphical.PosXAccessor.PosXBuilder<B>>, org.refcodes.graphical.PosXAccessor.PosXMutator, org.refcodes.graphical.PosXAccessor.PosXProperty

    Nested classes/interfaces inherited from interface org.refcodes.graphical.PosYAccessor

    org.refcodes.graphical.PosYAccessor.PosYBuilder<B extends org.refcodes.graphical.PosYAccessor.PosYBuilder<B>>, org.refcodes.graphical.PosYAccessor.PosYMutator, org.refcodes.graphical.PosYAccessor.PosYProperty
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
     
     
     
     
     
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the next clockwise state relative to the current state.
    Returns the next anti-clockwise state relative to the current state.
    int
    Returns the relative X position to position (0, 0).
    int
    Returns the relative Y position to position (0, 0).
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.refcodes.checkerboard.Neighbourhood

    next

    Methods inherited from interface org.refcodes.graphical.Position

    toAddTo, toSubFrom
  • Enum Constant Details

  • Method Details

    • values

      public static MooreNeighbourhood[] 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 MooreNeighbourhood 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
    • getPositionX

      public int getPositionX()
      Returns the relative X position to position (0, 0).
      Specified by:
      getPositionX in interface org.refcodes.graphical.PosXAccessor
      Returns:
      The relative position X to the (0,0) coordinate.
    • getPositionY

      public int getPositionY()
      Returns the relative Y position to position (0, 0).
      Specified by:
      getPositionY in interface org.refcodes.graphical.PosYAccessor
      Returns:
      The relative position Y to the (0,0) coordinate.
    • clockwiseNext

      public MooreNeighbourhood clockwiseNext()
      Returns the next clockwise state relative to the current state. Imagine the states as the positions on a clock, next to TOP would be TOP_RIGHT, next to TOP_RIGHT would be RIGHT, and so on (clockwise).
      Specified by:
      clockwiseNext in interface Neighbourhood<MooreNeighbourhood>
      Returns:
      The next state relative to the current state.
    • clockwisePrevious

      public MooreNeighbourhood clockwisePrevious()
      Returns the next anti-clockwise state relative to the current state. Imagine the states as the positions on a clock, next to TOP would be TOP_LEFT, next to TOP_LEFT would be LEFT, and so on (anti-clockwise).
      Specified by:
      clockwisePrevious in interface Neighbourhood<MooreNeighbourhood>
      Returns:
      The next state relative to the current state.