Class FilteringVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- java.lang.Object
-
- edu.uci.ics.jung.graph.AbstractGraph<V,E>
-
- edu.uci.ics.jung.graph.AbstractTypedGraph<V,E>
-
- edu.uci.ics.jung.graph.DirectedSparseGraph<V,E>
-
- ghidra.graph.jung.JungDirectedGraph<V,E>
-
- ghidra.graph.graphs.JungDirectedVisualGraph<V,E>
-
- ghidra.graph.graphs.DefaultVisualGraph<V,E>
-
- ghidra.graph.graphs.FilteringVisualGraph<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
edu.uci.ics.jung.graph.DirectedGraph<V,E>
,edu.uci.ics.jung.graph.Graph<V,E>
,edu.uci.ics.jung.graph.Hypergraph<V,E>
,GDirectedGraph<V,E>
,GImplicitDirectedGraph<V,E>
,VisualGraph<V,E>
,java.io.Serializable
public abstract class FilteringVisualGraph<V extends VisualVertex,E extends VisualEdge<V>> extends DefaultVisualGraph<V,E>
A graph implementation that allows clients to mark vertices and edges as filtered. When filtered, a vertex is removed from this graph, but kept around for later unfiltering. Things of note:- As vertices are filtered, so to will be their edges
- If additions are made to the graph while it is filtered, the new additions will not be added to the current graph, but will be kept in the background for later restoring
Implementation Note: this class engages in some odd behavior when removals and additions are need to this graph. A distinction is made between events that are generated from external clients and those that happen due to filtering and restoring. This distinction allows this class to know when to update this graph, based upon whether or not data has been filtered. Implementation of this is achieved by using a flag. Currently, this flag is thread-safe. If this graph is to be multi-threaded (such as if changes are to be made by multiple threads, then this update flag will have to be revisited to ensure thread visibility.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class ghidra.graph.graphs.DefaultVisualGraph
focusedVertex
-
-
Constructor Summary
Constructors Constructor Description FilteringVisualGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdge(E e)
Add an edgeboolean
addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
boolean
addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType type)
boolean
addEdge(E e, java.util.Collection<? extends V> edgeVertices)
boolean
addEdge(E e, java.util.Collection<? extends V> edgeVertices, edu.uci.ics.jung.graph.util.EdgeType type)
boolean
addEdge(E e, V v1, V v2)
boolean
addEdge(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
boolean
addVertex(V v)
Add a vertexvoid
clearFilter()
void
dispose()
void
filterEdges(java.util.Collection<E> toFilter)
void
filterVertices(java.util.Collection<V> toFilter)
java.util.Iterator<E>
getAllEdges()
java.util.Set<E>
getAllEdges(java.util.Set<V> sourceVertices)
Returns all edges connected to the given vertices.java.util.Set<V>
getAllReachableVertices(java.util.Set<V> sourceVertices)
Returns all vertices that are reachable by the given vertices.java.util.Iterator<V>
getAllVertices()
java.util.Iterator<E>
getFilteredEdges()
java.util.Iterator<V>
getFilteredVertices()
java.util.Iterator<E>
getUnfilteredEdges()
java.util.Iterator<V>
getUnfilteredVertices()
boolean
isFiltered()
boolean
removeEdge(E e)
Removes an edgevoid
removeEdges(java.lang.Iterable<E> toRemove)
Removes the given edges from the graphboolean
removeVertex(V v)
Remove a vertexvoid
removeVertices(java.lang.Iterable<V> verticesToRemove)
Removes the given vertices from the graphvoid
unfilterEdges(java.util.Collection<E> toUnfilter)
Restores the given filtered edges into the graph.void
unfilterVertices(java.util.Collection<V> toUnfilter)
Restores the given filtered vertices into the graph.-
Methods inherited from class ghidra.graph.graphs.DefaultVisualGraph
addGraphChangeListener, clearSelectedVertices, copy, fireEdgesAdded, fireEdgesRemoved, fireVerticesAdded, fireVerticesRemoved, getAllEdges, getEdges, getFocusedVertex, getSelectedVertices, initializeLocation, removeGraphChangeListener, setSelectedVertices, setVertexFocused, vertexLocationChanged, verticesAdded, verticesRemoved
-
Methods inherited from class ghidra.graph.jung.JungDirectedGraph
containsEdge, emptyCopy, isEmpty
-
Methods inherited from class edu.uci.ics.jung.graph.DirectedSparseGraph
containsEdge, containsVertex, findEdge, findEdgeSet, getDest, getEdgeCount, getEdges, getEndpoints, getFactory, getIncidentEdges, getIncoming_internal, getInEdges, getNeighbors, getOutEdges, getOutgoing_internal, getPredecessors, getPreds_internal, getSource, getSuccessors, getSuccs_internal, getVertexCount, getVertices, isDest, isSource
-
Methods inherited from class edu.uci.ics.jung.graph.AbstractTypedGraph
getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, hasEqualEdgeType, validateEdgeType
-
Methods inherited from class edu.uci.ics.jung.graph.AbstractGraph
degree, getIncidentCount, getIncidentVertices, getNeighborCount, getOpposite, getPredecessorCount, getSuccessorCount, getValidatedEndpoints, inDegree, isIncident, isNeighbor, isPredecessor, isSuccessor, outDegree, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.graph.GDirectedGraph
containsEdge, containsEdge, containsVertex, emptyCopy, findEdge, getEdgeCount, getEdges, getIncidentEdges, getInEdges, getOutEdges, getPredecessors, getSuccessors, getVertexCount, getVertices, isEmpty
-
Methods inherited from interface edu.uci.ics.jung.graph.Graph
getOpposite, getPredecessorCount, getSuccessorCount, inDegree, isPredecessor, isSuccessor, outDegree
-
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
degree, getDefaultEdgeType, getEdgeCount, getEdges, getEdgeType, getIncidentCount, getIncidentVertices, getNeighborCount, isIncident, isNeighbor
-
Methods inherited from interface ghidra.graph.VisualGraph
getLayout
-
-
-
-
Method Detail
-
filterVertices
public void filterVertices(java.util.Collection<V> toFilter)
-
filterEdges
public void filterEdges(java.util.Collection<E> toFilter)
-
unfilterVertices
public void unfilterVertices(java.util.Collection<V> toUnfilter)
Restores the given filtered vertices into the graph. This will only happen if both endpoints are in the graph.- Parameters:
toUnfilter
- the edges to restore
-
unfilterEdges
public void unfilterEdges(java.util.Collection<E> toUnfilter)
Restores the given filtered edges into the graph. This will only happen if both endpoints are in the graph.- Parameters:
toUnfilter
- the edges to restore
-
getAllVertices
public java.util.Iterator<V> getAllVertices()
-
getAllEdges
public java.util.Iterator<E> getAllEdges()
-
getFilteredVertices
public java.util.Iterator<V> getFilteredVertices()
-
getFilteredEdges
public java.util.Iterator<E> getFilteredEdges()
-
getUnfilteredVertices
public java.util.Iterator<V> getUnfilteredVertices()
-
getUnfilteredEdges
public java.util.Iterator<E> getUnfilteredEdges()
-
isFiltered
public boolean isFiltered()
-
clearFilter
public void clearFilter()
-
getAllReachableVertices
public java.util.Set<V> getAllReachableVertices(java.util.Set<V> sourceVertices)
Returns all vertices that are reachable by the given vertices.This method is needed if you wish to find relationships that have been filtered out.
- Parameters:
sourceVertices
- the vertices for which to find the other reachable vertices- Returns:
- the reachable vertices
-
getAllEdges
public java.util.Set<E> getAllEdges(java.util.Set<V> sourceVertices)
Returns all edges connected to the given vertices.This method is needed if you wish to find relationships that have been filtered out.
- Parameters:
sourceVertices
- the vertices for which to get the edges- Returns:
- the reachable edges
-
removeVertex
public boolean removeVertex(V v)
Description copied from interface:GDirectedGraph
Remove a vertex- Specified by:
removeVertex
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Specified by:
removeVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
removeVertex
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
v
- the vertex- Returns:
- true
-
removeVertices
public void removeVertices(java.lang.Iterable<V> verticesToRemove)
Description copied from interface:GDirectedGraph
Removes the given vertices from the graph- Specified by:
removeVertices
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
removeVertices
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
verticesToRemove
- the vertices to remove
-
removeEdge
public boolean removeEdge(E e)
Description copied from interface:GDirectedGraph
Removes an edge- Specified by:
removeEdge
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Specified by:
removeEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
removeEdge
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
e
- the edge- Returns:
- true if the graph contained the given edge
-
removeEdges
public void removeEdges(java.lang.Iterable<E> toRemove)
Description copied from interface:GDirectedGraph
Removes the given edges from the graph- Specified by:
removeEdges
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
removeEdges
in classJungDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
toRemove
- the edges to remove
-
addVertex
public boolean addVertex(V v)
Description copied from interface:GDirectedGraph
Add a vertex- Specified by:
addVertex
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Specified by:
addVertex
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addVertex
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
v
- the vertex- Returns:
- true if the add was successful, false otherwise
-
addEdge
public void addEdge(E e)
Description copied from interface:GDirectedGraph
Add an edge- Specified by:
addEdge
in interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addEdge
in classJungDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
e
- the edge
-
addEdge
public boolean addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType type)
- Overrides:
addEdge
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, java.util.Collection<? extends V> edgeVertices)
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, java.util.Collection<? extends V> edgeVertices, edu.uci.ics.jung.graph.util.EdgeType type)
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, V v1, V v2)
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)
- Specified by:
addEdge
in interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)
- Overrides:
addEdge
in classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
dispose
public void dispose()
- Overrides:
dispose
in classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
-