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 iteratorbooleanhasNext()Tnext()first iterates z then x then yvoidremove()voidrestart()voidsetBorders(int left, int right, int back, int front)sets index position borders during iterations.voidsetTopLimitZ(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:
hasNextin interfacejava.util.Iterator<T>
-
next
public T next()
first iterates z then x then y- Specified by:
nextin interfacejava.util.Iterator<T>- Returns:
-
remove
public void remove()
- Specified by:
removein 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()
-
-