Пример #1
0
        /// <summary>
        /// Add Topic Value to Node given current location in the topic parsing procedure.
        /// </summary>
        /// <param name="t">Topic which holds <code>value</code></param>
        /// <param name="level">Current Topic Level being parse</param>
        /// <param name="value">Value to store against topic</param>
        internal void AddTopicValue(Topic t, uint level, T value)
        {
            if (level == t.Levels.Length)
            {
                // We should add this value to this nodes values if it isn't already.
                if (!values.Contains(value))
                {
                    values.Add(value);
                }
            }
            else
            {
                TopicNode <T> child;

                if (children == null)
                {
                    children = new Dictionary <string, TopicNode <T> >();
                }

                if (!children.TryGetValue(t.Levels[level], out child))
                {
                    // subnode doesn't exist already
                    child = new TopicNode <T>(t.Levels[level]);
                    children.Add(t.Levels[level], child);
                }

                child.AddTopicValue(t, level + 1, value);
            }
        }
Пример #2
0
 /// <summary>
 /// Remove all values from the Topic Tree
 /// </summary>
 public void RemoveAll()
 {
     rootNode = new TopicNode <T>(".");
 }