类 LoopTool.ManagedIterator
java.lang.Object
org.apache.velocity.tools.generic.LoopTool.ManagedIterator
- 所有已实现的接口:
Iterator
- 封闭类:
- LoopTool
Iterator implementation that wraps a standard
Iterator
and allows it to be prematurely stopped, skipped ahead, and
associated with a name for advanced nested loop control.
This also allows a arbitrary LoopTool.ActionConditions to be added
in order to have it automatically skip over or stop before
certain elements in the iterator.-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明condition(LoopTool.ActionCondition condition) Adds a newLoopTool.ActionConditionfor this instance to check against the elements in the iterator being managed.Directs this instance to completely exclude any elements equal to the specified Object.intgetCount()booleangetFirst()booleanintgetIndex()booleangetLast()getName()booleanhasNext()booleanisFirst()booleanisLast()booleanisSyncedWith(String name) next()voidremove()This operation is unsupported.voidstop()Stops this iterator from doing any further iteration.Directs this instance to stop iterating immediately prior to any element equal to the specified Object.Adds another iterator to be kept in sync with the one being managed by this instance.Adds another iterator to be kept in sync with the one being managed by this instance.toString()从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 java.util.Iterator
forEachRemaining
-
构造器详细资料
-
ManagedIterator
-
-
方法详细资料
-
getName
- 返回:
- the name of this instance.
-
isFirst
public boolean isFirst()- 返回:
- true if either 0 or 1 elements have been returned
by
next().
-
isLast
public boolean isLast()- 返回:
- true if the last element returned by
next()is the last element available in the iterator being managed which satisfies any/allLoopTool.ActionConditions set for this instance. Otherwise, returns false.
-
getFirst
public boolean getFirst()- 返回:
- the result of
isFirst(). Exists to allow $loop.this.first syntax.
-
getLast
public boolean getLast()- 返回:
- the result of
isLast(). Exists to allow $loop.this.last syntax.
-
hasNext
public boolean hasNext()- 指定者:
hasNext在接口中Iterator- 返回:
- true if there are more elements in the iterator
being managed by this instance which satisfy all the
LoopTool.ActionConditions set for this instance. Returns false if there are no more valid elements available.
-
getHasNext
public boolean getHasNext()- 返回:
- the result of
hasNext(). Exists to allow $loop.this.hasNext syntax.
-
isSyncedWith
- 参数:
name- syn'ed iterator name- 返回:
trueif this ManagedIterator has a sync'ed iterator with the specified name.
-
get
- 参数:
name- iterator name- 返回:
- the parallel value from the specified sync'ed iterator.
If no sync'ed iterator exists with that name or that iterator
is finished, this will return
null.
-
getCount
public int getCount()- 返回:
- the number of elements returned by
next()so far.
-
getIndex
public int getIndex()- 返回:
- the 0-based index of the current item.
-
next
- 指定者:
next在接口中Iterator- 返回:
- the next element that meets the set
LoopTool.ActionConditions (if any) in the iterator being managed. If there are none left, then this will throw aNoSuchElementException.
-
remove
public void remove()This operation is unsupported. -
stop
public void stop()Stops this iterator from doing any further iteration. -
exclude
Directs this instance to completely exclude any elements equal to the specified Object.- 参数:
compare- value to exclude- 返回:
- This same
LoopTool.ManagedIteratorinstance
-
stop
Directs this instance to stop iterating immediately prior to any element equal to the specified Object.- 参数:
compare- value to stop at- 返回:
- This same
LoopTool.ManagedIteratorinstance
-
condition
Adds a newLoopTool.ActionConditionfor this instance to check against the elements in the iterator being managed.- 参数:
condition- condition- 返回:
- This same
LoopTool.ManagedIteratorinstance
-
sync
Adds another iterator to be kept in sync with the one being managed by this instance. The values of the parallel iterator can be retrieved from the LoopTool under the name s"synced" (e.g. $loop.synced or $loop.get('synced')) and are automatically updated for each iteration by this instance.
NOTE: if you are sync'ing multiple iterators with the same managed iterator, you must use
sync(Object,String)or else your the later iterators will simply replace the earlier ones under the default 'synced' key.- 参数:
iterable- Iterator to synchronize with- 返回:
- This same
LoopTool.ManagedIteratorinstance - 另请参阅:
-
sync
Adds another iterator to be kept in sync with the one being managed by this instance. The values of the parallel iterator can be retrieved from the LoopTool under the name specified here (e.g. $loop.name or $loop.get('name')) and are automatically updated for each iteration by this instance.- 参数:
iterable- iterator to synchronize withname- loop name- 返回:
- This same
LoopTool.ManagedIteratorinstance - 另请参阅:
-
getLastSyncedValues
- 返回:
- last sync'ed values
-
toString
-