PIndexSet
public struct PIndexSet : Equatable
PIndexSet represents a (non-strict) subset of indices of a column or table.
PIndexSet is used for masking and other operations on a PTypedColumn, a PColumn, and a
PTable. A PIndexSet is most often created via operations on the column types, such as
PColumn‘s nils property, which returns a PIndexSet representing all the indices (rows)
containing nils.
To help catch errors, operations on PIndexSets check to ensure they represent collections of
the same size. e.g. When a PIndexSet is used to select rows out of a PTable, the count
property of the PIndexSet is checked to ensure it is exactly equal to the PTable’s count
property.
PIndexSet supports both in-place and chaining set operations.
-
Initializes a
PIndexSetgiven a set of indices.Declaration
Swift
public init(indices: [Int], count: Int)Parameters
indicesThe indices to include in the set.
countThe number of rows this
PIndexSetcovers. -
Initializes a
PIndexSetwhere every index is set tovalue.Declaration
Swift
public init(all value: Bool, count: Int)Parameters
valueEvery index is included when
valueis true. Ifvalueis false, then no indices are included.countThe number of rows in this
PIndexSet. -
Include all indices in
rhsintoself.Declaration
Swift
public mutating func union(_ rhs: PIndexSet, extending: Bool? = nil) throws -
Return a new
PIndexSetthat includes all indices from bothselfandrhs.Declaration
Swift
public func unioned(_ rhs: PIndexSet, extending: Bool? = nil) throws -> PIndexSet -
Retain only indicies in both
selfand `rhs.Declaration
Swift
public mutating func intersect(_ rhs: PIndexSet, extending: Bool? = nil) throws -
Return a new
PIndexSetthat includes only indices in bothselfandrhs.Declaration
Swift
public func intersected(_ rhs: PIndexSet, extending: Bool? = nil) throws -> PIndexSet -
Return a new
PIndexSetwhere all indices included inaare excluded, and all excluded inaare included.Declaration
Swift
public prefix static func ! (a: PIndexSet) -> PIndexSet -
Total size of the collection represented by the
PIndexSet.Note: this should not be confused with the number of indices set within the
PIndexSet.Declaration
Swift
public var count: Int { get } -
Returns
trueif there is at least one index included in thisPIndexSet, false otherwise.Declaration
Swift
public var isEmpty: Bool { get } -
Undocumented
Declaration
Swift
public private(set) var setCount: Int
View on GitHub
PIndexSet Structure Reference