Exemplo n.º 1
0
        private CldrTreeNode SelectNode(CldrTreePath path)
        {
            // that's the node we've been looking for!
            if (path.IsEmpty())
                return this;

            // we need to go deeper
            CldrTreeNode child;
            var pathSegment = path.Dequeue();

            if (pathSegment.IsDictionaryKey)
            {
                if (this.PropertyChildren.TryGetValue(pathSegment.Key, out child) == false)
                    return null;
            }
            else
            {
                if (this.ArrayChildren.TryGetElement(pathSegment.Index, out child) == false)
                    return null;
            }

            return child.SelectNode(path);
        }
Exemplo n.º 2
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);
        }