LoopTagStatus
ForLoopTagStatus
public class BaseLoopTagStatus extends java.lang.Object implements LoopTagStatus
BaseLoopTagStatus
represents information about the current iteration
of a looping tag.Constructor | Description |
---|---|
BaseLoopTagStatus(int currIteration,
int numIterations) |
Constructs a
BaseLoopTagStatus with the given number of
iterations and the current iteration number. |
BaseLoopTagStatus(Tag tag,
int numIterations) |
Constructs a
BaseLoopTagStatus with the given number of
iterations and a current index of 0. |
Modifier and Type | Method | Description |
---|---|---|
int |
getIndex() |
Returns the current index.
|
int |
getNumIterations() |
Returns the number of iterations.
|
void |
incrementIndex(Tag tag) |
Increments the current index, if the given tag is this object's parent
tag.
|
boolean |
isFirst() |
Returns whether the current iteration is the first iteration.
|
boolean |
isLast() |
Returns whether the current iteration is the last iteration.
|
public BaseLoopTagStatus(Tag tag, int numIterations)
BaseLoopTagStatus
with the given number of
iterations and a current index of 0.tag
- The parent Tag
. This is only used to protect
the incrementIndex(net.sf.jett.tag.Tag)
method so only the parent tag can call
it, not code in templates.numIterations
- The total number of iterations.public BaseLoopTagStatus(int currIteration, int numIterations)
BaseLoopTagStatus
with the given number of
iterations and the current iteration number. Because there is no parent
tag, the current iteration number cannot be changed.currIteration
- The current iteration number. This must be at
least 0 and it must be less than numIterations
.numIterations
- The total number of iterations.public int getIndex()
getIndex
in interface LoopTagStatus
public boolean isFirst()
isFirst
in interface LoopTagStatus
public boolean isLast()
isLast
in interface LoopTagStatus
public int getNumIterations()
public void incrementIndex(Tag tag)
Tag
that owns this object
can change the current iteration number, and not some code in a template.tag
- The parent tag.Copyright © 2012–2018 Jett Team. All rights reserved.