|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.algorithms.Filter
public class Filter
Algorithms that return a subset of its input. The input may be an array, collection, or iteration. There are two general algorithms included: filter and remove. The filter methods return elements from the input that pass the selection criteria, while the remove methods removes elements from the input stream for which the selection criteria is true. Note that the actual input is not modified in any of these methods.
Copyright © 2006 David A. Hall
Nested Class Summary | |
---|---|
static class |
Filter.FilterIterable<T>
Produces Iterators that only return elements that meet a given condition. |
static class |
Filter.FilterIterator<T>
Iterator that only returns elements that meet the given selection criteria. |
Constructor Summary | |
---|---|
Filter()
|
Method Summary | ||
---|---|---|
static
|
filter(java.lang.Iterable<? extends T> i,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the contents of the input that meet the given selection criteria. |
|
static
|
filter(java.lang.Iterable<? extends T> cin,
UnaryFunctor<T,java.lang.Boolean> pred,
TCollection cout)
Appends the contents of the input that meet the given selection criteria to the output. |
|
static
|
filter(java.util.Iterator<? extends T> iter,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the contents of the iterator that meet the given selection criteria. |
|
static
|
filter(T[] ts,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the elements of the array that meet the given selection criteria. |
|
static
|
remove(java.lang.Iterable<? extends T> i,
T value)
Returns the elements of the input that are not equal to the given value, using the value's Object.equals(Object) method |
|
static
|
remove(java.lang.Iterable<? extends T> i,
T value,
Equality<T> eq)
Returns the elements of the input that are not equal to the given value, using the given functor to compare for equality |
|
static
|
remove(java.lang.Iterable<? extends T> cin,
T value,
Equality<T> eq,
TCollection cout)
Returns the elements of the input that are not equal to the given value, using the given functor to compare for equality |
|
static
|
remove(java.lang.Iterable<? extends T> cin,
T value,
TCollection cout)
Returns the elements of the input that are not equal to the given value, using the value's Object.equals(Object) method |
|
static
|
remove(java.lang.Iterable<? extends T> i,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the elements of the input that do not meet the given selection criteria |
|
static
|
remove(java.lang.Iterable<? extends T> cin,
UnaryFunctor<T,java.lang.Boolean> pred,
TCollection cout)
Returns the elements of the input that do not meet the given selection criteria |
|
static
|
remove(java.util.Iterator<? extends T> iter,
T value)
Returns the elements of the iterator that are not equal to the given value, using the value's Object.equals(Object) method |
|
static
|
remove(java.util.Iterator<? extends T> iter,
T value,
Equality<T> eq)
Returns the elements of the iterator that are not equal to the given value, using the given functor to compare for equality |
|
static
|
remove(java.util.Iterator<? extends T> iter,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the elements of the iterator that do not meet the given selection criteria |
|
static
|
remove(T[] ts,
T value)
Returns the elements of the array that are not equal to the given value, using the value's Object.equals(Object) method |
|
static
|
remove(T[] ts,
T value,
Equality<T> eq)
Returns the elements of the array that are not equal to the given value, using the given functor to compare for equality |
|
static
|
remove(T[] ts,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns the elements of the array that do not meet the given selection criteria |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Filter()
Method Detail |
---|
public static <T> java.lang.Iterable<T> filter(T[] ts, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.lang.Iterable<T> remove(T[] ts, T value)
Object.equals(Object)
method
public static <T> java.lang.Iterable<T> remove(T[] ts, T value, Equality<T> eq)
public static <T> java.lang.Iterable<T> remove(T[] ts, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.lang.Iterable<T> filter(java.lang.Iterable<? extends T> i, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.lang.Iterable<T> remove(java.lang.Iterable<? extends T> i, T value)
Object.equals(Object)
method
public static <T> java.lang.Iterable<T> remove(java.lang.Iterable<? extends T> i, T value, Equality<T> eq)
public static <T> java.lang.Iterable<T> remove(java.lang.Iterable<? extends T> i, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.util.Iterator<T> filter(java.util.Iterator<? extends T> iter, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.util.Iterator<T> remove(java.util.Iterator<? extends T> iter, T value)
Object.equals(Object)
method
public static <T> java.util.Iterator<T> remove(java.util.Iterator<? extends T> iter, T value, Equality<T> eq)
public static <T> java.util.Iterator<T> remove(java.util.Iterator<? extends T> iter, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T,TCollection extends java.util.Collection<? super T>> TCollection filter(java.lang.Iterable<? extends T> cin, UnaryFunctor<T,java.lang.Boolean> pred, TCollection cout)
public static <T,TCollection extends java.util.Collection<? super T>> TCollection remove(java.lang.Iterable<? extends T> cin, T value, TCollection cout)
Object.equals(Object)
method
public static <T,TCollection extends java.util.Collection<? super T>> TCollection remove(java.lang.Iterable<? extends T> cin, T value, Equality<T> eq, TCollection cout)
public static <T,TCollection extends java.util.Collection<? super T>> TCollection remove(java.lang.Iterable<? extends T> cin, UnaryFunctor<T,java.lang.Boolean> pred, TCollection cout)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |