예제 #1
0
 public void PrintMenu(IIterator <string> iterator)
 {
     while (iterator.HasNext())
     {
         string menuItem = iterator.Next();
         Console.WriteLine(menuItem);
     }
 }
 private void IteratorPrinter(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         var menuItem = (MenuItem) iterator.Next();
         Console.WriteLine(String.Format("Name={0} Description={1} Vege?={2} Price={3}", menuItem.Name, menuItem.Description, menuItem.Vegetarian, menuItem.Price));
     }
 }
예제 #3
0
 private void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         var item = iterator.Next() as MenuItem;
         Console.WriteLine($"{item?.Name}, {item?.Price},{item?.Description}");
     }
 }
 public bool MoveNext()
 {
     gotCurrent = iterator.HasNext();
     if (gotCurrent)
     {
         current = iterator.Next();
     }
     return(gotCurrent);
 }
예제 #5
0
 private void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuItem menuItem = iterator.Next();
         Console.WriteLine($"{menuItem.Name}, {menuItem.Price.ToString(CultureInfo.InvariantCulture)} -- ");
         Console.WriteLine(menuItem.Description);
     }
 }
 //通过迭代器读取评价数据
 void ReadEvaluationAttribute()
 {
     mEvaluateIterator = SingletonGameData.GetInstance().CreateEvaluateIterator();
     while (mEvaluateIterator.HasNext())
     {
         EvaluationAttribute mEvaluationAttribute = (EvaluationAttribute)mEvaluateIterator.Next();
         mListEvaluationAttribute.Add(mEvaluationAttribute);
     }
 }
예제 #7
0
파일: XMLElement.cs 프로젝트: vb0067/LGame
 public string GetContents()
 {
     System.Text.StringBuilder sbr = new System.Text.StringBuilder(1024);
     for (IIterator e = Elements(); e.HasNext();)
     {
         sbr.Append(e.Next().ToString());
     }
     return(sbr.ToString());
 }
예제 #8
0
        public void ListMenus()
        {
            IIterator iterator = _allMenus.GetIterator();

            while (iterator.HasNext())
            {
                iterator.GetNext().Print();
            }
        }
예제 #9
0
 private void PrintMenu(IIterator iterator)               //хз зачем, но надо
 {
     while (iterator.HasNext())
     {
         MenuItem menuItem = iterator.Next();
         Console.Write(menuItem.getName() + ", ");
         Console.Write(menuItem.getPrice() + "----");
         Console.WriteLine(menuItem.getDescription() + "");
     }
 }
예제 #10
0
 private static void Iterate(IIterator <Menu> iterator)
 {
     while (iterator.HasNext())
     {
         Menu menu = iterator.Next();
         Console.WriteLine(menu.Name);
         Console.WriteLine(menu.Description);
         Console.WriteLine(menu.Price);
     }
 }
예제 #11
0
 private void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuItem item = (MenuItem)iterator.Next();
         Console.WriteLine(item.GetName());
         Console.WriteLine("\t\t" + item.GetPrice());
         Console.WriteLine("\t" + item.GetDescription());
     }
 }
예제 #12
0
 private void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuItem menuItem = (MenuItem) iterator.Next();
         Console.Write(menuItem.Name + ", ");
         Console.Write(menuItem.Price + " -- ");
         Console.WriteLine(menuItem.Description);
     }
 }
예제 #13
0
 private void _printingMenu(IIterator enumerator)
 {
     while (enumerator.HasNext())
     {
         PositionMenu positionMenu = (PositionMenu)enumerator.Current;
         Console.WriteLine(positionMenu.GetName() + ", ");
         Console.WriteLine(positionMenu.GetPrice() + ", ");
         Console.WriteLine(positionMenu.GetDescription());
     }
 }
예제 #14
0
        public static void test()
        {
            NameRepository namesRepository = new NameRepository();

            for (IIterator iter = namesRepository.GetIterator(); iter.HasNext();)
            {
                String name = (String)iter.Next();
                Console.WriteLine("Name : " + name);
            }
        }
예제 #15
0
        static void Main(string[] args)
        {
            NameRepository nameRepository = new NameRepository();
            IIterator      iter           = nameRepository.Iterator();

            while (iter.HasNext())
            {
                Console.WriteLine((string)iter.Next());
            }
        }
예제 #16
0
        static void Main(string[] args)
        {
            NameRepository nameRepository = new NameRepository();

            for (IIterator iterator = nameRepository.GetIterator(); iterator.HasNext();)
            {
                String name = iterator.Next() as String;
                Console.WriteLine("Name: " + name);
            }
        }
예제 #17
0
        public bool MoveNext()
        {
            bool hasNext = enume.HasNext();

            if (hasNext)
            {
                current = enume.Next();
            }
            return(hasNext);
        }
예제 #18
0
        public virtual void Clear()
        {
            IIterator <E> it = Iterator();

            while (it.HasNext())
            {
                it.Next();
                it.Remove();
            }
        }
        public static List <T> IteratorToArray <T>(IIterator <T> enumerator)
        {
            var result = new List <T>();

            while (enumerator.HasNext())
            {
                result.Add(enumerator.Next());
            }
            return(result);
        }
예제 #20
0
파일: ActorSet.cs 프로젝트: vb0067/LGame
        public void Clear()
        {
            IIterator e = Iterator();

            while (e.HasNext())
            {
                e.Next();
                e.Remove();
            }
        }
예제 #21
0
 private void printMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         MenuItem menuItem = iterator.Next();
         Console.WriteLine(menuItem.GetName() + ", ");
         Console.WriteLine(menuItem.GetPrice() + " -- ");
         Console.WriteLine(menuItem.GetDescription());
     }
 }
예제 #22
0
 public void PrintMenu(IIterator menuIterator)
 {
     while (menuIterator.HasNext())
     {
         MenuItem item = (MenuItem)menuIterator.Next();
         Console.WriteLine(item.Name);
         Console.WriteLine(item.Description);
         Console.WriteLine(item.Vegetarian);
         Console.WriteLine(item.Price);
     }
 }
예제 #23
0
        public static int Size(IIterator source)
        {
            int result = 0;

            while (source.HasNext())
            {
                source.Next();
                ++result;
            }
            return(result);
        }
예제 #24
0
        private static void PrintMenu(IIterator <MenuItem> iterator)
        {
            while (iterator.HasNext())
            {
                MenuItem menuItem = iterator.Next();

                Console.Write(menuItem.Name + ", ");
                Console.Write(menuItem.Price + " -- ");
                Console.WriteLine(menuItem.Description);
            }
        }
예제 #25
0
파일: Waitress.cs 프로젝트: MaxKlenin/Duck
 private static void PrintMenu(IIterator <MenuItem> iterator)
 {
     while (iterator.HasNext())
     {
         var menuItem = iterator.NextTo();
         Console.WriteLine("===============================");
         Console.Write(menuItem.GetName() + " - (");
         Console.WriteLine(menuItem.GetPrice() + "$)");
         Console.WriteLine(menuItem.GetDescription());
     }
 }
예제 #26
0
 public IEnumeratorAdapter(IIterator enume)
 {
     if (enume != null)
     {
         this.enume = enume;
         if (enume.HasNext())
         {
             this.current = enume.Next();
         }
     }
 }
예제 #27
0
        static void Main(string[] args)
        {
            NameRepository nameRepository = new NameRepository();
            IIterator      iterator       = nameRepository.GetIterator();

            while (iterator.HasNext())
            {
                string name = (string)iterator.Next();
                Console.WriteLine("Name : " + name);
            }
        }
예제 #28
0
 public void PrintMenu(IIterator iterator)
 {
     while (iterator.HasNext())
     {
         var item = iterator.Next() as MenuItemInfo;
         if (item != null)
         {
             Console.WriteLine(item.Name + ", " + item.Price + ", " + item.Description);
         }
     }
 }
예제 #29
0
            public Tuple <K, T> Next()
            {
                while (iterator == null || !iterator.HasNext())
                {
                    iterator = table[Index]?.GetIterator();

                    Index++;
                }

                return(iterator.Next());
            }
예제 #30
0
        private void _PrintMenus(IIterator iterator)
        {
            var log = "";

            while (iterator.HasNext())
            {
                MenuItem menu = (MenuItem)iterator.Next();
                log = log + $"{menu.Name} (¥{menu.Price})\n";
            }
            Debug.Log(log);
        }
예제 #31
0
 public IEnumeratorAdapter(IIterator enume)
 {
     if (enume != null)
     {
         this.enume = enume;
         if (enume.HasNext())
         {
             this.current = enume.Next();
         }
     }
 }
예제 #32
0
파일: Program.cs 프로젝트: zhzack/.net
        static void Main(string[] args)
        {
            ConcreteAggregate agg = new ConcreteAggregate();
            IIterator         ite = agg.CreateIterator();

            while (ite.HasNext())
            {
                Console.Write(ite.Next());
            }
            Console.WriteLine();
        }
예제 #33
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here
            previousState = mouseState;
            mouseState    = inputAdapter.GetMouseState();
            mousePosition = new Vector2(mouseState.Position.X, mouseState.Position.Y);

            keyboardState = inputAdapter.GetKeyboardState();

            switch (states)
            {
            case GameStates.MainWindow:
                while (mainWindowIterator.HasNext())
                {
                    mainWindowIterator.Next().Accept(updateVisitor);
                }
                break;

            case GameStates.LabelWindow:
                while (labelWindowIterator.HasNext())
                {
                    labelWindowIterator.Next().Accept(updateVisitor)
                    ;
                }
                break;

            case GameStates.InputFieldWindow:
                while (inputfieldIterator.HasNext())
                {
                    inputfieldIterator.Next().Accept(updateVisitor);
                }
                break;
            }

            base.Update(gameTime);
        }
예제 #34
0
        public String PrintMenu(IIterator iterator)
        {
            StringBuilder sb = new StringBuilder();
            while (iterator.HasNext()) {
                MenuItem menuItem = (MenuItem)iterator.Next();

                sb.Append(menuItem.Name + ", ");
                sb.Append(menuItem.Price + " -- ");
                sb.Append(menuItem.Description + "\n");
            }
            return sb.ToString();
        }
예제 #35
0
파일: ActorSet.cs 프로젝트: DONGChuan/LGame
 private static Actor[] FinishToArray(Actor[] r, IIterator it)
 {
     int i = r.Length;
     while (it.HasNext())
     {
         int cap = r.Length;
         if (i == cap)
         {
             int newCap = ((cap / 2) + 1) * 3;
             if (newCap <= cap)
             {
                 if (cap == int.MaxValue)
                     newCap = int.MaxValue;
             }
             r = (Actor[])CollectionUtils.CopyOf(r, newCap);
         }
         r[i++] = (Actor)it.Next();
     }
     return (i == r.Length) ? r : (Actor[])CollectionUtils.CopyOf(r, i);
 }
예제 #36
0
 /// <summary>Handles the iteration of the children or qualfier</summary>
 /// <param name="iterator">an iterator</param>
 /// <returns>Returns if there are more elements available.</returns>
 private bool IterateChildrenMethod(IIterator iterator)
 {
     if (_enclosing._skipSiblings)
     {
         // setSkipSiblings(false);
         _enclosing._skipSiblings = false;
         _subIterator = Enumerable.Empty<object>().Iterator();
     }
     // create sub iterator for every child,
     // if its the first child visited or the former child is finished
     if ((!_subIterator.HasNext()) && iterator.HasNext())
     {
         var child = (XmpNode)iterator.Next();
         _index++;
         _subIterator = new NodeIterator(_enclosing, child, _path, _index);
     }
     if (_subIterator.HasNext())
     {
         _returnProperty = (IXmpPropertyInfo)_subIterator.Next();
         return true;
     }
     return false;
 }