|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.utils.PredicateUtils
public class PredicateUtils
Convenience methods for handling Predicates in JUNG (as constraints,
as subset specifications, and in general). Not a replacement
for the Jakarta Commons-Collections PredicateUtils
class.
Constructor Summary | |
---|---|
PredicateUtils()
|
Method Summary | |
---|---|
static boolean |
addEdgeSubset(ArchetypeGraph g,
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,
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,
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,
Predicate p)
Returns true if p is an edge
constraint of g , and false otherwise. |
static Map |
evaluateNestedPredicates(Predicate p,
Object o)
Returns a Map of each constituent predicate of p
(if any) to the result of evaluating this predicate on o . |
static Set |
getEdges(ArchetypeGraph g,
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 Collection |
getSatisfyingElements(Collection c,
Predicate p)
|
static Set |
getVertices(ArchetypeGraph g,
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,
Predicate p)
Removes the edge subset based on p from
g 's SubsetManager . |
static void |
removeVertexSubset(ArchetypeGraph g,
Predicate p)
Removes the vertex subset based on p from
g 's SubsetManager . |
static boolean |
satisfiesEdgeConstraint(ArchetypeGraph g,
Predicate p)
Returns true if each edge in g
satisfies p , and false otherwise. |
static boolean |
satisfiesPredicate(Collection c,
Predicate p)
Returns true if all elements of c
satisfy p . |
static boolean |
satisfiesVertexConstraint(ArchetypeGraph g,
Predicate p)
Returns true if each vertex in g
satisfies p , and false otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PredicateUtils()
Method Detail |
---|
public static Set getVertices(ArchetypeGraph g, 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 Set getEdges(ArchetypeGraph g, 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, Predicate p)
g
based on p
, which will
be maintained by the g
's SubsetManager
.
p
- the predicate defining the subset
public static boolean addEdgeSubset(ArchetypeGraph g, Predicate p)
g
based on p
, which will
be maintained by the g
's SubsetManager
.
p
- the predicate defining the subset
public static void removeVertexSubset(ArchetypeGraph g, Predicate p)
p
from
g
's SubsetManager
.
p
- the predicate defining the subsetpublic static void removeEdgeSubset(ArchetypeGraph g, Predicate p)
p
from
g
's SubsetManager
.
p
- the predicate defining the subsetpublic static boolean enforcesEdgeConstraint(ArchetypeGraph g, Predicate p)
true
if p
is an edge
constraint of g
, and false
otherwise.
public static boolean satisfiesEdgeConstraint(ArchetypeGraph g, 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, Predicate p)
true
if p
is an edge
constraint of g
, and false
otherwise.
public static boolean satisfiesVertexConstraint(ArchetypeGraph g, 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(Collection c, Predicate p)
true
if all elements of c
satisfy p
.
public static Collection getSatisfyingElements(Collection c, 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 Map evaluateNestedPredicates(Predicate p, 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
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |