Modifier | Constructor and Description |
---|---|
protected |
LoopState(Iterable<?> items)
Creates a new instance for the base collection.
|
Modifier and Type | Method and Description |
---|---|
int |
getRowIndex()
Returns the index of the current row.
|
boolean |
isEven()
Determines if the an even row is currently being rendered.
|
boolean |
isFirst()
Determines if the first row is currently being rendered.
|
boolean |
isLast()
Determines if the last row is currently being rendered.
|
boolean |
isNth(int n)
Determines if the n-th even row is currently being rendered.
|
boolean |
isOdd()
Determines if the an odd row is currently being rendered.
|
boolean |
isSuccessive()
Determines if a successive row is currently being rendered.
|
protected void |
nextRow()
Used by the
LoopEmitter to indicate that a new row is rendered. |
protected LoopState(Iterable<?> items)
If the given collection is a list, we can also determine if the current row is the last one.
items
- the collection to iterate overprotected void nextRow()
LoopEmitter
to indicate that a new row is rendered.public int getRowIndex()
Note that this is one-based and therefore counts 1, 2, 3, ...
public boolean isFirst()
public boolean isSuccessive()
This is the inverse to isFirst()
.
public boolean isLast()
UnsupportedOperationException
- if the total number of items is not known in advancepublic boolean isEven()
public boolean isOdd()
public boolean isNth(int n)
n
- the modulo to check forCopyright © 2018. All rights reserved.