@samatawy/rules
    Preparing search index...

    Class BooleanExpressionAbstract

    Represents an expression that can be evaluated in a given context to produce a value. Expressions can be used in conditions, assignments, and other parts of the rule syntax to compute values based on the current state of the working context. Each expression must implement the required() method to specify which data keys it depends on, and the evaluate() method to compute its value based on the context.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    syntax: string

    Methods

    • Get the original syntax string that was used to create this expression. This can be useful for debugging, logging, or error messages to provide context about where the expression came from.

      Returns string

      the original syntax string of the expression.

    • What data keys are required for this expression to be evaluated? This information is used by the rule engine to determine the dependencies between expressions and rules, and to ensure that all necessary data is available before evaluating the expression.

      Returns Set<string>

      a set of data keys required for this expression to be evaluated.

    • What functions are invoked by this expression? This information can be used for optimization, caching, or to determine which function nodes in the graph are relevant for this expression.

      Returns Set<string>

      a set of function names invoked by this expression.

    • Get a string representation of the expression, which can be used for debugging, logging, or error messages.

      Returns string

      a string representation of the expression.

    • Evaluate the expression in the given context to compute its value. The implementation of this method will depend on the specific type of expression and how it computes its value based on the data in the context.

      Parameters

      • context: WorkingContext

        the current working context containing data and constants.

      Returns boolean

      the computed value of the expression.