Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AlphabeticLabelManager

A label manager that associates alphabetical labels to each id given to it. It will associate labels "a", "b", "c", ... up to "z" and then will associate "aa", "bb", "cc", ... up to "zz", and continues repeating characters each time it cycles over the alphabet.

param

The name of this label manager.

Hierarchy

Index

Constructors

constructor

Properties

Protected _idToLabel

_idToLabel: Record<string, string> = Object.create(null)

A mapping of element id to allocated label.

Protected labelIndex

labelIndex: number = 0

A counter that must be incremented with each new label allocation. This allows the allocation algorithm to know what the next label should be.

name

name: string

The name of this label manager. This is a convenience that can be used to produce distinctive error messages, for instance.

Methods

_deallocateAllLabels

  • _deallocateAllLabels(): void

allocateLabel

  • allocateLabel(id: string): string

deallocateAll

  • deallocateAll(): void

idToLabel

  • idToLabel(id: string): string | undefined
  • Gets the label associated with an id.

    Parameters

    • id: string

      The id.

    Returns string | undefined

    The label. The value returned by this method obeys the same rules as that of allocateLabel with the exception that if a call returned undefined it may return another value on a subsequent call. (That is, an id that did not have a label allocated to it may acquire such label.)

nextNumber

  • nextNumber(): number

Generated using TypeDoc