|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.FastIndexedWriteableIterator
public class FastIndexedWriteableIterator
An iterator that operates over a TemplateIndexedModel implementation
that also implements TemplateWriteableIndexedModel.
The assumption here is that we have constant-time random access to the
underlying implementation.
FastIndexedIterator| Field Summary | |
|---|---|
protected long |
currentIndex
The current index into the model. |
protected long |
endIndex
The end index of the model. |
protected TemplateWriteableIndexedModel |
indexModel
The model that we will index into. |
protected long |
startIndex
The beginning index of the model. |
| Constructor Summary | |
|---|---|
FastIndexedWriteableIterator(TemplateWriteableIndexedModel model,
long startIndex,
long endIndex)
Constructor that takes the object we're iterating over as an argument |
|
| Method Summary | |
|---|---|
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
boolean |
hasNext()
Do we have a next value? |
boolean |
isEmpty()
Is the iterator empty? |
TemplateModel |
next()
Return the next value in the indexModel, and increment the counter to point to the next value. |
void |
set(TemplateModel model)
Inserts the specified element into the list. |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final TemplateWriteableIndexedModel indexModel
protected final long startIndex
protected final long endIndex
protected long currentIndex
| Constructor Detail |
|---|
public FastIndexedWriteableIterator(TemplateWriteableIndexedModel model,
long startIndex,
long endIndex)
model - the indexed list model to iterate over| Method Detail |
|---|
public boolean isEmpty()
throws TemplateModelException
isEmpty in interface TemplateModelfalse, indicating the iterator is not empty
TemplateModelExceptionpublic boolean hasNext()
hasNext in interface TemplateIteratorModeltrue if more values exist in the list,
otherwise false
public TemplateModel next()
throws TemplateModelException
next in interface TemplateIteratorModelTemplateModel representing the next value
in the list
TemplateModelException - the next item couldn't be retrieved,
or we're at the end of the list
public void set(TemplateModel model)
throws TemplateModelException
set in interface TemplateWriteableIteratorModelmodel - the model to insert into the list
TemplateModelException - the model could not be assigned
to the list
public TemplateModel get(java.lang.String key)
throws TemplateModelException
TemplateModel from the hash. The one key is "index",
which returns the current index of the iterator.
get in interface TemplateHashModelkey - the name by which the TemplateModel
is identified in the template.
TemplateModel referred to by the key,
or null if not found.
TemplateModelException - there was a problem getting the value
for the given keypublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||