Class AsSynchronizedGraph.CacheAccess

java.lang.Object
org.jgrapht.graph.concurrent.AsSynchronizedGraph.CacheAccess
All Implemented Interfaces:
Serializable, AsSynchronizedGraph.CacheStrategy<V,E>
Enclosing class:
AsSynchronizedGraph<V,E>

private class AsSynchronizedGraph.CacheAccess extends Object implements AsSynchronizedGraph.CacheStrategy<V,E>, Serializable
Use cache for AsSynchronizedGraph's edgesOf, incomingEdgesOf and outgoingEdgesOf methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Map<V,Set<E>>
     
    private final Map<V,Set<E>>
     
    private final Map<V,Set<E>>
     
    private static final long
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    edgesOf(V vertex)
    Get all edges touching the specified vertex in AsSynchronizedGraph's backing graph.
    Get a set of all edges in AsSynchronizedGraph's backing graph incoming into the specified vertex.
    boolean
    Return whether the graph uses cache for edgesOf, incomingEdgesOf and outgoingEdgesOf methods.
    Get a set of all edges in AsSynchronizedGraph's backing graph outgoing from the specified vertex.
    boolean
    Remove the specified edge from AsSynchronizedGraph's backing graph.
    removeEdge(V sourceVertex, V targetVertex)
    Remove an edge from AsSynchronizedGraph's backing graph.
    boolean
    Remove the specified vertex from AsSynchronizedGraph's backing graph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • incomingEdgesMap

      private final transient Map<V,Set<E>> incomingEdgesMap
    • outgoingEdgesMap

      private final transient Map<V,Set<E>> outgoingEdgesMap
    • edgesOfMap

      private final transient Map<V,Set<E>> edgesOfMap
  • Constructor Details

    • CacheAccess

      private CacheAccess()
  • Method Details

    • addEdge

      public E addEdge(V sourceVertex, V targetVertex)
      Add an edge into AsSynchronizedGraph's backing graph.
      Specified by:
      addEdge in interface AsSynchronizedGraph.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 interface AsSynchronizedGraph.CacheStrategy<V,E>
    • edgesOf

      public Set<E> edgesOf(V vertex)
      Get all edges touching the specified vertex in AsSynchronizedGraph's backing graph.
      Specified by:
      edgesOf in interface AsSynchronizedGraph.CacheStrategy<V,E>
    • incomingEdgesOf

      public 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 interface AsSynchronizedGraph.CacheStrategy<V,E>
    • outgoingEdgesOf

      public 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 interface AsSynchronizedGraph.CacheStrategy<V,E>
    • removeEdge

      public boolean removeEdge(E e)
      Remove the specified edge from AsSynchronizedGraph's backing graph.
      Specified by:
      removeEdge in interface AsSynchronizedGraph.CacheStrategy<V,E>
    • removeEdge

      public E removeEdge(V sourceVertex, V targetVertex)
      Remove an edge from AsSynchronizedGraph's backing graph.
      Specified by:
      removeEdge in interface AsSynchronizedGraph.CacheStrategy<V,E>
    • removeVertex

      public boolean removeVertex(V v)
      Remove the specified vertex from AsSynchronizedGraph's backing graph.
      Specified by:
      removeVertex in interface AsSynchronizedGraph.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 for edgesOf, incomingEdgesOf and outgoingEdgesOf methods.
      Specified by:
      isCacheEnabled in interface AsSynchronizedGraph.CacheStrategy<V,E>
      Returns:
      true if cache is in use, false if cache is not in use.