/// <summary> /// Serializes the <see cref="RoaringBitSet"/> to the given writer. /// </summary> public static void SerializeBitSet([NotNull] RoaringBitSet bitArray, [NotNull] BuildXLWriter writer) { var set = bitArray.MaterializedSet; writer.WriteCompact(set.Count); foreach (var index in set) { writer.WriteCompact(index); } }
public void SerializeEmptyVector() { // Arrange var bitArray = RoaringBitSet.FromBitArray(new ConcurrentBitArray(42)); // Act var copy = Copy(bitArray, m_pathTable); // Assert Assert.Equal(bitArray, copy, m_comparer); }
public static RoaringBitSet DeserializeBitVector([NotNull] BuildXLReader reader) { var size = reader.ReadInt32Compact(); var set = new HashSet <int>(); for (int i = 0; i < size; i++) { set.Add(reader.ReadInt32Compact()); } return(RoaringBitSet.FromSet(set)); }
private static RoaringBitSet Copy(RoaringBitSet bitArray, PathTable pathTable) { bitArray.MaterializeSet(pathTable); using (var ms = new MemoryStream()) { BuildXLWriter writer = new BuildXLWriter(true, ms, true, true); FrontEndSnapshotSerializer.SerializeBitSet(bitArray, writer); ms.Position = 0; BuildXLReader reader = new BuildXLReader(true, ms, true); return(FrontEndSnapshotSerializer.DeserializeBitVector(reader)); } }
/// <nodoc /> public SpecBindingState( AbsolutePath fullPath, [NotNull] string referencedSymbolsFingerprint, [NotNull] string declaredSymbolsFingerprint, [NotNull] RoaringBitSet fileDependencies, [NotNull] RoaringBitSet fileDependents) { Contract.Requires(fullPath.IsValid, "fullPath.IsValid"); Contract.Requires(referencedSymbolsFingerprint != null, "referencedSymbolsFingerprint != null"); Contract.Requires(declaredSymbolsFingerprint != null, "declaredSymbolsFingerprint != null"); Contract.Requires(fileDependencies != null, "fileDependencies != null"); Contract.Requires(fileDependencies != null, "fileDependencies != null"); m_fullPath = fullPath; BindingSymbols = new SpecBindingSymbols(declaredSymbolsFingerprint, referencedSymbolsFingerprint); FileDependencies = fileDependencies; FileDependents = fileDependents; }
private HashSet <AbsolutePath> MaterializeBitSet(RoaringBitSet bitSet, ISourceFile[] files) { bitSet.MaterializeSetIfNeeded(string.Empty, (s, i) => files[i].GetAbsolutePath(m_pathTable)); return(bitSet.MaterializedSetOfPaths); }
public static RoaringBitSet CreateBitSetWithRandomContent(int length) { return(RoaringBitSet.FromBitArray(CraeteBitArrayWithRandomContent(length))); }
/// <nodoc /> public static HashSet <int> MaterializeSet(this RoaringBitSet bitSet, PathTable pathTable) { return(bitSet.MaterializeSetIfNeeded(string.Empty, (s, i) => AbsolutePath.Create(pathTable, A("C") + i.ToString()))); }