internal void Add(int locale, CldrTreePath path, int value) { // that's the node we've been looking for! if (path.IsEmpty()) { this.LocaleValues.Add(locale, value); return; } // we need to go deeper CldrTreeNode child; var pathSegment = path.Dequeue(); if (pathSegment.IsDictionaryKey) { if (this.PropertyChildren.TryGetValue(pathSegment.Key, out child) == false) { child = new CldrTreeNode(this.Tree, this); this.PropertyChildren.Add(pathSegment.Key, child); } } else { if (this.ArrayChildren.TryGetElement(pathSegment.Index, out child) == false) { child = new CldrTreeNode(this.Tree, this); this.ArrayChildren.Add(child); } } child.Add(locale, path, value); }
private static void SetPropertiesRecursively(CldrTree tree, CldrTreeNode node) { foreach (var child in node.PropertyChildren.Values) { child.Tree = tree; child.Parent = node; SetPropertiesRecursively(tree, child); } foreach (var child in node.ArrayChildren) { child.Tree = tree; child.Parent = node; SetPropertiesRecursively(tree, child); } }
internal CldrTreeNode(CldrTree tree, CldrTreeNode parent) { this.Tree = tree; this.Parent = parent; }
internal CldrTree() { this.Root = new CldrTreeNode(this, null); this.Values = new List <string>(); this.Locales = new IdentifierDictionary <CldrLocale>(); }