Ejemplo n.º 1
0
        public void test_dequeue()
        {
            var queue = new QueueList(3);

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Dequeue();
            var value = queue.Dequeue();

            Assert.AreEqual(1, value);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            QueueList <int> queueList = new QueueList <int>();

            queueList.Enqueue(1);
            queueList.Enqueue(2);
            queueList.Enqueue(3);
            queueList.Enqueue(4);
            queueList.Enqueue(5);

            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());



            Console.ReadLine();
        }
Ejemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////

        public static string GetCommand(
            Interpreter interpreter,
            bool ignoreEnabled
            )
        {
            string result = null;

#if DEBUGGER
            if (interpreter != null)
            {
                lock (interpreter.SyncRoot) /* TRANSACTIONAL */
                {
                    IDebugger debugger = interpreter.Debugger;

                    if ((debugger != null) &&
                        (ignoreEnabled || debugger.Enabled))
                    {
                        //
                        // NOTE: Enforce "one-time" semantics.
                        //
                        result = debugger.Command;

                        if (result != null)
                        {
                            debugger.Command = null;
                        }
                        else
                        {
                            //
                            // NOTE: *NEW* Fallback to looking in the debugger
                            //       command queue for interactive commands.
                            //
                            QueueList <string, string> queue = debugger.Queue;

                            if ((queue != null) && (queue.Count > 0))
                            {
                                result = queue.Dequeue();
                            }
                        }
                    }
                }
            }
#endif

            return(result);
        }
Ejemplo n.º 4
0
    private void NextTurnInQueue()
    {
        currentCharacter = turnQueue.Dequeue();

        if (currentCharacter is BattleCharacter_Party)
        {
            if ((currentCharacter as BattleCharacter_Party).IsKnockedOut == true)
            {
                SetupNextTurn();
            }
        }

        MoveCharacterToPoint(currentCharacter, PointType.Attack);
        currentCharacter.ProcessEffects();

        if (currentCharacter is BattleCharacter_Party)
        {
            BattleHUD.Instance.UpdateMenu(BattleHUD.MenuType.Main);
        }
        else if (currentCharacter is BattleCharacter_Enemy)
        {
            EnemyTurn();
        }
    }
Ejemplo n.º 5
0
 public PrintJob RemoveFront()
 {
     return(QueueList.Dequeue());
 }
Ejemplo n.º 6
0
        public void test_dequeue_error_empty_queue()
        {
            var queue = new QueueList(3);

            Assert.Throws <InvalidOperationException>(() => queue.Dequeue());
        }