freemarker.testcase.models
Class BooleanList1

java.lang.Object
  |
  +--freemarker.testcase.models.BooleanList1
All Implemented Interfaces:
TemplateIndexedModel, TemplateListModel2, TemplateModel

public final class BooleanList1
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: BooleanList1.java,v 1.10 2003/11/28 01:17:07 run2000 Exp $
Author:
Nicholas Cull
See Also:
BooleanList2

Constructor Summary
BooleanList1()
          Creates new BooleanList1.
 
Method Summary
 TemplateModel getAtIndex(long index)
          Get the value corresponding to the given index.
 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

BooleanList1

public BooleanList1()
Creates new BooleanList1.
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
Get the value corresponding to the given index. Traditionally this would correspond to an index into an array, or similar structure, such as a java.util.Vector.
Specified by:
getAtIndex in interface TemplateIndexedModel
Parameters:
index - the index of the underlying value we're interested in
Returns:
a TemplateModel representing the value for the given index
Throws:
TemplateModelException - the value could not be determined, possibly due to an index out-of-bounds, or an otherwise undefined value

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