コード例 #1
0
ファイル: TableNode.cs プロジェクト: pwq1989/AddressMatch
 public TableNode(GraphNode gnode)
 {
     _gNode = gnode;
     _next = null;
     _prev = null;
     _name = gnode.Name;
 }
コード例 #2
0
ファイル: AddrSet.cs プロジェクト: whuttoken/AddressMatch
        private void AppendTableNodeList(TableNode head, TableNode node)
        {
            TableNode current = head;

            while (current.Next != null)
            {
                current = current.Next;
            }
            current.Next = node;
            node.Next    = null;
            node.Prev    = current;
        }
コード例 #3
0
ファイル: AddrSet.cs プロジェクト: whuttoken/AddressMatch
        /// <summary>
        /// Find node with specific name in HashTable
        /// </summary>
        /// <param name="name">name of node</param>
        /// <returns>collection of result</returns>
        public List <GraphNode> FindGNodeListInHashTable(string name)
        {
            List <GraphNode> resultList = new List <GraphNode>();

            TableNode node = AddrGraph.NodeTable[name] as TableNode;

            resultList.Add(node.GNode);

            while (node.Next != null)
            {
                resultList.Add(node.Next.GNode);
                node = node.Next;
            }

            return(resultList);
        }
コード例 #4
0
ファイル: AddrSet.cs プロジェクト: pwq1989/AddressMatch
 private void AppendTableNodeList(TableNode head,TableNode node)
 {
     TableNode current = head;
     while (current.Next != null)
     {
         current = current.Next;
     }
     current.Next = node;
     node.Next = null;
     node.Prev = current;
 }
コード例 #5
0
ファイル: AddrSet.cs プロジェクト: pwq1989/AddressMatch
        /// <summary>
        /// Insert a node into graph
        /// </summary>
        /// <param name="NewNode">The node to be inserted</param>
        /// <param name="FatherNode">The node's father node</param>
        /// <returns></returns>
        public bool Insert(GraphNode NewNode,GraphNode FatherNode)
        {
            if (NewNode == null || FatherNode ==null || FatherNode.NextNodeList == null)
            {
                return false;
            }
            if (NewNode.NodeLEVEL <= FatherNode.NodeLEVEL && NewNode.NodeLEVEL != LEVEL.Uncertainty)
            {
                return false;
            }

            TableNode tnode = new TableNode(NewNode);
            Hashtable table = AddrSet.AddrGraph.NodeTable;

            //Add to NodeTable
            if (table.Contains(tnode.Name))
            {
                AppendTableNodeList((TableNode)table[tnode.Name], tnode);
            }
            else
            {
                table.Add(tnode.Name, tnode);
            }

            //Linked to Graph
            FatherNode.NextNodeList.Add(NewNode);

            AddrGraph.NodeCount++;

            return true;
        }