public class PredicateFactory extends Object
Uses the Singleton pattern, i.e., only one instance can exist, so use
getFactory()
.
Ensures that a single Predicate object exists for each Predicate name.
Modifier and Type | Method and Description |
---|---|
ExternalFunctionalPredicate |
createFunctionalPredicate(String name,
ExternalFunction extFun)
Constructs an ExternalFunctionalPredicate.
|
StandardPredicate |
createStandardPredicate(String name,
ArgumentType... types)
Constructs a StandardPredicate.
|
static PredicateFactory |
getFactory() |
Iterable<FunctionalPredicate> |
getFunctionalPredicates() |
Predicate |
getPredicate(String name)
Gets the Predicate with the given name, if it exists
|
Iterable<Predicate> |
getPredicates() |
Iterable<StandardPredicate> |
getStandardPredicates() |
String |
toString() |
public static PredicateFactory getFactory()
public StandardPredicate createStandardPredicate(String name, ArgumentType... types)
Returns an existing StandardPredicate if one has the same name and ArgumentTypes.
name
- name for the new predicatetypes
- types for each of the predicate's argumentsIllegalArgumentException
- if name is already used with different
ArgumentTypes, is already used by
another type of Predicate, doesn't
match \w+; types has length zero;
or an element of types is NULLpublic ExternalFunctionalPredicate createFunctionalPredicate(String name, ExternalFunction extFun)
Returns an existing ExternalFunctionalPredicate if one has the same name and ExternalFunction.
name
- name for the new predicateextFun
- the ExternalFunction the new predicate will useIllegalArgumentException
- if name is already used with different
ExternalFunction, is already used by
another type of Predicate, doesn't
match \w+; types has length zero;
or extFun does not provide valid ArgumentTypespublic Predicate getPredicate(String name)
name
- the name to matchpublic Iterable<FunctionalPredicate> getFunctionalPredicates()
public Iterable<StandardPredicate> getStandardPredicates()