public LongStream() { this.ostream = new OctetStream (); this.offsets = new List<int> (); this.count = 0; this.ctx = new OctetStream.Context (); }
public LongStream(LongStream longstream) { this.ostream = new OctetStream (longstream.ostream); this.offsets = longstream.offsets; this.count = longstream.count; this.ctx = new OctetStream.Context (); }
/// <summary> /// Retrives the long stored at <term>index</term> position of the stream /// </summary> public long this[int index] { get { var ctx = new OctetStream.Context (this.offsets [index >> OFFSET_MASK_LENGTH]); int resting = index & OFFSET_MASK; long value = CODER.Decode (this.ostream, ctx); for (int i = 0; i < resting; ++i) { value = CODER.Decode (this.ostream, ctx); } return value; } }
public void Decompress(List<long> list, int symbol) { var m = this.lengths [symbol]; var ctx = new OctetStream.Context (this.offsets [symbol]); this.lstream.Decompress (list, ctx, m); for (int i = 1; i < list.Count; ++i) { list [i] += list [i - 1]; } }
public void Decompress(List<long> list, int firstIndex, int count) { var ctx = new OctetStream.Context (); ctx.Offset = this.offsets [firstIndex >> OFFSET_MASK_LENGTH]; int resting = firstIndex & OFFSET_MASK; for (int i = 0; i < resting; ++i) { CODER.Decode (this.ostream, ctx); } for (int i = 0; i < count; ++i) { var u = CODER.Decode (this.ostream, ctx); list.Add (u); } }