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);
        }
Beispiel #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;
 }
Beispiel #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);
        }
Beispiel #5
0
 protected internal virtual void AddVertex(int vertexPosition, VertexNodeStateContextFactory <V> factory)
 {
     this.VertexNodeStateContextContainer.Add(vertexPosition, factory.ConstructDefaultNodeContext(vertexPosition));
 }
Beispiel #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));
         }
     }
 }
Beispiel #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);
         }
     }
 }
Beispiel #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);
        }