Esempio n. 1
0
        ///<summary>Возвращает итератор, перечисляющий элементы индексатора
        ///IndexEntry</summary>
        public IEnumerator <Leaf> GetEnumerator()
        {
            CSharpDataStructures.Structures.Lists.LinkedList <Leaf> E =
                new CSharpDataStructures.Structures.Lists.LinkedList <Leaf>();
            STACK S = new STACK();

            S.Push(_tree);
            while (!S.IsEmpty())
            {
                Object b = S.Top();
                S.Pop();
                LinkedDictionary <Char, Object> children = (LinkedDictionary <Char, Object>)b;

                ICollection <Char> keys = children.Keys;
                foreach (Char k in keys)
                {
                    if (k == '$')
                    {
                        continue;
                    }
                    S.Push(children.GetValue(k));
                }
                if (children.ContainsKey('$') && children.GetValue('$') != null)
                {
                    E.add((Leaf)children.GetValue('$'));
                }
            }
            return(E.GetEnumerator());
        }
 public void GetValueTest()
 {
     Assert.AreEqual("Phillip", Dictionary.GetValue(12));
 }