public int Add(IEnumerable<int> sortedlist) { long prev = -1; var pos = 0; var count = 0; foreach (var item in sortedlist) { if (prev == -1) { pos = this.lstream.Add (item); } else { this.lstream.Add (item - prev); } prev = item; ++count; } this.offsets.Add (pos); this.lengths.Add (count); this.numberOfItems += count; return this.offsets.Count - 1; }
public static CompressedInvertedIndex Build(InvertedIndex invindex) { var cii = new CompressedInvertedIndex (); for (int s = 0; s < invindex.Count; ++s) { cii.Add (invindex [s]); } return cii; }