Package net.pl3x.map.core.util
Class SpiralIterator
java.lang.Object
net.pl3x.map.core.util.SpiralIterator
An iterator that spirals around a center point in a clockwise pattern
Example using a radius of 3:
30 31 32 33 34 35 36 29 12 13 14 15 16 37 28 11 02 03 04 17 38 27 10 01 00 05 18 39 26 09 08 07 06 19 40 25 24 23 22 21 20 41 48 47 46 45 44 43 42
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the cardinal directions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected intprotected intprotected SpiralIterator.Directionprotected longprotected long -
Constructor Summary
ConstructorsConstructorDescriptionSpiralIterator(int centerX, int centerZ) Constructs a new SpiralIterator with given center point and radius -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
currentX
protected int currentX -
currentZ
protected int currentZ -
totalStepsInLeg
protected long totalStepsInLeg -
currentStepInLeg
protected long currentStepInLeg -
legAxis
protected long legAxis -
direction
-
-
Constructor Details
-
SpiralIterator
public SpiralIterator(int centerX, int centerZ) Constructs a new SpiralIterator with given center point and radius- Parameters:
centerX- center x pointcenterZ- center z point
-
-
Method Details