Exemple #1
0
 /// <summary>
 /// Append copy of the one value from another array
 /// </summary>
 /// <param name="sa">
 /// other array
 /// </param>
 /// <param name="index">
 /// index in the other array
 /// </param>
 public void appendCopy(RoaringArray sa, int index)
 {
     extendArray(1);
     this.keys[this.size]   = sa.keys[index];
     this.values[this.size] = sa.values[index].clone();
     this.size++;
 }
 /// <summary>
 /// Append copy of the one value from another array
 /// </summary>
 /// <param name="sa">
 /// other array
 /// </param>
 /// <param name="index">
 /// index in the other array
 /// </param>
 public void appendCopy(RoaringArray sa, int index)
 {
     extendArray(1);
     this.keys[this.size] = sa.keys[index];
     this.values[this.size] = sa.values[index].clone();
     this.size++;
 }
Exemple #3
0
 /// <summary>Append copy of the one value from another array</summary>
 /// <param name="sa">Other array</param>
 /// <param name="index">Index in the other array</param>
 public void AppendCopy(RoaringArray sa, int index)
 {
     ExtendArray(1);
     this.keys[this.Size]   = sa.keys[index];
     this.values[this.Size] = sa.values[index].Clone();
     this.Size++;
 }
 /// <summary>Append copy of the one value from another array</summary>
 /// <param name="sa">Other array</param>
 /// <param name="index">Index in the other array</param>
 public void AppendCopy(RoaringArray sa, int index)
 {
     ExtendArray(1);
     this.keys[this.Size] = sa.keys[index];
     this.values[this.Size] = sa.values[index].Clone();
     this.Size++;
 }
Exemple #5
0
 /// <summary>
 /// Append copies of the values from another array
 /// </summary>
 /// <param name="sa">
 /// other array
 /// </param>
 /// <param name="startingIndex">
 /// starting index in the other array
 /// </param>
 /// <param name="end">
 /// (exclusive) in the other array
 /// </param>
 public void appendCopy(RoaringArray sa, int startingIndex, int end)
 {
     extendArray(end - startingIndex);
     for (int i = startingIndex; i < end; ++i)
     {
         this.keys[this.size]   = sa.keys[i];
         this.values[this.size] = sa.values[i].clone();
         this.size++;
     }
 }
Exemple #6
0
 /// <summary>Append copies of the values from another array</summary>
 /// <param name="sa">other array</param>
 /// <param name="startingIndex">starting index in the other array</param>
 /// <param name="end">(exclusive) in the other array</param>
 public void AppendCopy(RoaringArray sa, int startingIndex, int end)
 {
     ExtendArray(end - startingIndex);
     for (int i = startingIndex; i < end; ++i)
     {
         keys[Size]   = sa.keys[i];
         values[Size] = sa.values[i].Clone();
         Size++;
     }
 }
Exemple #7
0
        /// <summary>
        /// Read a binary serialization of a roaring bitset, as written by the Serialize method.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        /// <returns>The bitset deserialized from the stream.</returns>
        public static RoaringBitset Deserialize(Stream stream)
        {
            RoaringBitset bitset = new RoaringBitset();

            //We don't care about the encoding, but we have to specify something to be able to set the stream as leave open.
            using (BinaryReader reader = new BinaryReader(stream, Encoding.Default, true))
            {
                bitset.containers = RoaringArray.Deserialize(reader);
            }

            return(bitset);
        }
Exemple #8
0
        /// <summary>
        /// Deserialize a roaring array from a binary format, as written by the Serialize method.
        /// </summary>
        /// <param name="reader">The reader from which to deserialize the roaring array.</param>
        /// <returns></returns>
        public static RoaringArray Deserialize(BinaryReader reader)
        {
            RoaringArray array = new RoaringArray(reader.ReadInt32());

            for(int i = 0; i < array.size; i++)
            {
                array.keys[i] = (ushort) reader.ReadInt16();
                array.values[i] = Container.Deserialize(reader);
            }

            return array;
        }
Exemple #9
0
        /// <summary>
        /// Deserialize a roaring array from a binary format, as written by the Serialize method.
        /// </summary>
        /// <param name="reader">The reader from which to deserialize the roaring array.</param>
        /// <returns></returns>
        public static RoaringArray Deserialize(BinaryReader reader)
        {
            RoaringArray array = new RoaringArray(reader.ReadInt32());

            for (int i = 0; i < array.size; i++)
            {
                array.keys[i]   = (ushort)reader.ReadInt16();
                array.values[i] = Container.Deserialize(reader);
            }

            return(array);
        }
        public RoaringArray clone() {
            RoaringArray sa = new RoaringArray();

            sa.keys = new ushort[this.keys.Length];
            this.keys.CopyTo(sa.keys, 0);

            sa.values = new Container[this.values.Length];
            this.values.CopyTo(sa.values, 0);

            for (int k = 0; k < this.size; ++k)
                sa.values[k] = sa.values[k].clone();

            sa.size = this.size;
            
            return sa;
        }
Exemple #11
0
        public RoaringArray clone()
        {
            RoaringArray sa = new RoaringArray();

            sa.keys = new ushort[this.keys.Length];
            this.keys.CopyTo(sa.keys, 0);

            sa.values = new Container[this.values.Length];
            this.values.CopyTo(sa.values, 0);

            for (int k = 0; k < this.size; ++k)
            {
                sa.values[k] = sa.values[k].clone();
            }

            sa.size = this.size;

            return(sa);
        }
Exemple #12
0
        /// <summary>
        /// Creates a deep copy of this roaring array
        /// </summary>
        /// <returns>A new roaring array</returns>
        public RoaringArray Clone()
        {
            RoaringArray sa = new RoaringArray();

            sa.keys = new ushort[keys.Length];
            keys.CopyTo(sa.keys, 0);

            sa.values = new Container[values.Length];
            values.CopyTo(sa.values, 0);

            for (int k = 0; k < Size; ++k)
            {
                sa.values[k] = sa.values[k].Clone();
            }

            sa.Size = Size;

            return(sa);
        }
Exemple #13
0
 public override bool Equals(Object o)
 {
     if (o is RoaringArray)
     {
         RoaringArray srb = (RoaringArray)o;
         if (srb.size != this.size)
         {
             return(false);
         }
         for (int i = 0; i < srb.size; ++i)
         {
             if (this.keys[i] != srb.keys[i] || !this.values[i].Equals(srb.values[i]))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Exemple #14
0
        public override bool Equals(object o)
        {
            if (!(o is RoaringArray))
            {
                return(false);
            }

            RoaringArray srb = (RoaringArray)o;

            if (srb.Size != Size)
            {
                return(false);
            }

            for (int i = 0; i < srb.Size; ++i)
            {
                if (keys[i] != srb.keys[i] || !values[i].Equals(srb.values[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
 /// <summary>
 /// Append copies of the values from another array
 /// </summary>
 /// <param name="sa">
 /// other array
 /// </param>
 /// <param name="startingIndex">
 /// starting index in the other array
 /// </param>
 /// <param name="end">
 /// (exclusive) in the other array
 /// </param>
 public void appendCopy(RoaringArray sa, int startingIndex, int end)
 {
     extendArray(end - startingIndex);
     for (int i = startingIndex; i < end; ++i)
     {
         this.keys[this.size] = sa.keys[i];
         this.values[this.size] = sa.values[i].clone();
         this.size++;
     }
 }