public class PredicateUtils
extends java.lang.Object
PredicateUtils
class.Constructor and Description |
---|
PredicateUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addEdgeSubset(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Creates an edge subset for
g based on p , which will
be maintained by the g 's SubsetManager . |
static boolean |
addVertexSubset(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Creates a vertex subset for
g based on p , which will
be maintained by the g 's SubsetManager . |
static boolean |
enforcesDirected(Graph g)
Returns
true if g is constrained to only
accept directed edges, and false otherwise. |
static boolean |
enforcesEdgeConstraint(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns
true if p is an edge
constraint of g , and false otherwise. |
static boolean |
enforcesNotParallel(Graph g)
Returns
true if g is constrained to
reject parallel edges. |
static boolean |
enforcesUndirected(Graph g)
Returns
true if g is constrained to only
accept undirected edges. |
static boolean |
enforcesVertexConstraint(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns
true if p is an edge
constraint of g , and false otherwise. |
static java.util.Map |
evaluateNestedPredicates(org.apache.commons.collections.Predicate p,
java.lang.Object o)
Returns a
Map of each constituent predicate of p
(if any) to the result of evaluating this predicate on o . |
static java.util.Set |
getEdges(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns a
Set consisting of all edges e
in graph g that satisfy predicate p ,
that is, those for which p.evaluate(e) returns true. |
static java.util.Collection |
getSatisfyingElements(java.util.Collection c,
org.apache.commons.collections.Predicate p) |
static java.util.Set |
getVertices(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns a
Set consisting of all vertices v
in graph g that satisfy predicate p ,
that is, those for which p.evaluate(v) returns true. |
static void |
removeEdgeSubset(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Removes the edge subset based on
p from
g 's SubsetManager . |
static void |
removeVertexSubset(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Removes the vertex subset based on
p from
g 's SubsetManager . |
static boolean |
satisfiesEdgeConstraint(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns
true if each edge in g
satisfies p , and false otherwise. |
static boolean |
satisfiesPredicate(java.util.Collection c,
org.apache.commons.collections.Predicate p)
Returns
true if all elements of c
satisfy p . |
static boolean |
satisfiesVertexConstraint(ArchetypeGraph g,
org.apache.commons.collections.Predicate p)
Returns
true if each vertex in g
satisfies p , and false otherwise. |
public static java.util.Set getVertices(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
Returns a Set
consisting of all vertices v
in graph g
that satisfy predicate p
,
that is, those for which p.evaluate(v)
returns true.
If g
has a SubsetManager
that defines
a cached subset based on p
, that subset is returned.
public static java.util.Set getEdges(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
Set
consisting of all edges e
in graph g
that satisfy predicate p
,
that is, those for which p.evaluate(e)
returns true.public static boolean addVertexSubset(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
g
based on p
, which will
be maintained by the g
's SubsetManager
.p
- the predicate defining the subsetpublic static boolean addEdgeSubset(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
g
based on p
, which will
be maintained by the g
's SubsetManager
.p
- the predicate defining the subsetpublic static void removeVertexSubset(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
p
from
g
's SubsetManager
.p
- the predicate defining the subsetpublic static void removeEdgeSubset(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
p
from
g
's SubsetManager
.p
- the predicate defining the subsetpublic static boolean enforcesEdgeConstraint(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
true
if p
is an edge
constraint of g
, and false
otherwise.public static boolean satisfiesEdgeConstraint(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
true
if each edge in g
satisfies p
, and false otherwise. (Note: this may be
true even if p
is not a constraint of g
.)public static boolean enforcesVertexConstraint(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
true
if p
is an edge
constraint of g
, and false
otherwise.public static boolean satisfiesVertexConstraint(ArchetypeGraph g, org.apache.commons.collections.Predicate p)
true
if each vertex in g
satisfies p
, and false otherwise. (Note: this may be
true even if p
is not a constraint of g
.)public static boolean satisfiesPredicate(java.util.Collection c, org.apache.commons.collections.Predicate p)
true
if all elements of c
satisfy p
.public static java.util.Collection getSatisfyingElements(java.util.Collection c, org.apache.commons.collections.Predicate p)
public static boolean enforcesDirected(Graph g)
true
if g
is constrained to only
accept directed edges, and false otherwise.public static boolean enforcesUndirected(Graph g)
true
if g
is constrained to only
accept undirected edges.public static boolean enforcesNotParallel(Graph g)
true
if g
is constrained to
reject parallel edges.ParallelEdgePredicate
public static java.util.Map evaluateNestedPredicates(org.apache.commons.collections.Predicate p, java.lang.Object o)
Map
of each constituent predicate of p
(if any) to the result of evaluating this predicate on o
.
If p
is a PredicateDecorator
, i.e., a predicate
that operates on other Predicate
s, the output will consist of
the results of evaluting the constituents of p
on o
;
otherwise, the output will be the result of evaluating p
itself
on o
.