FIM.Util
Class FilterEnumeration
java.lang.Object
|
+--FIM.Util.FilterEnumeration
- All Implemented Interfaces:
- Enumeration
- Direct Known Subclasses:
- CookieEnumeration, KeyOrCertificateEnumeration, StatementEnumeration
- public abstract class FilterEnumeration
- extends Object
- implements Enumeration
An enumeration of objects matching a certain criteria. It is based on another enumeration from
which only elements will be returned, which match certain criteria. Subclasses must implement
the actual filtering function protected boolean matchesFilter(Object toTest)
.
- Version:
- 1.0, 1.7.2000
- Author:
- Michael Sonntag
Constructor Summary |
protected |
FilterEnumeration()
Creates a new enumeration for filtering another enumeration. |
Method Summary |
boolean |
hasMoreElements()
Tests if this enumeration contains more matching elements. |
protected abstract boolean |
matchesFilter(Object toTest)
The function implementing the filtering function. |
Object |
nextElement()
Returns the next matching element of this enumeration. |
protected void |
setBaseEnumeration(Enumeration fullEnum)
Sets the enumeration for filtering objects from another enumeration.
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilterEnumeration
protected FilterEnumeration()
- Creates a new enumeration for filtering another enumeration.
setBaseEnumeration
protected void setBaseEnumeration(Enumeration fullEnum)
- Sets the enumeration for filtering objects from another enumeration.
The filtering parameters of the subclass must be set when this function is
called. Calls to matchesFilter(Object toTest)
must be possible!
- Parameters:
fullEnum
- the enumeration of all elements which will be filtered- Throws:
IllegalArgumentException
- if the parameter is null
IllegalStateException
- if the base enumeration is already set
hasMoreElements
public boolean hasMoreElements()
- Tests if this enumeration contains more matching elements.
- Specified by:
hasMoreElements
in interface Enumeration
- Returns:
true
if this enumeration contains more matching elements; false
otherwise- Throws:
IllegalStateException
- if the base enumeration is not set
nextElement
public Object nextElement()
- Returns the next matching element of this enumeration.
- Specified by:
nextElement
in interface Enumeration
- Returns:
- the next matching element of this enumeration
- Throws:
NoSuchElementException
- if no more matching elements existIllegalStateException
- if the base enumeration is not set
matchesFilter
protected abstract boolean matchesFilter(Object toTest)
- The function implementing the filtering function.
- Parameters:
totest
- the object to test if it matches the filter- Returns:
true
if the element should be returned; false
if this
element does not match the criteria and should be suppressed
Submit a bug
Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.