Class StrNode<T>

Represents the str type in JSON CRDT. The str type is a RGA (Replicated Growable Array) of UTF-16 code units.

Type Parameters

  • T extends string = string

Hierarchy

  • AbstractRga<string>
    • StrNode

Implements

Constructors

Properties

count: number = 0

Unique ID within a document.

ids: undefined | Chunk<string> = undefined
root: undefined | Chunk<string> = undefined

Methods

  • Parameters

    • position: number

    Returns undefined | [chunk: Chunk<string>, offset: number]

  • Returns (() => undefined | Chunk<string>)

      • (): undefined | Chunk<string>
      • Returns undefined | Chunk<string>

  • Parameters

    • curr: Chunk<string>

    Returns undefined | Chunk<string>

    Todo

    Or better remove this method completely, as it does not require "this".

  • Parameters

    • curr: Chunk<string>

    Returns undefined | Chunk<string>

    Todo

    Or better remove this method completely, as it does not require "this".

  • Parameters

    • startChunk: undefined | Chunk<string>

      Chunk from which to start the range. If undefined, the chunk containing from will be used. This is an optimization to avoid a lookup.

    • from: ITimestampStruct

      ID of the first element in the range.

    • to: ITimestampStruct

      ID of the last element in the range.

    • callback: ((chunk, off, len) => void)

      Function to call for each chunk slice in the range.

        • (chunk, off, len): void
        • Parameters

          • chunk: Chunk<string>
          • off: number
          • len: number

          Returns void

    Returns undefined | Chunk<string>

    Reference to the last chunk in the range.

    Note

    All ".rangeX()" method are not performance optimized. For hot paths it is better to hand craft the loop.