public class LoopIterator
extends java.lang.Object
while
construct:
while (loopIterator.next()) {
// do something
}
Modifier and Type | Field and Description |
---|---|
protected int |
count |
protected int |
end |
protected boolean |
first |
protected boolean |
last |
protected boolean |
looping |
protected int |
modulus |
protected int |
start |
protected int |
step |
protected int |
value |
Constructor and Description |
---|
LoopIterator(int start,
int end) |
LoopIterator(int start,
int end,
int step) |
LoopIterator(int start,
int end,
int step,
int modulus) |
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Returns current item count (1-based).
|
int |
getIndex()
Returns current item index (0-based).
|
int |
getIndexModulus()
Returns modulus of current index.
|
int |
getModulus()
Returns modulus of current count.
|
int |
getModulusValue()
Returns modulus value.
|
int |
getValue()
Returns current loop value.
|
boolean |
isEven()
Returns
true if current count is even. |
boolean |
isFirst()
Returns
true if current item is the first one. |
boolean |
isLast()
Returns
true if current item is the last one. |
protected boolean |
isLastIteration(int value) |
boolean |
isOdd()
Returns
true if current count is odd. |
int |
modulus(int operand)
Calculates modulus of current count.
|
boolean |
next()
Iterates to next value at the beginning of the loop.
|
void |
reset()
Resets the loop from the beginning.
|
java.lang.String |
toString() |
protected final int start
protected final int end
protected final int step
protected final int modulus
protected boolean first
protected boolean last
protected int value
protected int count
protected final boolean looping
public LoopIterator(int start, int end)
public LoopIterator(int start, int end, int step)
public LoopIterator(int start, int end, int step, int modulus)
public int getCount()
public int getIndex()
public int getValue()
public boolean isEven()
true
if current count is even.public boolean isOdd()
true
if current count is odd.public int modulus(int operand)
public int getModulus()
public int getModulusValue()
public int getIndexModulus()
public boolean isFirst()
true
if current item is the first one.public boolean isLast()
true
if current item is the last one.public boolean next()
public void reset()
protected boolean isLastIteration(int value)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2003-present Jodd Team