public ValueNodeLeaf <TK, TV> AddValue <TV>(TK key, TV value) { var newNode = new ValueNodeLeaf <TK, TV>(key, value); _chidNodesDictionary.Add(key, newNode); return(newNode); }
public ValueNodeLeaf <TK, TV> AddOrSetValue <TV>(TK key, TV value) { var newNode = new ValueNodeLeaf <TK, TV>(key, value); if (_chidNodesDictionary.ContainsKey(key)) { _chidNodesDictionary[key] = newNode; } else { _chidNodesDictionary.Add(key, newNode); } return(newNode); }
public bool TryGetLeafNode <TV>(TK key, out ValueNodeLeaf <TK, TV> node) { ValueNode <TK> childNode; if (_chidNodesDictionary.TryGetValue(key, out childNode)) { var leaf = childNode as ValueNodeLeaf <TK, TV>; if (leaf != null) { node = leaf; return(true); } } node = null; return(false); }
public bool TryGetLeafNode <TV>(IEnumerable <TK> keysList, out ValueNodeLeaf <TK, TV> node) { ValueNodeInternal <TK> parentNode; ValueNode <TK> childNode; if (TrySeparateKeysList(keysList, out parentNode, out childNode)) { var leaf = childNode as ValueNodeLeaf <TK, TV>; if (leaf != null) { node = leaf; return(true); } } node = null; return(false); }
public void SetValue <TV>(TK key, TV value) { _chidNodesDictionary[key] = new ValueNodeLeaf <TK, TV>(key, value); }