Class CubeCoordinate.AreaIterator
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.CubeCoordinate.AreaIterator
-
- All Implemented Interfaces:
java.lang.Iterable<CubeCoordinate>
,java.util.Iterator<CubeCoordinate>
- Enclosing class:
- CubeCoordinate
public class CubeCoordinate.AreaIterator extends java.lang.Object implements java.util.Iterator<CubeCoordinate>, java.lang.Iterable<CubeCoordinate>
An AreaIterator iterates over all tiles in a filled hexagon with a center and radius.
-
-
Constructor Summary
Constructors Constructor Description AreaIterator(CubeCoordinate.AreaIterator iter)
Creates a copy of another AreaIterator.AreaIterator(CubeCoordinate center, int radius)
Constructs a new AreaIterator 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
-
AreaIterator
public AreaIterator(CubeCoordinate center, int radius)
Constructs a new AreaIterator with a center and radius. The iterator will iterate over a filled hexagon.- Parameters:
center
- center of the hexagonradius
- radius of the hexagon
-
AreaIterator
public AreaIterator(CubeCoordinate.AreaIterator iter)
Creates a copy of another AreaIterator.- Parameters:
iter
- AreaIterator 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>
-
-