An object which manages a collection of variable sized sections.

Notes

This class is an implementation detail. It is designed to manage the variable row and column sizes for a data grid. User code will not interact with this class directly.

Constructors

Properties

_count: number = 0
_defaultSize: number
_length: number = 0
_minimumSize: number
_sections: Section[] = []

Accessors

Methods

  • Clamp a size to the minimum section size

    Parameters

    • size: number

      The size to clamp.

    Returns number

    The size or the section minimum size, whichever is larger

  • Find the extent of the section at the given index.

    Parameters

    • index: number

      The index of the section of interest.

    Returns number

    The extent of the section at the given index, or -1 if the index is out of range.

    Undefined Behavior

    An index which is non-integral.

    Complexity

    Logarithmic on the number of resized sections.

  • Find the index of the section which covers the given offset.

    Parameters

    • offset: number

      The offset of the section of interest.

    Returns number

    The index of the section which covers the given offset, or -1 if the offset is out of range.

    Complexity

    Logarithmic on the number of resized sections.

  • Insert sections into the list.

    Parameters

    • index: number

      The index at which to insert the sections. This value will be clamped to the bounds of the list.

    • count: number

      The number of sections to insert. This method is a no-op if this value is <= 0.

      Undefined Behavior

      An index or count which is non-integral.

      Complexity

      Linear on the number of resized sections.

    Returns void

  • Move sections within the list.

    Parameters

    • index: number

      The index of the first section to move. This method is a no-op if this value is out of range.

    • count: number

      The number of sections to move. This method is a no-op if this value is <= 0.

    • destination: number

      The destination index for the first section. This value will be clamped to the allowable range.

      Undefined Behavior

      An index, count, or destination which is non-integral.

      Complexity

      Linear on the number of moved resized sections.

    Returns void

  • Find the offset of the section at the given index.

    Parameters

    • index: number

      The index of the section of interest.

    Returns number

    The offset of the section at the given index, or -1 if the index is out of range.

    Undefined Behavior

    An index which is non-integral.

    Complexity

    Logarithmic on the number of resized sections.

  • Remove sections from the list.

    Parameters

    • index: number

      The index of the first section to remove. This method is a no-op if this value is out of range.

    • count: number

      The number of sections to remove. This method is a no-op if this value is <= 0.

      Undefined Behavior

      An index or count which is non-integral.

      Complexity

      Linear on the number of resized sections.

    Returns void

  • Resize a section in the list.

    Parameters

    • index: number

      The index of the section to resize. This method is a no-op if this value is out of range.

    • size: number

      The new size of the section. This value will be clamped to an integer >= 0.

      Undefined Behavior

      An index which is non-integral.

      Complexity

      Linear on the number of resized sections.

    Returns void

  • Find the size of the section at the given index.

    Parameters

    • index: number

      The index of the section of interest.

    Returns number

    The size of the section at the given index, or -1 if the index is out of range.

    Undefined Behavior

    An index which is non-integral.

    Complexity

    Logarithmic on the number of resized sections.