Class DataIterator3D<T>
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.map.Iterators.DataIterator3D<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
java.util.Iterator<T>
public class DataIterator3D<T> extends java.lang.Object implements java.util.Iterator<T>
An iterator iterating over a 3d array. Starts outside the array so first call before acces must benext()
.
-
-
Constructor Summary
Constructors Constructor Description DataIterator3D(T[][][] data, int startingZ, int limitZ)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getCurrentIndex()
get the reference to the indices position of the iteratorboolean
hasNext()
T
next()
first iterates z then x then yvoid
remove()
void
restart()
void
setBorders(int left, int right, int back, int front)
sets index position borders during iterations.void
setTopLimitZ(int zLimit)
set the top/last limit of the iteration (including).
-
-
-
Constructor Detail
-
DataIterator3D
public DataIterator3D(T[][][] data, int startingZ, int limitZ)
- Parameters:
data
-startingZ
- the starting layerlimitZ
- the last layer (including).
-
-
Method Detail
-
setTopLimitZ
public void setTopLimitZ(int zLimit)
set the top/last limit of the iteration (including).- Parameters:
zLimit
-
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
next
public T next()
first iterates z then x then y- Specified by:
next
in interfacejava.util.Iterator<T>
- Returns:
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<T>
-
getCurrentIndex
public int[] getCurrentIndex()
get the reference to the indices position of the iterator- Returns:
-
setBorders
public void setBorders(int left, int right, int back, int front)
sets index position borders during iterations. This reduces greatly the amount of blocks which are traversed.- Parameters:
left
- index positions, no grid coordinatesright
- index positions, no grid coordinatesback
- index positions, no grid coordinatesfront
- index positions, no grid coordinates
-
restart
public void restart()
-
-