- java.lang.Object
-
- org.jgrapht.graph.concurrent.AsSynchronizedGraph.CacheAccess
-
- All Implemented Interfaces:
java.io.Serializable
,AsSynchronizedGraph.CacheStrategy<V,E>
- Enclosing class:
- AsSynchronizedGraph<V,E>
private class AsSynchronizedGraph.CacheAccess extends java.lang.Object implements AsSynchronizedGraph.CacheStrategy<V,E>, java.io.Serializable
Use cache for AsSynchronizedGraph'sedgesOf
,incomingEdgesOf
andoutgoingEdgesOf
methods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<V,java.util.Set<E>>
edgesOfMap
private java.util.Map<V,java.util.Set<E>>
incomingEdgesMap
private java.util.Map<V,java.util.Set<E>>
outgoingEdgesMap
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
CacheAccess()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
addEdge(V sourceVertex, V targetVertex)
Add an edge into AsSynchronizedGraph's backing graph.boolean
addEdge(V sourceVertex, V targetVertex, E e)
Add an edge into AsSynchronizedGraph's backing graph.private void
edgeModified(V sourceVertex, V targetVertex)
Clear the copies which the edge to be added or removed can affect.java.util.Set<E>
edgesOf(V vertex)
Get all edges touching the specified vertex in AsSynchronizedGraph's backing graph.java.util.Set<E>
incomingEdgesOf(V vertex)
Get a set of all edges in AsSynchronizedGraph's backing graph incoming into the specified vertex.boolean
isCacheEnabled()
Return whether the graph uses cache foredgesOf
,incomingEdgesOf
andoutgoingEdgesOf
methods.java.util.Set<E>
outgoingEdgesOf(V vertex)
Get a set of all edges in AsSynchronizedGraph's backing graph outgoing from the specified vertex.boolean
removeEdge(E e)
Remove the specified edge from AsSynchronizedGraph's backing graph.E
removeEdge(V sourceVertex, V targetVertex)
Remove an edge from AsSynchronizedGraph's backing graph.boolean
removeVertex(V v)
Remove the specified vertex from AsSynchronizedGraph's backing graph.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
addEdge
public E addEdge(V sourceVertex, V targetVertex)
Add an edge into AsSynchronizedGraph's backing graph.- Specified by:
addEdge
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
addEdge
public boolean addEdge(V sourceVertex, V targetVertex, E e)
Add an edge into AsSynchronizedGraph's backing graph.- Specified by:
addEdge
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
edgesOf
public java.util.Set<E> edgesOf(V vertex)
Get all edges touching the specified vertex in AsSynchronizedGraph's backing graph.- Specified by:
edgesOf
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
incomingEdgesOf
public java.util.Set<E> incomingEdgesOf(V vertex)
Get a set of all edges in AsSynchronizedGraph's backing graph incoming into the specified vertex.- Specified by:
incomingEdgesOf
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
outgoingEdgesOf
public java.util.Set<E> outgoingEdgesOf(V vertex)
Get a set of all edges in AsSynchronizedGraph's backing graph outgoing from the specified vertex.- Specified by:
outgoingEdgesOf
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
removeEdge
public boolean removeEdge(E e)
Remove the specified edge from AsSynchronizedGraph's backing graph.- Specified by:
removeEdge
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
removeEdge
public E removeEdge(V sourceVertex, V targetVertex)
Remove an edge from AsSynchronizedGraph's backing graph.- Specified by:
removeEdge
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
removeVertex
public boolean removeVertex(V v)
Remove the specified vertex from AsSynchronizedGraph's backing graph.- Specified by:
removeVertex
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
-
edgeModified
private void edgeModified(V sourceVertex, V targetVertex)
Clear the copies which the edge to be added or removed can affect.- Parameters:
sourceVertex
- source vertex of the modified edge.targetVertex
- target vertex of the modified edge.
-
isCacheEnabled
public boolean isCacheEnabled()
Return whether the graph uses cache foredgesOf
,incomingEdgesOf
andoutgoingEdgesOf
methods.- Specified by:
isCacheEnabled
in interfaceAsSynchronizedGraph.CacheStrategy<V,E>
- Returns:
true
if cache is in use,false
if cache is not in use.
-
-