コード例 #1
0
        //public static VertexNodeStateContext Copy(this VertexNodeStateContext nodeStateContext, VertexNodeStateContextFactory factory)
        //{
        //    var nodeFactory = VertexNodeFactory.GetFactory();
        //    var context = factory.ConstructNodeContext(nodePosition: nodeStateContext.Node.Position,
        //        nodeState: nodeStateContext.State, nodeFactory: nodeFactory);
        //    return context;
        //}
        //public static EdgeNodeStateContext Copy(this EdgeNodeStateContext nodeStateContext, EdgeNodeStateContextFactory factory)
        //{
        //    var nodeFactory = EdgeNodeFactory.GetFactory();
        //    var context = factory.ConstructNodeContext(nodePosition: nodeStateContext.Node.Position,
        //        nodeState: nodeStateContext.State, nodeFactory: nodeFactory);
        //    return context;
        //}

        //public static VertexNodeStateContextContainer Copy(
        //    this VertexNodeStateContextContainer nodeStateContextContainer,
        //    VertexNodeStateContextFactory factory)
        //{
        //    var container = new VertexNodeStateContextContainer();
        //    foreach (var nodeStateContext in nodeStateContextContainer.Values)
        //    {
        //        container.Values.Add(nodeStateContext.Key, nodeStateContext.Value.Copy(factory));
        //    }
        //    return container;
        //}
        //public static EdgeNodeStateContextContainer Copy(
        //    this EdgeNodeStateContextContainer nodeStateContextContainer,
        //    EdgeNodeStateContextFactory factory)
        //{
        //    var container = new EdgeNodeStateContextContainer();
        //    foreach (var nodeStateContext in nodeStateContextContainer.Values)
        //    {
        //        container.Values.Add(nodeStateContext.Key, nodeStateContext.Value.Copy(factory));
        //    }
        //    return container;
        //}
        public static List <V> Copy <V>(
            this List <V> nodeStateContextList,
            VertexNodeStateContextFlyweightFactory <V> factory) where V : VertexNodeStateContext, new()
        {
            var container = new List <V>(nodeStateContextList.Count);

            foreach (var nodeStateContext in nodeStateContextList)
            {
                container.Add(nodeStateContext.Copy(nodeStateContext, factory));
            }
            return(container);
        }
 public NodeStateContextContainerFacadeFlyweightFactory(
     EdgeNodeStateContextFlyweightFactory <E> edgeNodeStateContextFactory,
     VertexNodeStateContextFlyweightFactory <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;
 }