AddressMatch.AddrSet.Insert C# (CSharp) Méthode

Insert() public méthode

Insert a node into graph
public Insert ( GraphNode NewNode, GraphNode FatherNode ) : bool
NewNode GraphNode The node to be inserted
FatherNode GraphNode The node's father node
Résultat bool
        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;
        }