Пример #1
0
 public void AddRootDGEdges()
 {
     if (this.mRootNode == null)
     {
         DecisionGraph dg = this.mState.DecisionGraph;
         if (dg != null)
         {
             this.mRootNode = new DGRootNode(dg, this);
             this.mDGraph.InsertNode(0, this.mRootNode);
             this.mRootNode.SetParent(this);
         }
     }
     if (this.mRootNode != null)
     {
         DGNode        node;
         DGEdge        edge;
         List <DGEdge> edges = this.mRootNode.EntryAnchor.Edges;
         for (int i = this.mDGraph.NodeCount - 1; i > 0; i--)
         {
             node = this.mDGraph.NodeAt(i);
             if (node.EntryAnchor.Edges.Count == 0)
             {
                 edge = new DGEdge(this.mRootNode, node, true);
                 edges.Add(edge);
                 node.EntryAnchor.Edges.Add(edge);
                 this.mDGraph.AddEdge(edge);
                 edge.SetParent(this);
             }
         }
     }
 }
Пример #2
0
 public void UpdateRootNode(bool add)
 {
     this.mRootNode = null;
     if (this.mDGraph.NodeCount > 0)
     {
         int i, count = this.mDGraph.NodeCount;
         for (i = 0; i < count; i++)
         {
             this.mRootNode = this.mDGraph.NodeAt(i) as DGRootNode;
             if (this.mRootNode != null)
             {
                 break;
             }
         }
         if (this.mRootNode != null && i > 0)
         {
             // TODO: Swap root node and this.mDGraph.NodeAt(0)
         }
     }
     if (this.mRootNode == null && add)
     {
         DecisionGraph dg = this.mState.DecisionGraph;
         if (dg != null)
         {
             this.mRootNode = new DGRootNode(dg, this);
             this.mDGraph.InsertNode(0, this.mRootNode);
             this.mRootNode.SetParent(this);
         }
     }
 }
Пример #3
0
        private void InitDecisionGraph()
        {
            this.mDGraph = new Digraph <DGNode, DGEdge>();

            DecisionGraph dg = this.mState.DecisionGraph;

            if (dg != null)
            {
                int    i;
                DGNode dst;
                //DGEdge edge;
                //AnchorPoint ap;
                DecisionGraphNode   dgn;
                DecisionGraphNode[] dgns;
                this.mRootNode = new DGRootNode(dg, this);
                this.mDGraph.AddNode(this.mRootNode);
                this.mRootNode.SetParent(this);
                if (dg.DecisionMakerCount > 0)
                {
                    dgns = dg.DecisionMakers;
                    //ap = root.DecisionMakerAnchor;
                    for (i = 0; i < dgns.Length; i++)
                    {
                        dgn = dgns[i];
                        if (dgn != null)
                        {
                            dst = this.InitDGN(this.mRootNode, dgn);
                            dst.SetCategory(DGNode.DGFlag.DecisionMaker);

                            /*edge = new DGEdge(root, dst);
                             * ap.Edges.Add(edge);
                             * dst.EntryAnchor.Edges.Add(edge);
                             * this.mDecisionGraph.AddEdge(edge);
                             * edge.SetParent(this);/* */
                        }
                    }
                }
                if (dg.EntryPointCount > 0)
                {
                    dgns = dg.EntryPoints;
                    //ap = root.EntryAnchor;
                    for (i = 0; i < dgns.Length; i++)
                    {
                        dgn = dgns[i];
                        if (dgn != null)
                        {
                            dst = this.InitDGN(this.mRootNode, dgn);
                            dst.SetCategory(DGNode.DGFlag.EntryPoint);

                            /*edge = new DGEdge(root, dst);
                             * ap.Edges.Add(edge);
                             * dst.EntryAnchor.Edges.Add(edge);
                             * this.mDecisionGraph.AddEdge(edge);
                             * edge.SetParent(this);/* */
                        }
                    }
                }
                this.AddRootDGEdges();
            }
        }