Top Description Fields Constructors Methods
net.fortuna.ical4j.filter

public Class Filter<T>

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
org.slf4j.Logger, .LoggerFactory, java.lang.reflect.Array, java.util.ArrayList, .Collection, .List, java.util.function.Predicate

Deprecated

Most of the functionality of this class can now be achieved via lambda expressions using Component Filters

$Id$

Created: Feb 1, 2006

Performs collection filtering based on a set of rules. A filter may dictate whether at least one rule or all rules are matched.

Note

Implementation of filter rules has changed in recent releases to fix behaviour. Please ensure you update your code to use explicit constructors.

Author
Ben Fortuna

Field Summary

Modifier and TypeField and Description
public static final int
MATCH_ALL

Indicates that all rules must be matched to include an object in the filtered collection.

public static final int
MATCH_ANY

Indicates that any rule may be matched to include an object in the filtered collection.

private List<Predicate<T>>
private final int

Constructor Summary

AccessConstructor and Description
public
Filter(Predicate<T>...
one or more rules that are applied by this filter
rules
)

public
Filter(Predicate<T>[]
an array of rules that define this filter
rules
,
final int
the type of matching to apply
type
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public final Collection<T>

Returns:

a filtered collection
filter
(final Collection<T>
a collection to filter
c
)

Filter the given collection into a new collection.

public final T[]

Returns:

a filtered array
filter
(final T[]
an array to filter
objects
)

Returns a filtered subset of the specified array.

public final Predicate<T>[]

Returns:

Returns the rules.
getRules
()

private List<T>
private List<T>
public final void
setRules(final Predicate<T>[]
The rules to set.
rules
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MATCH_ALLback to summary
public static final int MATCH_ALL

Indicates that all rules must be matched to include an object in the filtered collection.

MATCH_ANYback to summary
public static final int MATCH_ANY

Indicates that any rule may be matched to include an object in the filtered collection.

rulesback to summary
private List<Predicate<T>> rules
typeback to summary
private final int type

Constructor Detail

Filterback to summary
public Filter(Predicate<T>... rules)
Parameters
rules:Predicate<T>[]

one or more rules that are applied by this filter

Annotations
@SafeVarargs
Filterback to summary
public Filter(Predicate<T>[] rules, final int type)

Constructor.

Parameters
rules:Predicate<T>[]

an array of rules that define this filter

type:int

the type of matching to apply

See Also
Filter#MATCH_ALL, Filter#MATCH_ANY

Method Detail

filterback to summary
public final Collection<T> filter(final Collection<T> c)

Filter the given collection into a new collection.

Parameters
c:Collection<T>

a collection to filter

Returns:Collection<T>

a filtered collection

Annotations
@SuppressWarnings:unchecked
filterback to summary
public final T[] filter(final T[] objects)

Returns a filtered subset of the specified array.

Parameters
objects:T[]

an array to filter

Returns:T[]

a filtered array

Annotations
@SuppressWarnings:unchecked
getRulesback to summary
public final Predicate<T>[] getRules()
Returns:Predicate<T>[]

Returns the rules.

Annotations
@SuppressWarnings:unchecked
matchAllback to summary
private List<T> matchAll(Collection<T> c)
matchAnyback to summary
private List<T> matchAny(Collection<T> c)
setRulesback to summary
public final void setRules(final Predicate<T>[] rules)
Parameters
rules:Predicate<T>[]

The rules to set.