org.jjoost.util.filters
Class MappedFilter<X,Y>

java.lang.Object
  extended by org.jjoost.util.filters.MappedFilter<X,Y>
All Implemented Interfaces:
java.io.Serializable, Filter<X>

public class MappedFilter<X,Y>
extends java.lang.Object
implements Filter<X>

A filter that applies the provided function to its input before delegating to the provided filter

Author:
b.elliottsmith
See Also:
Serialized Form

Constructor Summary
MappedFilter(Function<X,Y> mapping, Filter<Y> filter)
          Constructs a filter that applies the provided function to its input before delegating to the provided filter
 
Method Summary
 boolean accept(X test)
          Returns true if the Filter accepts the parameter and false otherwise
static
<X,Y> MappedFilter<X,Y>
get(Function<X,Y> mapping, Filter<Y> filter)
          Returns a filter that applies the provided function to its input before delegating to the provided filter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappedFilter

public MappedFilter(Function<X,Y> mapping,
                    Filter<Y> filter)
Constructs a filter that applies the provided function to its input before delegating to the provided filter

Parameters:
mapping - the function to transform the input variables
filter - the delegate filter
Method Detail

accept

public boolean accept(X test)
Description copied from interface: Filter
Returns true if the Filter accepts the parameter and false otherwise

Specified by:
accept in interface Filter<X>
Parameters:
test - value to test
Returns:
true if the filter accepts test; false otherwise

get

public static <X,Y> MappedFilter<X,Y> get(Function<X,Y> mapping,
                                          Filter<Y> filter)
Returns a filter that applies the provided function to its input before delegating to the provided filter

Parameters:
mapping - the function to transform the input variables
filter - the delegate filter
Returns:
a filter that applies the provided function to its input before delegating to the provided filter