ContiguousSegmentCollection
-
A generic collection of contiguous
Intervallic
-type value whereinIntervallic
types are stored by their offset.Example Usage
let collection: ContiguousSegmentCollection = [1,2,1,3]
This creates a
ContiguousSegmentCollection<Int>
, where theMetric
andIntervallic
types are bothInt
. Each segment is the length of a given value, and is stored by the accumulating offset.The resulting structure could be represented like this:
See moreoffset: 0 1 3 4 7 |-|--|-|---| length: 1 2 1 3
Declaration
Swift
public struct ContiguousSegmentCollection <Segment: Intervallic> where Segment.Metric: Hashable & Additive
extension ContiguousSegmentCollection: Intervallic
extension ContiguousSegmentCollection: RandomAccessCollectionWrapping
extension ContiguousSegmentCollection: ExpressibleByArrayLiteral
extension ContiguousSegmentCollection: CustomStringConvertible
extension ContiguousSegmentCollection: Fragmentable where Metric: Zero, Segment: IntervallicFragmentable, Segment.Fragment: IntervallicFragmentable, Segment.Fragment.Fragment == Segment.Fragment
extension ContiguousSegmentCollection: Equatable where Segment: Equatable
extension ContiguousSegmentCollection: Hashable where Segment: Hashable
-
Interface for types which are measured by some
See moreMetric
type.Declaration
Swift
public protocol Measured
-
Interface for types which can be fragmented into smaller pieces.
See moreDeclaration
Swift
public protocol Fragmentable
-
Interface for fragment types which can create a fragment version of a whole instance of the type.
See moreDeclaration
Swift
public protocol Totalizable
-
Interface for types which are
See moreIntervallic
, and can be fragmented into a type which shares itsMetric
type.Declaration
Swift
public protocol IntervallicFragmentable: Intervallic, Fragmentable where Fragment: Intervallic, Fragment.Metric == Metric