Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
 private HashSet <AbsolutePath> MaterializeBitSet(RoaringBitSet bitSet, ISourceFile[] files)
 {
     bitSet.MaterializeSetIfNeeded(string.Empty, (s, i) => files[i].GetAbsolutePath(m_pathTable));
     return(bitSet.MaterializedSetOfPaths);
 }
Exemplo n.º 7
0
 public static RoaringBitSet CreateBitSetWithRandomContent(int length)
 {
     return(RoaringBitSet.FromBitArray(CraeteBitArrayWithRandomContent(length)));
 }
Exemplo n.º 8
0
 /// <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())));
 }