예제 #1
0
        internal FixedLengthHeap(int length, int segmentLength)
        {
            Length   = length;
            FreeList = new NaiadList <int>(0);
            Spine    = new NaiadList <T[]>(0);

            SegmentLength = Math.Max(segmentLength, Length);

            Allocated = 0;
        }
예제 #2
0
        public static NaiadList <S> operator+(NaiadList <S> a, NaiadList <S> b)
        {
            var result = new NaiadList <S>(a.count + b.count);

            for (var i = 0; i < a.count; ++i)
            {
                result.Array[i] = a.Array[i];
            }
            for (var i = 0; i < b.count; ++i)
            {
                result.Array[i + a.count] = b.Array[i];
            }
            return(result);
        }
예제 #3
0
        public bool Equals(NaiadList <S> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other.Count != Count)
            {
                return(false);
            }

            for (int i = 0; i < Count; ++i)
            {
                if (!Array[i].Equals(other.Array[i]))
                {
                    return(false);
                }
            }
            return(true);
        }