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 voidaddEdge(E e)Add an edgebooleanaddEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints)booleanaddEdge(E e, edu.uci.ics.jung.graph.util.Pair<? extends V> endpoints, edu.uci.ics.jung.graph.util.EdgeType type)booleanaddEdge(E e, java.util.Collection<? extends V> edgeVertices)booleanaddEdge(E e, java.util.Collection<? extends V> edgeVertices, edu.uci.ics.jung.graph.util.EdgeType type)booleanaddEdge(E e, V v1, V v2)booleanaddEdge(E e, V v1, V v2, edu.uci.ics.jung.graph.util.EdgeType edgeType)booleanaddVertex(V v)Add a vertexvoidclearFilter()voiddispose()voidfilterEdges(java.util.Collection<E> toFilter)voidfilterVertices(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()booleanisFiltered()booleanremoveEdge(E e)Removes an edgevoidremoveEdges(java.lang.Iterable<E> toRemove)Removes the given edges from the graphbooleanremoveVertex(V v)Remove a vertexvoidremoveVertices(java.lang.Iterable<V> verticesToRemove)Removes the given vertices from the graphvoidunfilterEdges(java.util.Collection<E> toUnfilter)Restores the given filtered edges into the graph.voidunfilterVertices(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:GDirectedGraphRemove a vertex- Specified by:
removeVertexin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Specified by:
removeVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
removeVertexin 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:GDirectedGraphRemoves the given vertices from the graph- Specified by:
removeVerticesin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
removeVerticesin classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>- Parameters:
verticesToRemove- the vertices to remove
-
removeEdge
public boolean removeEdge(E e)
Description copied from interface:GDirectedGraphRemoves an edge- Specified by:
removeEdgein interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Specified by:
removeEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
removeEdgein 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:GDirectedGraphRemoves the given edges from the graph- Specified by:
removeEdgesin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
removeEdgesin classJungDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Parameters:
toRemove- the edges to remove
-
addVertex
public boolean addVertex(V v)
Description copied from interface:GDirectedGraphAdd a vertex- Specified by:
addVertexin interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Specified by:
addVertexin interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addVertexin 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:GDirectedGraphAdd an edge- Specified by:
addEdgein interfaceGDirectedGraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addEdgein 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:
addEdgein classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
addEdge
public boolean addEdge(E e, java.util.Collection<? extends V> edgeVertices)
- Specified by:
addEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addEdgein 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:
addEdgein interfaceedu.uci.ics.jung.graph.Hypergraph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addEdgein 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:
addEdgein interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addEdgein 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:
addEdgein interfaceedu.uci.ics.jung.graph.Graph<V extends VisualVertex,E extends VisualEdge<V>>- Overrides:
addEdgein 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:
addEdgein classedu.uci.ics.jung.graph.AbstractGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
dispose
public void dispose()
- Overrides:
disposein classDefaultVisualGraph<V extends VisualVertex,E extends VisualEdge<V>>
-
-