Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Decorator<S, E>

Base Class for all Decorator Nodes. Can only have one child. Decorators intercept and can modify the event sent to or the result from the child. They should do this by overriding one or more of the methods decorateEvent, decorateCall, or decorateResult.

author

Joshua Chaitin-Pollak

Type Parameters

Hierarchy

Index

Constructors

  • new Decorator<S, E>(name: string, child: BaseNode<S, E>, latched?: boolean): Decorator<S, E>

Properties

name: string = ''
treePublisher: TreePublisher<any, any> = ...

Accessors

  • get id(): string
  • get latched(): boolean
  • get parent(): string
  • set parent(parent: string): void
  • Sets the parent of this Node, and all children Nodes.

    override

    Returns string

  • Sets the parent of this Node, and all children Nodes.

    override

    Parameters

    • parent: string

    Returns void

  • get path(): string
  • get symbol(): string

Methods

  • decorateEvent(event: E): E
  • getDebug(state: S): any
  • getLastEventSeen(state: S): undefined | number
  • getLastResult(state: S): undefined | string
  • getTreeEventCounter(state: S): any
  • initChildren(children: BaseNode<S, E>[]): void
  • Initializes the parent of our list of children. Only required to be called if you know your children at construction time. If your children are dynamic, then you are responsible for setting their parent properly when they are created. Note: this repeats code from set parent() because at construction time, this.children will not return anything (this isn't this yet), which is why we have to pass children in as a parameter

    Parameters

    • children: BaseNode<S, E>[]

      list of children to init (can't call getChildren() yet because this is called from the constructor)

    Returns void

  • precondition(state: S, event: E): boolean
  • resetNodeStorage(state: S): any
  • registerNodeForDebug<S, E>(node: BaseNode<S, E>): void
  • registerTreePublisher<S, E>(publisher: TreePublisher<S, E>): void
  • unregisterNodeForDebug<S, E>(node: BaseNode<S, E>): void