|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.collection.PredicateEnumeration
public class PredicateEnumeration
PredicateEnumeration
filters an by only returning items which
satisfy a boolean predicate.
EnumerationPredicateEnumeration is a Decorator class.
It takes in its constructor a primary Enumeration and a PredicateInterface.
The PredicateEnumeration then acts as an Enumeration. It retrieves values
from the primary Enumeration, but only returns items such that the specified
boolean predicate returns true. Thus, the PredicateEnumeration acts as
a way to filter another enumeration with a boolean test.
StringPredicateEnumeration| Constructor Summary | |
|---|---|
PredicateEnumeration(java.util.Enumeration enumer,
com.sas.util.PredicateInterface predicate)
Construct a PredicateEnumeration which filters another enumeration
by guarding it's values with a predicate. |
|
| Method Summary | |
|---|---|
boolean |
hasMoreElements()
Returns true if there are more elements which satisfy the predicate. |
java.lang.Object |
nextElement()
Returns the next element from the enumeration which satisfies the predicate. |
| Constructor Detail |
|---|
public PredicateEnumeration(java.util.Enumeration enumer,
com.sas.util.PredicateInterface predicate)
PredicateEnumeration which filters another enumeration
by guarding it's values with a predicate. That is, this filter
only returns items via enumer.nextElement() if the predicate is true
for those items. hasMoreElements() works by performing a
look-ahead and running the predicate (one time) on subsequent items
until one is found which satisfies the predicate (it will be returned
by the next call to nextElement(), or no more items exist.
enumer - the primary enumeration filtered by this PredicateEnumerationpredicate - the predicate used to filter the primary enumertion.
Only items which satisfy htis boolean predicate are returned
by nextElement()| Method Detail |
|---|
public boolean hasMoreElements()
true if there are more elements which satisfy the predicate.
hasMoreElements in interface java.util.Enumerationtrue if there are more elements which satisfy the predicate.public java.lang.Object nextElement()
nextElement in interface java.util.Enumeration
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||