Skip to content

Commit 5b83f40

Browse files
committed
more comment fixing
1 parent 6ae1388 commit 5b83f40

File tree

1 file changed

+19
-34
lines changed

1 file changed

+19
-34
lines changed

Sources/SwiftRoaring/RoaringBitmap.swift

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import croaring
22

3-
/**
4-
* This class contains different values about a given RoaringBitmap
5-
*/
3+
///
4+
/// This class contains different values about a given RoaringBitmap
5+
///
66
public typealias RoaringStatistics = roaring_statistics_t
77

8-
/**
9-
* Swift wrapper for CRoaring (a C/C++ implementation at https://github.com/RoaringBitmap/CRoaring)
10-
*/
8+
///
9+
/// Swift wrapper for CRoaring (a C/C++ implementation at https://github.com/RoaringBitmap/CRoaring)
10+
///
1111
public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
1212
Hashable, ExpressibleByArrayLiteral {
1313
var ptr: UnsafeMutablePointer<roaring_bitmap_t>
@@ -72,7 +72,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
7272
/// caller is
7373
/// responsible for memory management.
7474
///
75-
///
7675
public func intersection(_ x: RoaringBitmap) -> RoaringBitmap {
7776
return RoaringBitmap(ptr: croaring.roaring_bitmap_and(self.ptr, x.ptr))
7877
}
@@ -81,7 +80,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
8180
/// caller is
8281
/// responsible for memory management.
8382
///
84-
///
8583
public static func &(left: RoaringBitmap, right: RoaringBitmap) -> RoaringBitmap {
8684
return left.intersection(right)
8785
}
@@ -102,15 +100,13 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
102100
///
103101
/// Computes the size of the intersection between two bitmaps.
104102
///
105-
///
106103
public func intersectionCount(_ x: RoaringBitmap) -> UInt64 {
107104
return croaring.roaring_bitmap_and_cardinality(self.ptr, x.ptr)
108105
}
109106

110107
///
111108
/// Check whether two bitmaps intersect.
112109
///
113-
///
114110
public func intersect(_ x: RoaringBitmap) -> Bool {
115111
return croaring.roaring_bitmap_intersect(self.ptr, x.ptr)
116112
}
@@ -122,23 +118,20 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
122118
///
123119
/// The Jaccard index is undefined if both bitmaps are empty.
124120
///
125-
///
126121
public func jaccardIndex(_ x: RoaringBitmap) -> Double {
127122
return croaring.roaring_bitmap_jaccard_index(self.ptr, x.ptr)
128123
}
129124

130125
///
131126
/// Computes the size of the union between two bitmaps.
132127
///
133-
///
134128
public func unionCount(_ x: RoaringBitmap) -> UInt64 {
135129
return croaring.roaring_bitmap_or_cardinality(self.ptr, x.ptr)
136130
}
137131

138132
///
139133
/// Computes the size of the difference (andnot) between two bitmaps.
140134
///
141-
///
142135
public func subtractingCount(_ x: RoaringBitmap) -> UInt64 {
143136
return croaring.roaring_bitmap_andnot_cardinality(self.ptr, x.ptr)
144137
}
@@ -153,7 +146,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
153146
///
154147
/// Computes the size of the symmetric difference (andnot) between two bitmaps.
155148
///
156-
///
157149
public func symmetricDifferenceCount(_ x: RoaringBitmap) -> UInt64 {
158150
return croaring.roaring_bitmap_xor_cardinality(self.ptr, x.ptr)
159151
}
@@ -180,18 +172,16 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
180172
croaring.roaring_bitmap_or_inplace(self.ptr, x.ptr)
181173
}
182174
///
183-
/// Inplace version of roaring_bitmap_or, modifies x1.
175+
/// Inplace version of `roaring_bitmap_or, modifies` x1.
184176
///
185177
public static func |=(left: RoaringBitmap, right: RoaringBitmap) {
186178
left.formUnion(right)
187179
}
188180

189181
///
190-
/// Compute the union of 'number' bitmaps. See also roaring_bitmap_or_many_heap.
191-
/// Caller is responsible for freeing the
192-
/// result.
182+
/// Compute the union of 'number' bitmaps. See also `roaring_bitmap_or_many_heap`.
183+
/// Caller is responsible for freeing the result.
193184
///
194-
195185
public func unionMany(_ xs: [RoaringBitmap]) -> RoaringBitmap {
196186
let ptr = UnsafeMutablePointer<Optional<UnsafePointer<roaring_bitmap_t>>>.allocate(capacity: xs.count + 1)
197187
ptr[0] = UnsafePointer<roaring_bitmap_t>(self.ptr)
@@ -202,11 +192,10 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
202192
}
203193
///
204194
/// Compute the union of 'number' bitmaps using a heap. This can
205-
/// sometimes be faster than roaring_bitmap_or_many which uses
195+
/// sometimes be faster than `roaring_bitmap_or_many` which uses
206196
/// a naive algorithm. Caller is responsible for freeing the
207197
/// result.
208198
///
209-
///
210199
public func unionManyHeap(_ xs: [RoaringBitmap]) -> RoaringBitmap {
211200
let ptr = UnsafeMutablePointer<Optional<UnsafePointer<roaring_bitmap_t>>>.allocate(capacity: xs.count + 1)
212201
ptr[0] = UnsafePointer<roaring_bitmap_t>(self.ptr)
@@ -234,14 +223,12 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
234223
///
235224
/// Inplace version of roaring_bitmap_xor, modifies x1. x1 != x2.
236225
///
237-
///
238226
public func formSymmetricDifference(_ x: RoaringBitmap) {
239227
croaring.roaring_bitmap_xor_inplace(self.ptr, x.ptr)
240228
}
241229
///
242230
/// Inplace version of roaring_bitmap_xor, modifies x1. x1 != x2.
243231
///
244-
///
245232
public static func ^=(left: RoaringBitmap, right: RoaringBitmap) {
246233
left.formSymmetricDifference(right)
247234
}
@@ -251,7 +238,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
251238
/// Caller is responsible for freeing the
252239
/// result.
253240
///
254-
///
255241
public func symmetricDifferenceMany(_ xs: [RoaringBitmap]) -> RoaringBitmap {
256242
let ptr = UnsafeMutablePointer<Optional<UnsafePointer<roaring_bitmap_t>>>.allocate(capacity: xs.count + 1)
257243
ptr[0] = UnsafePointer<roaring_bitmap_t>(self.ptr)
@@ -279,14 +265,12 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
279265
///
280266
/// Inplace version of roaring_bitmap_andnot, modifies x1. x1 != x2.
281267
///
282-
///
283268
public func subtract(_ x: RoaringBitmap) {
284269
croaring.roaring_bitmap_andnot_inplace(self.ptr, x.ptr)
285270
}
286271
///
287272
/// Inplace version of roaring_bitmap_andnot, modifies x1. x1 != x2.
288273
///
289-
///
290274
public static func -=(left: RoaringBitmap, right: RoaringBitmap) {
291275
left.subtract(right)
292276
}
@@ -365,7 +349,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
365349
/// to call roaring_bitmap_repair_after_lazy after executing "lazy" computations.
366350
/// It is safe to repeatedly call roaring_bitmap_lazy_xor_inplace on the result.
367351
///
368-
///
369352
public func lazySymmetricDifference(_ x: RoaringBitmap) -> RoaringBitmap {
370353
return RoaringBitmap(ptr: croaring.roaring_bitmap_lazy_xor(self.ptr, x.ptr))
371354
}
@@ -374,7 +357,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
374357
/// (For expert users who seek high performance.)
375358
/// Inplace version of roaring_bitmap_lazy_xor, modifies x1. x1 != x2
376359
///
377-
///
378360
public func formLazySymmetricDifference(_ x: RoaringBitmap) {
379361
croaring.roaring_bitmap_lazy_xor_inplace(self.ptr, x.ptr)
380362
}
@@ -407,7 +389,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
407389
/// Copies a bitmap. This does memory allocation. The caller is responsible for
408390
/// memory management.
409391
///
410-
///
411392
public func copy() -> RoaringBitmap {
412393
return RoaringBitmap(ptr: croaring.roaring_bitmap_copy(self.ptr))
413394
}
@@ -428,7 +409,6 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
428409
///
429410
/// Add value x
430411
///
431-
///
432412
public func add(_ value: UInt32) {
433413
croaring.roaring_bitmap_add(self.ptr, value)
434414
}
@@ -625,6 +605,7 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
625605
return croaring.roaring_bitmap_serialize(self.ptr, &buffer)
626606
}
627607

608+
///
628609
/// use with roaring_bitmap_serialize
629610
/// see roaring_bitmap_portable_deserialize if you want a format that's
630611
/// compatible with Java and Go implementations
@@ -734,7 +715,7 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
734715
}
735716

736717
///
737-
/// (For advanced users.)
718+
/// (For advanced users.)
738719
/// Collect statistics about the bitmap, see RoaringStatistics.swift for
739720
/// a description of RoaringStatistics
740721
///
@@ -772,7 +753,9 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
772753
}
773754
}
774755

775-
/* returns a string representation of the bitset */
756+
///
757+
/// returns a string representation of the bitset
758+
///
776759
public var description: String {
777760
var ret = prefix(100).map { $0.description }.joined(separator: ", ")
778761
if self.count >= 100 {
@@ -781,8 +764,10 @@ public class RoaringBitmap: Sequence, Equatable, CustomStringConvertible,
781764
return "{\(ret)}"
782765
}
783766

784-
/* hash value for the bitset, this is expensive and should be buffered
785-
for performance */
767+
///
768+
/// hash value for the bitset, this is expensive and should be buffered
769+
/// for performance
770+
///
786771
public func hash(into hasher: inout Hasher) {
787772
let b: UInt32 = 31
788773
var hash: UInt32 = 0

0 commit comments

Comments
 (0)