|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.utils.SubsetManager
public class SubsetManager
A class which allows users to create and maintain
Predicate
-specified vertex and edge subsets.
The subsets are automatically maintained as vertices and
edges are added to, and removed from, the constructor-specified
graph.
A subset is created by providing a Predicate
;
those graph elements that pass the predicate are added to the
subset.
Field Summary | |
---|---|
protected Map |
edgeMap
|
protected ArchetypeGraph |
g
The graph for which this instance manages subsets. |
protected Map |
vertexMap
Map specifications (in the form of Predicates) to the corresponding subsets. |
Constructor Summary | |
---|---|
protected |
SubsetManager(ArchetypeGraph g)
Creates a SubsetManager , adds it to the specified
graph's user data repository, and adds itself as a listener to
the graph's vertex and edge addition and removal events, so that the
subsets' memberships can be maintained. |
Method Summary | |
---|---|
boolean |
addEdgeSubset(Predicate p)
Creates an edge subset based on p . |
boolean |
addVertexSubset(Predicate p)
Creates a vertex subset based on p . |
void |
edgeAdded(GraphEvent event)
Adds the edge whose event this is to all appropriate subsets. |
void |
edgeRemoved(GraphEvent event)
Removes the edge whose event this is from all appropriate subsets. |
protected Map |
getEdgeMap()
|
Set |
getEdges(Predicate p)
Returns the edge subset, if any, which this instance has defined based on p . |
static SubsetManager |
getInstance(ArchetypeGraph g)
Gets this graph's SubsetManager , creating it if necessary. |
protected Map |
getVertexMap()
|
Set |
getVertices(Predicate p)
Returns the vertex subset, if any, which this instance has defined based on p . |
void |
removeEdgeSubset(Predicate p)
Removes the edge subset based on p . |
void |
removeVertexSubset(Predicate p)
Removes the vertex subset based on p . |
void |
vertexAdded(GraphEvent event)
Adds the vertex whose event this is to all appropriate subsets. |
void |
vertexRemoved(GraphEvent event)
Removes the vertex whose event this is from all appropriate subsets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map vertexMap
protected Map edgeMap
protected ArchetypeGraph g
Constructor Detail |
---|
protected SubsetManager(ArchetypeGraph g)
SubsetManager
, adds it to the specified
graph's user data repository, and adds itself as a listener to
the graph's vertex and edge addition and removal events, so that the
subsets' memberships can be maintained.
Method Detail |
---|
public static SubsetManager getInstance(ArchetypeGraph g)
SubsetManager
, creating it if necessary.
g
- the graph whose subset manager is requestedpublic void vertexAdded(GraphEvent event)
vertexAdded
in interface GraphEventListener
public void vertexRemoved(GraphEvent event)
vertexRemoved
in interface GraphEventListener
public void edgeAdded(GraphEvent event)
edgeAdded
in interface GraphEventListener
public void edgeRemoved(GraphEvent event)
edgeRemoved
in interface GraphEventListener
public Set getVertices(Predicate p)
p
. If this instance has defined no such
subset, returns null.
p
- the predicate which may define a subsetpublic Set getEdges(Predicate p)
p
. If this instance has defined no such
subset, returns null.
p
- the predicate which may define a subsetpublic boolean addVertexSubset(Predicate p)
p
.
p
- the predicate defining the subset
public boolean addEdgeSubset(Predicate p)
p
.
p
- the predicate defining the subset
public void removeVertexSubset(Predicate p)
p
.
p
- the predicate defining the subsetpublic void removeEdgeSubset(Predicate p)
p
.
p
- the predicate defining the subsetprotected Map getVertexMap()
protected Map getEdgeMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |