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 PIndexSet given a set of indices.

    Declaration

    Swift

    public init(indices: [Int], count: Int)

    Parameters

    indices

    The indices to include in the set.

    count

    The number of rows this PIndexSet covers.

  • Initializes a PIndexSet where every index is set to value.

    Declaration

    Swift

    public init(all value: Bool, count: Int)

    Parameters

    value

    Every index is included when value is true. If value is false, then no indices are included.

    count

    The number of rows in this PIndexSet.

  • Include all indices in rhs into self.

    Declaration

    Swift

    public mutating func union(_ rhs: PIndexSet, extending: Bool? = nil) throws
  • Return a new PIndexSet that includes all indices from both self and rhs.

    Declaration

    Swift

    public func unioned(_ rhs: PIndexSet, extending: Bool? = nil) throws -> PIndexSet
  • Retain only indicies in both self and `rhs.

    Declaration

    Swift

    public mutating func intersect(_ rhs: PIndexSet, extending: Bool? = nil) throws
  • Return a new PIndexSet that includes only indices in both self and rhs.

    Declaration

    Swift

    public func intersected(_ rhs: PIndexSet, extending: Bool? = nil) throws -> PIndexSet
  • Return a new PIndexSet where all indices included in a are excluded, and all excluded in a are 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 true if there is at least one index included in this PIndexSet, false otherwise.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • Undocumented

    Declaration

    Swift

    public private(set) var setCount: Int