Package com.ibm.wala.util
Class Predicate<T>
- java.lang.Object
-
- com.ibm.wala.util.Predicate<T>
-
- Direct Known Subclasses:
CollectionFilter
,FilterPredicate
,Filtersection
,IndiscriminateFilter
,OrFilter
public abstract class Predicate<T> extends Object
Interface for defining an arbitrary predicate onObject
s.
-
-
Constructor Summary
Constructors Constructor Description Predicate()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Predicate<T>
and(Predicate<T> conjunct)
Return a predicate that is a conjunction of this predicate and another predicatestatic <T> Predicate<T>
falsePred()
static <T> List<T>
filter(Iterator<T> src, Predicate<T> pred)
Filter a collection: generate a new list from an existing collection, consisting of the elements satisfying some predicate.static <T> Predicate<T>
isElementOf(Collection<T> c)
Create the predicate "is an element of c"Predicate<T>
not()
Return a predicate that is a negation of this predicatePredicate<T>
or(Predicate<T> disjunct)
Return a predicate that is a conjunction of this predicate and another predicateabstract boolean
test(T t)
static <T> Predicate<T>
truePred()
-
-
-
Method Detail
-
truePred
public static <T> Predicate<T> truePred()
-
falsePred
public static <T> Predicate<T> falsePred()
-
test
public abstract boolean test(T t)
-
and
public Predicate<T> and(Predicate<T> conjunct)
Return a predicate that is a conjunction of this predicate and another predicate
-
or
public Predicate<T> or(Predicate<T> disjunct)
Return a predicate that is a conjunction of this predicate and another predicate
-
isElementOf
public static <T> Predicate<T> isElementOf(Collection<T> c)
Create the predicate "is an element of c"
-
filter
public static <T> List<T> filter(Iterator<T> src, Predicate<T> pred) throws IllegalArgumentException
Filter a collection: generate a new list from an existing collection, consisting of the elements satisfying some predicate.- Throws:
IllegalArgumentException
- if src == null
-
-