A Predicate
tests whether an Object
satisfies a specific
implementation-defined property. Predicates may be logically combined using
such Jakarta-defined predicates as AndPredicate
(which returns
true if all input predicates return true).
JUNG uses Predicates
(found in the graph.predicates
package) for the following tasks:
Note: Some predicates are unsuitable for use as constraints (and some predicates are only suitable for use as constraints). We have tried to make these distinctions clear in the documentation for each predicate. Users are advised to read the documentation for a predicate before using it. Some general rules for which predicates are appropriate in different circumstances:
VertexPredicate
.
Edge constraints should be (logical combinations of)
EdgePredicate
.
GraphPredicates
are not appropriate for use as
vertex or edge constraints, or for defining vertex/edge subsets.
Some predicates specify that they are intended for use only on
orphaned vertices/edges (those that have not yet been added to a graph).
These are only suitable for use as constraints.
Predicates that only check for non-structural attributes (e.g.,
decorations or other metadata) of vertices or edges are suitable for
general use (constraint definition, subset specification, etc.).
SubsetManager
) such that it no longer
passes a constraint (belongs in a subset), JUNG will not
throw an exception, nor will it automatically remove the graph element
from the graph (subset).
Users who wish to update their graphs/subsets in response to
such changes may wish to create a listener that is notified of
changes to relevant attributes.
JUNG Predicates
that do not take constructor arguments are
accessed via a static getInstance
call; other Predicates
are created with the usual constructor call.
For more information on Predicates
and their use, see
the commons-collections website.