예제 #1
0
        public void InsertValue(List <char> ident, T Value)
        {
            if (null == subValues)
            {
                subValues = new List <TreeSortNode <T> >();
            }
            if (ident.Count == 0)
            {
                Values.Add(Value);
                return;
            }
            bool match = false;

            for (int i = 0; i < subValues.Count; i++)
            {
                if (subValues[i].Name == ident[0])
                {
                    match = true;
                    ident.RemoveAt(0);
                    subValues[i].InsertValue(ident, Value);
                    break;
                }
            }
            if (!match)
            {
                TreeSortNode <T> newNode = new TreeSortNode <T>()
                {
                    Name = ident[0]
                };
                subValues.Add(newNode);
                ident.RemoveAt(0);
                newNode.InsertValue(ident, Value);
            }
        }
예제 #2
0
 public void PutValue(string ident, T value)
 {
     rootNode.InsertValue(new List <char>(ident.ToCharArray()), value);
     count++;
 }