コード例 #1
0
        public int TestPush(int[] elements)
        {
            CustomQueue <int> queue = new CustomQueue <int>(elements);

            queue.Push(1);
            return(queue.Count());
        }
コード例 #2
0
        public int TestPeek(int[] elements)
        {
            CustomQueue <int> queue = new CustomQueue <int>(elements);

            queue.Pop();
            queue.Push(1);
            return(queue.Peek());
        }
コード例 #3
0
ファイル: Spawn.cs プロジェクト: turtle328/tower-defense-game
 void InitWave()
 {
     string[] curWave = waves[wave].Split(':');
     foreach (string monster in curWave)
     {
         string[] info = monster.Split(' ');
         if (info[MONSTER_TYPE] == "interval")
         {
             monsters.Push(info[NUM_OF_MONSTER]);
         }
         else
         {
             for (int i = 0; i < int.Parse(info[NUM_OF_MONSTER]); i++)
             {
                 monsters.Push(info[MONSTER_TYPE]);
             }
         }
     }
 }
コード例 #4
0
        public bool TestGetEnumenator(int[] elements, string expectedResult)
        {
            CustomQueue <int> queue = new CustomQueue <int>(elements);

            queue.Pop();
            queue.Push(1);
            string result = "";

            foreach (var i in queue)
            {
                result += i + " ";
            }
            return(expectedResult.Equals(result));
            //return queue.Aggregate("", (current, i) => current + (i + " "));
        }
コード例 #5
0
        public int solution(string S)
        {
            if (S.Length <= 1)
            {
                return(0);
            }

            int longestBalanced = 0;

            CustomQueue queue = new CustomQueue();

            for (int i = 0; i < S.Length; i++)
            {
                queue.Push(S[i]);
                if (queue.GetCurrentLongest() > longestBalanced)
                {
                    longestBalanced = queue.GetCurrentLongest();
                }
            }

            return(longestBalanced);
        }
コード例 #6
0
ファイル: Omni.cs プロジェクト: Winterleaf/OmniEngine.Net
 private void RegisterSimObject_Callback(int arrayPosition, bool addObject, StringBuilder classNameSpace, StringBuilder className)
 {
     _msimdict[arrayPosition] = null;
     _mAvailable.Push(arrayPosition);
     deletedcount++;
 }