Exemplo n.º 1
0
 public void SetMergeNode3(MergeNode n3)
 {
     mergeNode3 = n3;
 }
Exemplo n.º 2
0
 public void SetMergeNode1(MergeNode n1)
 {
     mergeNode1 = n1;
 }
Exemplo n.º 3
0
 public void SetMergeNode2(MergeNode n2)
 {
     mergeNode2 = n2;
 }
Exemplo n.º 4
0
        public ArrayList GetMergeNodeList()
        {
            Node currentNode;
            MergeNode mNode = null;
            ArrayList currentMergeNode = new ArrayList();
            ArrayList mergeList = new ArrayList();
            IEnumerator cmnEnum;
            IEnumerator mlEnum;
            int temp;

            bool isMerged = false;

            while (nEnum.MoveNext())//for each node in nodeList
            {
                Node targetNode = (Node)nEnum.Current;

                if(mergeList.Count==0)
                {	temp = int.Parse(targetNode.GetName())+1;
                    mNode = new MergeNode(""+temp);
                    mNode.addNode(targetNode);
                }
                else
                {
                    mlEnum = mergeList.GetEnumerator();
                    while(mlEnum.MoveNext())//for each in the
                    {
                        currentMergeNode = ((MergeNode)mlEnum.Current).getList(); // the current MergeNode's list
                        cmnEnum = currentMergeNode.GetEnumerator();
                        while(cmnEnum.MoveNext())
                        {
                            currentNode = ((Node)cmnEnum.Current);

                            if(!targetNode.GetName().Equals(currentNode.GetName()))
                            {	temp = int.Parse(targetNode.GetName())+1;
                                mNode = new MergeNode(""+temp);
                                mNode.addNode(targetNode); // add the target node as the first node
                            }
                            else
                            {
                                isMerged = true;
                                break;
                            }
                        }

                        if(isMerged==true)
                        {
                            break;
                        }
                    }
                }

                cEnum = cList.GetEnumerator();
                if(isMerged == false) // if the target node is not a merge node
                {
                    while(cEnum.MoveNext())//for each connection in the conn list
                    {
                        Node currentStart = ((Connection)cEnum.Current).GetStart();
                        Node currentEnd = ((Connection)cEnum.Current).GetEnd();

                        if(targetNode.GetObjID().Equals(currentStart.GetObjID()) && targetNode.GetPtID().Equals(currentStart.GetPtID()))
                        {
                            mNode.addNode(currentEnd);
                        }

                        else if(targetNode.GetObjID().Equals(currentEnd.GetObjID()) && targetNode.GetPtID().Equals(currentEnd.GetPtID()))
                        {
                            mNode.addNode(currentStart);
                        }
                    }

                    mergeList.Add(mNode);
                    mNode = null;
                }

                isMerged = false;
            }

            mlEnum = mergeList.GetEnumerator();
            while(mlEnum.MoveNext())//for each in the
            {
                MergeNode current = (MergeNode)mlEnum.Current;
                currentMergeNode = ((MergeNode)mlEnum.Current).getList(); // the current MergeNode's list
                cmnEnum = currentMergeNode.GetEnumerator();
                while(cmnEnum.MoveNext())
                {
                    currentNode = ((Node)cmnEnum.Current);
                    nEnum = nList.GetEnumerator();
                    while(nEnum.MoveNext())
                    {
                        if(((Node)nEnum.Current).GetPtID().Equals(currentNode.GetPtID()) && ((Node)nEnum.Current).GetObjID().Equals(currentNode.GetObjID()))
                        {	dEnum = dList.GetEnumerator();
                            while(dEnum.MoveNext())
                            {
                                if(((Device)dEnum.Current).GetID().Equals(currentNode.GetObjID()))
                                {
                                    if(((Device)dEnum.Current).GetType().ToString().Equals("EEDomain.Ground"))
                                    {
                                        current.SetName("0");
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return mergeList;
        }