MAIDR Documentation - v3.39.0
    Preparing search index...

    Interface Trace

    Interface representing a trace with navigation and observation capabilities

    interface Trace {
        getId: () => string;
        getCurrentXValue: () => any;
        moveToXValue: (xValue: any) => boolean;
        getCurrentYValue?: () => number | null;
        moveToXAndYValue?: (xValue: any, yValue: number) => boolean;
        notifyOutOfBounds: () => void;
        resetToInitialEntry: () => void;
        notifyObserversWithState: (state: TraceState) => void;
        onSwitchFrom?: (previousTrace: Trace) => boolean;
        moveToPoint: (x: number, y: number) => void;
        getExtremaTargets?: () => ExtremaTarget[];
        navigateToExtrema?: (target: ExtremaTarget) => void;
        dispose: () => void;
        moveOnce: (direction: MovableDirection) => boolean;
        moveToExtreme: (direction: MovableDirection) => boolean;
        moveToIndex: (row: number, col: number) => boolean;
        isMovable: (target: MovableDirection | [number, number]) => boolean;
        get isInitialEntry(): boolean;
        set isInitialEntry(value: boolean): void;
        get isOutOfBounds(): boolean;
        set isOutOfBounds(value: boolean): void;
        get row(): number;
        set row(value: number): void;
        get col(): number;
        set col(value: number): void;
        addObserver: (observer: Observer<TraceState>) => void;
        removeObserver: (observer: Observer<TraceState>) => void;
        notifyStateUpdate: () => void;
        get state(): T;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    getId: () => string

    Gets the unique identifier for the trace

    Type Declaration

      • (): string
      • Returns string

        The trace ID

    getCurrentXValue: () => any

    Gets the current X value from the trace

    Type Declaration

      • (): any
      • Returns any

        The current X value or null if not available

    moveToXValue: (xValue: any) => boolean

    Moves the trace to the position that matches the given X value

    Type Declaration

      • (xValue: any): boolean
      • Parameters

        • xValue: any

          The X value to move to

        Returns boolean

        True if the position was found and set, false otherwise

    getCurrentYValue?: () => number | null

    Get the current Y value from the trace. Optional method implemented by traces that support Y value preservation during layer switching.

    Type Declaration

      • (): number | null
      • Returns number | null

        The current Y value or null if not available

    moveToXAndYValue?: (xValue: any, yValue: number) => boolean

    Move to a specific X value and find the closest position with the given Y value. Optional method implemented by traces that support preserving both X and Y values during layer switching.

    Type Declaration

      • (xValue: any, yValue: number): boolean
      • Parameters

        • xValue: any

          The X value to move to

        • yValue: number

          The Y value to find the closest matching position for

        Returns boolean

        true if the move was successful, false otherwise

    notifyOutOfBounds: () => void

    Notify observers that the trace is out of bounds

    resetToInitialEntry: () => void

    Resets the trace to initial entry state

    notifyObserversWithState: (state: TraceState) => void

    Notifies all observers with a specific state

    Type Declaration

      • (state: TraceState): void
      • Parameters

        • state: TraceState

          The trace state to send to observers

        Returns void

    onSwitchFrom?: (previousTrace: Trace) => boolean

    Handle switching from another trace. Called by Context when switching layers. Traces can implement this to handle special layer switching behavior (e.g., preserving Y values).

    IMPORTANT CONTRACT:

    • If this method returns true, it MUST have modified the trace position appropriately.
    • If this method returns false, it MUST NOT modify the trace position at all. The Context will then apply default behavior (moveToXValue) after this returns.

    Type Declaration

      • (previousTrace: Trace): boolean
      • Parameters

        • previousTrace: Trace

          The trace we're switching from

        Returns boolean

        true if this trace handled the switch (and modified position), false to use default behavior (position must remain unchanged)

    moveToPoint: (x: number, y: number) => void

    Moves the trace to a specific point based on x and y coordinates.

    Type Declaration

      • (x: number, y: number): void
      • Parameters

        • x: number

          The x coordinate

        • y: number

          The y coordinate

        Returns void

    getExtremaTargets?: () => ExtremaTarget[]

    Gets extrema targets for navigation. Optional method implemented by traces that support extrema navigation.

    Type Declaration

    navigateToExtrema?: (target: ExtremaTarget) => void

    Navigate to a specific extrema target. Optional method implemented by traces that support extrema navigation.

    Type Declaration

    dispose: () => void
    moveOnce: (direction: MovableDirection) => boolean
    moveToExtreme: (direction: MovableDirection) => boolean
    moveToIndex: (row: number, col: number) => boolean
    isMovable: (target: MovableDirection | [number, number]) => boolean
    addObserver: (observer: Observer<TraceState>) => void
    removeObserver: (observer: Observer<TraceState>) => void
    notifyStateUpdate: () => void

    Accessors

    • get isInitialEntry(): boolean

      Returns boolean

    • set isInitialEntry(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isOutOfBounds(): boolean

      Returns boolean

    • set isOutOfBounds(value: boolean): void

      Parameters

      • value: boolean

      Returns void