示例#1
0
 public static VertexNodeFactory GetFactory()
 {
     if (Instance == null)
     {
         Instance = new VertexNodeFactory();
     }
     return((VertexNodeFactory)Instance);
 }
        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);
        }
        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);
        }
示例#4
0
        ///// <summary>
        ///// This creates the default UnchosenVertexNodeState context.
        ///// </summary>
        ///// <param name="nodePosition"></param>
        ///// <returns></returns>
        //public virtual NodeStateContext ConstructNodeContext(int nodePosition)
        //{
        //    var node = this.ConstructNode(nodePosition);
        //    var context = new VertexNodeStateContext((VertexNode)node);
        //    return context;
        //}
        /// <summary>
        /// Note: This defaults to a state of UnchosenVertexNodeState.
        /// Otherwise, same as ConstructNodeContext(..) method.
        /// </summary>
        /// <param name="nodePosition"></param>
        /// <returns></returns>
        public override VC ConstructDefaultNodeContext(int nodePosition)
        {
            var factory = VertexNodeFactory.GetFactory();
            var context = ConstructNodeContext(
                nodePosition: nodePosition,
                nodeState: UnchosenVertexNodeState.Instance,
                nodeFactory: factory);

            return(context);
        }
        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);
        }
示例#6
0
        public VC ConstructNodeContext(int nodePosition, NodeState nodeState)
        {
            var nodeFactory = VertexNodeFactory.GetFactory();

            return(base.ConstructNodeContext(nodePosition, nodeState, nodeFactory));
        }