Ejemplo n.º 1
0
 /// <summary>
 /// Adds non existing values and overrides existing values resulting in an updated
 /// node with historical values.
 /// </summary>
 public void Combine(Node node)
 {
     if (node.DictionarySet)
     {
         if (_dictionarySet)
         {
             foreach (KeyValuePair <string, Node> entry in node.Dictionary)
             {
                 if (_dictionary.ContainsKey(entry.Key))
                 {
                     _dictionary[entry.Key].Combine(entry.Value);
                 }
                 else
                 {
                     _dictionary[entry.Key] = entry.Value;
                 }
             }
         }
         else
         {
             _dictionary    = new Dictionary <string, Node>(node._dictionary);
             _dictionarySet = true;
         }
     }
     if (node.ArraySet)
     {
         if (_arraySet)
         {
             foreach (Node n in node._array)
             {
                 int index = _array.IndexOf(n);
                 if (index == -1)
                 {
                     _array.Add(n);
                 }
                 else
                 {
                     _array[index].Combine(n);
                 }
             }
         }
         else
         {
             _arraySet = true;
             _array    = new ArrayRig <Node>(node._array);
         }
     }
     if (node.Set)
     {
         _value = node._value;
     }
 }