org.norther.tammi.acorn.util
Class CounterCollection

java.lang.Object
  extended by org.norther.tammi.acorn.util.UnmodifiableCollection
      extended by org.norther.tammi.acorn.util.CounterCollection
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection

public class CounterCollection
extends UnmodifiableCollection

A collection returning Boolean.TRUE for the specified number of times.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
CounterCollection()
          Constructs an endless counter.
CounterCollection(int size)
          Constructs a new counter.
 
Method Summary
 boolean isEmpty()
           
 boolean isLast()
          Checks whether the current iterator has its last item.
 Iterator iterator()
           
 void setSize(int size)
          Sets the size of this collection.
 int size()
           
 void stop()
          Stops the latest iterator, if any.
 
Methods inherited from class org.norther.tammi.acorn.util.UnmodifiableCollection
add, addAll, clear, clone, contains, containsAll, equals, getCollection, hashCode, remove, removeAll, retainAll, setCollection, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CounterCollection

public CounterCollection()
Constructs an endless counter.


CounterCollection

public CounterCollection(int size)
Constructs a new counter.

Parameters:
size - the size of the counter.
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Overrides:
isEmpty in class UnmodifiableCollection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Overrides:
iterator in class UnmodifiableCollection

size

public int size()
Specified by:
size in interface Collection
Overrides:
size in class UnmodifiableCollection

isLast

public boolean isLast()
Checks whether the current iterator has its last item.

Returns:
true for the last item, false otherwise.

setSize

public void setSize(int size)
Sets the size of this collection.

Note that the size of current iterators is not changed.

Parameters:
size - the new size.

stop

public void stop()
Stops the latest iterator, if any.



Copyright © 2004 The Norther Organization. All rights reserved.