Class CubeCoordinate.RingIterator
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.CubeCoordinate.RingIterator
-
- All Implemented Interfaces:
java.lang.Iterable<CubeCoordinate>
,java.util.Iterator<CubeCoordinate>
- Enclosing class:
- CubeCoordinate
public class CubeCoordinate.RingIterator extends java.lang.Object implements java.util.Iterator<CubeCoordinate>, java.lang.Iterable<CubeCoordinate>
The RingIterator is a Iterator and Iterable over CubeCoordinate's. Use this Iterator to iterate over the outline of a hexagon, with a given center and radius.
-
-
Constructor Summary
Constructors Constructor Description RingIterator(CubeCoordinate.RingIterator iter)
Creates a copy of another RingIterator.RingIterator(CubeCoordinate center, int radius)
Constructs a new RingIterator with a center and radius.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
java.util.Iterator<CubeCoordinate>
iterator()
CubeCoordinate
next()
-
-
-
Constructor Detail
-
RingIterator
public RingIterator(CubeCoordinate center, int radius)
Constructs a new RingIterator with a center and radius. The iterator will iterate over a hexagon outline.- Parameters:
center
- center of the hexagonradius
- radius of the hexagon
-
RingIterator
public RingIterator(CubeCoordinate.RingIterator iter)
Creates a copy of another RingIterator.- Parameters:
iter
- RingIterator to copy.
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<CubeCoordinate>
-
next
public CubeCoordinate next()
- Specified by:
next
in interfacejava.util.Iterator<CubeCoordinate>
-
iterator
public java.util.Iterator<CubeCoordinate> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<CubeCoordinate>
-
-