-
- 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:
MooreNeighbourhood
,VonNeumannNeighbourhood
public interface Neighbourhood<S> extends org.refcodes.graphical.Position
Methods useful for working with neighborhoods related to cellular automatons, such as theVonNeumannNeighbourhood
or theMooreNeighbourhood
.
-
-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description S
clockwiseNext()
Returns the next clockwise state relative to the current state.S
clockwisePrevious()
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.
-
-
-
Method Detail
-
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 theRotation
element provided, eitherclockwiseNext()
(Rotation.CLOCKWISE
) orclockwisePrevious()
(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.
-
-