Beispiel #1
0
    /** @param ordered If false, methods that remove elements may change the order of other elements in the array, which avoids a
     *           memory copy.
     * @param capacity Any elements added beyond this will cause the backing array to be grown. */


    /** Creates a new array containing the elements in the specific array. The new array will be ordered if the specific array is
     * ordered. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be
     * grown. */
    public ShortArray(ShortArray array)
    {
        this.ordered = array.ordered;
        size         = array.size;
        items        = new short[size];
        Array.Copy(array.items, 0, items, 0, size);
    }
Beispiel #2
0
 public void addAll(ShortArray array, int offset, int Length)
 {
     if (offset + Length > array.size)
     {
         throw new AccessViolationException("offset + Length must be <= size: " + offset + " + " + Length + " <= " + array.size);
     }
     addAll(array.items, offset, Length);
 }
        public override void Dispose()
        {
            base.Dispose();

            ShortArray?.Dispose();
            ShortArray = null;
            ByteArray?.Dispose();
            ByteArray = null;
            FloatArray?.Dispose();
            FloatArray = null;
        }
Beispiel #4
0
        public override void Dispose()
        {
            base.Dispose();

            using (LockToReadAndWriteHeights())
            {
                ShortArray?.Dispose();
                ShortArray = null;
                ByteArray?.Dispose();
                ByteArray = null;
                FloatArray?.Dispose();
                FloatArray = null;
            }
        }
Beispiel #5
0
 protected bool Equals(KitchenSinkPortable other)
 {
     return(Bool == other.Bool && BoolArray.SequenceEqual(other.BoolArray) &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double) &&
            string.Equals(String, other.String) && StringArray.SequenceEqual(other.StringArray)
            );
 }
Beispiel #6
0
 protected bool Equals(KitchenSinkDataSerializable other)
 {
     return(BoolArray.SequenceEqual(other.BoolArray) && Bool == other.Bool &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double) &&
            string.Equals(Chars, other.Chars) && string.Equals(String, other.String) &&
            StringArray.SequenceEqual(other.StringArray) &&
            Equals(Serializable, other.Serializable) && Equals(Portable, other.Portable) &&
            Equals(Data, other.Data) && DateTime.Equals(other.DateTime));
 }
Beispiel #7
0
    /** Removes from this array all of elements contained in the specified array.
     * @return true if this array was modified. */
    public bool removeAll(ShortArray array)
    {
        int size      = this.size;
        int startSize = size;

        short[] items = this.items;
        for (int i = 0, n = array.size; i < n; i++)
        {
            short item = array.get(i);
            for (int ii = 0; ii < size; ii++)
            {
                if (item == items[ii])
                {
                    removeIndex(ii);
                    size--;
                    break;
                }
            }
        }
        return(size != startSize);
    }
Beispiel #8
0
    public bool equals(Object objecto)
    {
        if (objecto.Equals(this))
        {
            return(true);
        }
        if (!ordered)
        {
            return(false);
        }
        if (!(objecto is ShortArray))
        {
            return(false);
        }
        ShortArray array = (ShortArray)objecto;

        if (!array.ordered)
        {
            return(false);
        }
        int n = size;

        if (n != array.size)
        {
            return(false);
        }

        for (int i = 0; i < n; i++)
        {
            if (items[i] != array.items[i])
            {
                return(false);
            }
        }
        return(true);
    }
Beispiel #9
0
 public override short[] MapShortArray(ShortArray value)
 {
     return(value.AsObjectCopy());
 }
Beispiel #10
0
 /** @see #ShortArray(short[]) */
 static public ShortArray with(ShortArray array)
 {
     return(new ShortArray(array));
 }
Beispiel #11
0
 public void addAll(ShortArray array)
 {
     addAll(array, 0, array.size);
 }