Documentation - v1.5.3
    Preparing search index...

    Class representing a block of tokens in the TokenManager.

    This class implements the TMTokens interface and represents a block of tokens with its start, end, label class, current state, and history.

    Implements

    Index

    Constructors

    • Constructor for TMTokenBlock.

      Parameters

      • start: number

        The start index of the token block.

      • end: number

        The end index of the token block.

      • tokens: TMToken[]

        An array of TMToken objects representing the tokens in the block.

      • labelClass: Label

        The label class associated with the token block.

      • currentState: string

        The current state of the token block.

      • reviewed: boolean = false

        Indicates if the token block has been reviewed, default is false.

      • history: History[] = []

        An array of history entries for the token block, default is an empty array.

      Returns TMTokenBlock

      The constructor initializes the token block with the provided parameters and sets the original state to the current state.

    Properties

    currentState: string

    The current state of the token block.

    end: number

    The end index of the token block.

    history: History[]

    An array of history entries for the token block.

    labelClass: Label

    The label class associated with the token block.

    originalState: TMTokenBlock

    The original state of the token block, used for restoring the block's state.

    reviewed: boolean

    Indicates if the token block has been reviewed.

    start: number

    The start index of the token block.

    tokens: TMToken[]

    An array of TMToken objects representing the tokens in the block.

    type: string = 'token-block'

    The type of the token block, default is 'token-block'.

    Methods

    • Restore the original state of the token block.

      Returns void

      This method restores the token block to its original state, including its start, end, tokens, history, label class, current state, and reviewed status.