Interface Neighbourhood<S>

Type Parameters:
S - The type representing the state.
All Superinterfaces:
org.refcodes.graphical.Position, org.refcodes.graphical.PosXAccessor, org.refcodes.graphical.PosYAccessor
All Known Implementing Classes:
Direction, MooreNeighbourhood, VonNeumannNeighbourhood

public interface Neighbourhood<S> extends org.refcodes.graphical.Position
Methods useful for working with neighborhoods related to cellular automatons, such as the VonNeumannNeighbourhood or the MooreNeighbourhood.
  • Nested Class Summary

    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
  • 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.
    default S
    next(Rotation aRotation)
    Returns the next neighborhood for the given rotation relative to the current state.

    Methods inherited from interface org.refcodes.graphical.Position

    toAddTo, toSubFrom

    Methods inherited from interface org.refcodes.graphical.PosXAccessor

    getPositionX

    Methods inherited from interface org.refcodes.graphical.PosYAccessor

    getPositionY
  • Method Details

    • clockwiseNext

      S clockwiseNext()
      Returns the next clockwise state relative to the current state. Imagine the states as the positions on a clock, next to "12" would be "1", next to "1" would be "2", and so on (clockwise).
      Returns:
      The next state relative to the current state.
    • clockwisePrevious

      S clockwisePrevious()
      Returns the next anti-clockwise state relative to the current state. Imagine the states as the positions on a clock, next to "12" would be "11", next to "11" would be "10", and so on (anti-clockwise).
      Returns:
      The next state relative to the current state.
    • next

      default S next(Rotation aRotation)
      Returns the next neighborhood for the given rotation relative to the current state. Depending on the Rotation element provided, either clockwiseNext() (Rotation.CLOCKWISE) or clockwisePrevious() (Rotation.ANTI_CLOCKWISE) is called.
      Parameters:
      aRotation - The rotation direction to use when calculating the next neighborhood.
      Returns:
      The next state relative to the current state.