コード例 #1
0
ファイル: IndexRecord.cs プロジェクト: missxiaohuang/Weekly
 public void AddDbcell(int cell)
 {
     if (field_5_dbcells == null)
     {
         field_5_dbcells = new IntList();
     }
     field_5_dbcells.Add(cell);
 }
コード例 #2
0
ファイル: IndexRecord.cs プロジェクト: missxiaohuang/Weekly
        /**
         * Constructs an Index record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public IndexRecord(RecordInputStream in1)
        {
            field_1_zero = in1.ReadInt();
            if (field_1_zero != 0)
            {
                throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero);
            }
            field_2_first_row = in1.ReadInt();
            field_3_last_row_add1 = in1.ReadInt();
            field_4_zero = in1.ReadInt();

            int nCells = in1.Remaining / 4;
            field_5_dbcells =
                new IntList(nCells);   // initial capacity of 30
            for (int i = 0; i < nCells; i++)
            {
                field_5_dbcells.Add(in1.ReadInt());
            }

        }
コード例 #3
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
 /// <summary>
 /// create a copy of an existing IntList
 /// </summary>
 /// <param name="list">the existing IntList</param>
 public IntList(IntList list)
     : this(list._array.Length)
 {
     Array.Copy(list._array, 0, _array, 0, _array.Length);
     _limit = list._limit;
 }
コード例 #4
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
        /// <summary>
        /// Retains only the elements in this list that are Contained in
        /// the specified collection.  In other words, Removes from this
        /// list all the elements that are not Contained in the specified
        /// collection.
        /// </summary>
        /// <param name="c">collection that defines which elements this Set will retain.</param>
        /// <returns>return true if this list Changed as a result of the call.</returns>
        public bool RetainAll(IntList c)
        {
            bool rval = false;

            for (int j = 0; j < _limit; )
            {
                if (!c.Contains(_array[j]))
                {
                    Remove(j);
                    rval = true;
                }
                else
                {
                    j++;
                }
            }
            return rval;
        }
コード例 #5
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
        /// <summary>
        /// Removes from this list all the elements that are Contained in
        /// the specified collection
        /// </summary>
        /// <param name="c">collection that defines which elements will be Removed from the list.</param>
        /// <returns>return true if this list Changed as a result of the call.</returns>
        public bool RemoveAll(IntList c)
        {
            bool rval = false;

            for (int j = 0; j < c._limit; j++)
            {
                if (RemoveValue(c._array[j]))
                {
                    rval = true;
                }
            }
            return rval;
        }
コード例 #6
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
        /// <summary>
        /// Returns true if this list Contains all of the elements of the
        /// specified collection.
        /// </summary>
        /// <param name="c">collection to be Checked for Containment in this list.</param>
        /// <returns>return true if this list Contains all of the elements of the specified collection.</returns>
        public bool ContainsAll(IntList c)
        {
            bool rval = true;

            if (this != c)
            {
                for (int j = 0; rval && (j < c._limit); j++)
                {
                    if (!Contains(c._array[j]))
                    {
                        rval = false;
                    }
                }
            }
            return rval;
        }
コード例 #7
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
        /// <summary>
        /// Inserts all of the elements in the specified collection into
        /// this list at the specified position.  Shifts the element
        /// currently at that position (if any) and any subsequent elements
        /// to the right (increases their indices).  The new elements will
        /// appear in this list in the order that they are returned by the
        /// specified collection's iterator.  The behavior of this
        /// operation is unspecified if the specified collection is
        /// modified while the operation is in progress.  (Note that this
        /// will occur if the specified collection is this list, and it's
        /// nonempty.)
        /// </summary>
        /// <param name="index">index at which to insert first element from the specified collection.</param>
        /// <param name="c">elements to be inserted into this list.</param>
        /// <returns>return true if this list Changed as a result of the call.</returns>
        public bool AddAll(int index, IntList c)
        {
            if (index > _limit)
            {
                throw new IndexOutOfRangeException();
            }
            if (c._limit != 0)
            {
                if ((_limit + c._limit) > _array.Length)
                {
                    growArray(_limit + c._limit);
                }

                // make a hole
                Array.Copy(_array, index, _array, index + c._limit,
                                 _limit - index);

                // fill it in
                Array.Copy(c._array, 0, _array, index, c._limit);
                _limit += c._limit;
            }
            return true;
        }
コード例 #8
0
ファイル: IntList.cs プロジェクト: missxiaohuang/Weekly
 /// <summary>
 /// Appends all of the elements in the specified collection to the
 /// end of this list, in the order that they are returned by the
 /// specified collection's iterator.  The behavior of this
 /// operation is unspecified if the specified collection is
 /// modified while the operation is in progress.  (Note that this
 /// will occur if the specified collection is this list, and it's
 /// nonempty.)
 /// </summary>
 /// <param name="c">collection whose elements are to be Added to this list.</param>
 /// <returns>return true if this list Changed as a result of the call.</returns>
 public bool AddAll(IntList c)
 {
     if (c._limit != 0)
     {
         if ((_limit + c._limit) > _array.Length)
         {
             growArray(_limit + c._limit);
         }
         Array.Copy(c._array, 0, _array, _limit, c._limit);
         _limit += c._limit;
     }
     return true;
 }