Ejemplo n.º 1
0
        // ----

        public NodeStateContextMediator()
        {
            NodeStateContextContainerFacade = new NodeStateContextContainerFacade <E, V>();
            IncidenceProvider             = new UndirectedIncidenceProvider();
            AdjacencyProvider             = new UndirectedAdjacencyProvider();
            GetIncidentVertexCache        = new Dictionary <int, List <int> >();
            GetIncidentEdgeCache          = new Dictionary <int, List <int> >();
            GetIncidentEdgeElementCache   = new Dictionary <int, List <E> >();
            GetIncidentVertexElementCache = new Dictionary <int, List <V> >();
            IncidentVertexTupleCache      = new Dictionary <int, Tuple <V, V> >();
        }
        public NodeStateContextContainerFacade <E, V> Copy(NodeStateContextContainerFacade <E, V> nodeStateContextContainerFacade)
        {
            var edgeNodeFactory   = EdgeNodeFactory.GetFactory();
            var vertexNodeFactory = VertexNodeFactory.GetFactory();
            var edgeContainer     =
                nodeStateContextContainerFacade.EdgeNodeStateContextContainer.Copy(this.EdgeNodeStateContextFactory);
            var vertexContainer =
                nodeStateContextContainerFacade.VertexNodeStateContextContainer.Copy(this.VertexNodeStateContextFactory);
            var newFacade = new NodeStateContextContainerFacade <E, V>(edgeContainer, vertexContainer);

            return(newFacade);
        }
Ejemplo n.º 3
0
 protected internal virtual void AddVertices(int sourceVertexPosition, int[] targetVertexPositions, EdgeNodeStateContextFactory <E> edgeFactory, VertexNodeStateContextFactory <V> vertexFactory)
 {
     lock (this.IncidenceProvider.Values)
     {
         var edgePositionList = this.IncidenceProvider.SetVertices(sourceVertexPosition, targetVertexPositions);
         lock (this.NodeStateContextContainerFacade)
         {
             edgePositionList.ForEach(t => this.NodeStateContextContainerFacade.AddEdge(t, edgeFactory));
         }
     }
     lock (this.AdjacencyProvider.Values)
     {
         this.AdjacencyProvider.SetVertices(sourceVertexPosition, targetVertexPositions);
         lock (this.NodeStateContextContainerFacade)
         {
             NodeStateContextContainerFacade.AddVertex(sourceVertexPosition, vertexFactory);
             targetVertexPositions.ToList().ForEach(t => NodeStateContextContainerFacade.AddVertex(t, vertexFactory));
         }
     }
 }
Ejemplo n.º 4
0
 protected internal virtual void AddVertices(int sourceVertexPosition, int targetVertex, EdgeNodeStateContextFactory <E> edgeFactory, VertexNodeStateContextFactory <V> vertexFactory)
 {
     lock (this.IncidenceProvider.Values)
     {
         var edgePosition = this.IncidenceProvider.SetVertices(sourceVertexPosition, targetVertex);
         lock (this.NodeStateContextContainerFacade)
         {
             this.NodeStateContextContainerFacade.AddEdge(edgePosition, edgeFactory);
         }
     }
     lock (this.AdjacencyProvider.Values)
     {
         this.AdjacencyProvider.SetVertices(sourceVertexPosition, targetVertex);
         lock (this.NodeStateContextContainerFacade)
         {
             NodeStateContextContainerFacade.AddVertex(sourceVertexPosition, vertexFactory);
             NodeStateContextContainerFacade.AddVertex(targetVertex, vertexFactory);
         }
     }
 }