Exemplo n.º 1
0
        static public int RunLists()
        {
            IntDeQueue q = new IntDeQueue(SIZE);

            for (int i = 0; i < SIZE; ++i)
            {
                q.PushBack(i + 1);
            }
            IntDeQueue q2 = (IntDeQueue)q.Clone();
            IntDeQueue q3 = new IntDeQueue(SIZE);

            while (!q2.Empty)
            {
                q3.PushBack(q2.PopFront());
            }
            while (!q3.Empty)
            {
                q2.PushBack(q3.PopBack());
            }
            q.Reverse();
            if (q.PeekFront() != SIZE)
            {
                logger.InfoFormat("q.PeekFront()!=SIZE");
                return(0);
            }
            if (!q.Equals(q2))
            {
                logger.InfoFormat("q!=q2");
                return(0);
            }

            return(q.Count);
        }
Exemplo n.º 2
0
		public object Clone ()
		{
			IntDeQueue temp = new IntDeQueue (size - 1);
			temp.start = start;
			temp.end = end;
			data.CopyTo (temp.data, 0);
			return temp;
		}
Exemplo n.º 3
0
        public object Clone()
        {
            IntDeQueue temp = new IntDeQueue(size - 1);

            temp.start = start;
            temp.end   = end;
            data.CopyTo(temp.data, 0);
            return(temp);
        }
Exemplo n.º 4
0
		public bool Equals (IntDeQueue other)
		{
			if (Count != other.Count)
				return false;

			int i = this.start;
			int iOther = other.start;

			while (i != this.end) {
				if (data [i] != other.data [iOther])
					return false;

				Advance (ref i);
				other.Advance (ref iOther);
			}
			return true;
		}
Exemplo n.º 5
0
        public bool Equals(IntDeQueue other)
        {
            if (Count != other.Count)
            {
                return(false);
            }

            int i      = this.start;
            int iOther = other.start;

            while (i != this.end)
            {
                if (data [i] != other.data [iOther])
                {
                    return(false);
                }

                Advance(ref i);
                other.Advance(ref iOther);
            }
            return(true);
        }
Exemplo n.º 6
0
		static public int RunLists ()
		{
			IntDeQueue q = new IntDeQueue (SIZE);
			for (int i = 0; i < SIZE; ++i)
				q.PushBack (i + 1);
			IntDeQueue q2 = (IntDeQueue)q.Clone ();
			IntDeQueue q3 = new IntDeQueue (SIZE);
			while (!q2.Empty)
				q3.PushBack (q2.PopFront ());
			while (!q3.Empty)
				q2.PushBack (q3.PopBack ());
			q.Reverse ();
			if (q.PeekFront () != SIZE) {
				logger.InfoFormat ("q.PeekFront()!=SIZE");
				return 0;
			}
			if (!q.Equals (q2)) {
				logger.InfoFormat ("q!=q2");
				return 0;
			}

			return q.Count;
		}