public V Copy <V>(VertexNodeStateContext nodeStateContext, VertexNodeStateContextFactory <V> factory) where V : VertexNodeStateContext, new()
        {
            var nodeFactory = VertexNodeFactory.GetFactory();
            var context     = factory.ConstructNodeContext(nodePosition: nodeStateContext.Node.Position,
                                                           nodeState: nodeStateContext.State, nodeFactory: nodeFactory);

            return(context);
        }
예제 #2
0
        public VertexNodeStateContextContainer <V> Copy(
            VertexNodeStateContextFactory <V> factory)
        {
            var container = new VertexNodeStateContextContainer <V>();

            foreach (var nodeStateContext in this.Values)
            {
                container.Values.Add(nodeStateContext.Key, nodeStateContext.Value.Copy <V>(nodeStateContext.Value, factory));
            }
            return(container);
        }
 public NodeStateContextContainerFacadeFactory(EdgeNodeStateContextFactory <E> edgeNodeStateContextFactory, VertexNodeStateContextFactory <V> vertexNodeStateContextFactory)
 {
     if (edgeNodeStateContextFactory == null)
     {
         throw new NullReferenceException("edgeNodeStateContextFactory cannot be null");
     }
     EdgeNodeStateContextFactory = edgeNodeStateContextFactory;
     if (vertexNodeStateContextFactory == null)
     {
         throw new NullReferenceException("vertexNodeStateContextFactory cannot be null");
     }
     VertexNodeStateContextFactory = vertexNodeStateContextFactory;
 }
예제 #4
0
        protected internal virtual void AddVertex(int vertexPosition, int vertexValue, int vertexClause, VertexNodeStateContextFactory <V> factory)
        {
            var context = factory.ConstructDefaultNodeContext(vertexPosition);

            context.Node.Value  = vertexValue;
            context.Node.Clause = vertexClause;
            this.VertexNodeStateContextContainer.Add(vertexPosition, context);
        }
예제 #5
0
 protected internal virtual void AddVertex(int vertexPosition, VertexNodeStateContextFactory <V> factory)
 {
     this.VertexNodeStateContextContainer.Add(vertexPosition, factory.ConstructDefaultNodeContext(vertexPosition));
 }
예제 #6
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));
         }
     }
 }
예제 #7
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);
         }
     }
 }
예제 #8
0
 public virtual void AddVertex(int vertexPosition, int vertexValue, int vertexClause, VertexNodeStateContextFactory <V> factory)
 {
     this.NodeStateContextContainerFacade.AddVertex(vertexPosition, vertexValue, vertexClause, factory);
     this.IncidenceProvider.AddVertex(vertexPosition);
     this.AdjacencyProvider.AddVertex(vertexPosition);
 }
        public static VertexNodeStateContext Copy(VertexNodeStateContext nodeStateContext, VertexNodeStateContextFactory <VertexNodeStateContext> factory)
        {
            var nodeFactory = VertexNodeFactory.GetFactory();
            var context     = factory.ConstructNodeContext(nodePosition: nodeStateContext.Node.Position,
                                                           nodeState: nodeStateContext.State, nodeFactory: nodeFactory);

            return(context);
        }