Пример #1
0
        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);
        }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
 internal CldrTreeNode(CldrTree tree, CldrTreeNode parent)
 {
     this.Tree   = tree;
     this.Parent = parent;
 }
Пример #5
0
 internal CldrTree()
 {
     this.Root    = new CldrTreeNode(this, null);
     this.Values  = new List <string>();
     this.Locales = new IdentifierDictionary <CldrLocale>();
 }
Пример #6
0
 internal CldrTree()
 {
     this.Root = new CldrTreeNode(this, null);
     this.Values = new List<string>();
     this.Locales = new IdentifierDictionary<CldrLocale>();
 }
Пример #7
0
 internal CldrTreeNode(CldrTree tree, CldrTreeNode parent)
 {
     this.Tree = tree;
     this.Parent = parent;
 }
Пример #8
0
        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);
        }