freemarker.testcase.models
Class BooleanList2

java.lang.Object
  extended by freemarker.testcase.models.BooleanList2
All Implemented Interfaces:
TemplateIndexedModel, TemplateListModel2, TemplateModel

public final class BooleanList2
extends java.lang.Object
implements TemplateListModel2, TemplateIndexedModel

Model for testing the impact of the isEmpty() method on template list models. Every other method simply delegates to a FastList model.

Version:
$Id: BooleanList2.java 1003 2004-10-16 14:54:58Z run2000 $
Author:
Nicholas Cull
See Also:
BooleanList1

Constructor Summary
BooleanList2()
          Creates new BooleanList2.
 
Method Summary
 TemplateModel getAtIndex(long index)
          Retrieves the specified item from the list.
 boolean isEmpty()
          Is the underlying List empty?
 void releaseIterator(TemplateIteratorModel iterator)
          Returns the used iterator to the list model.
 TemplateIteratorModel templateIterator()
          Retrieves an iterator to iterate over this list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanList2

public BooleanList2()
Creates new BooleanList2.

Method Detail

templateIterator

public TemplateIteratorModel templateIterator()
                                       throws TemplateModelException
Retrieves an iterator to iterate over this list.

Specified by:
templateIterator in interface TemplateListModel2
Returns:
an iterator to iterate over the current list.
Throws:
TemplateModelException - the next item in the list can't be retrieved, or no next item exists.

releaseIterator

public void releaseIterator(TemplateIteratorModel iterator)
Returns the used iterator to the list model.

Specified by:
releaseIterator in interface TemplateListModel2
Parameters:
iterator - the iterator to be returned to the object pool

getAtIndex

public TemplateModel getAtIndex(long index)
                         throws TemplateModelException
Retrieves the specified item from the list.

Specified by:
getAtIndex in interface TemplateIndexedModel
Parameters:
index - the index of the item to be retrieved.
Returns:
the specified index in the list.
Throws:
TemplateModelException - the specified item in the list can't be retrieved, or the index is out of bounds.

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Is the underlying List empty?

Specified by:
isEmpty in interface TemplateModel
Returns:
true if the list is empty, otherwise false
Throws:
TemplateModelException