Package io.github.brantunger.unruly.api


@NullMarked package io.github.brantunger.unruly.api
The engine's public API: build an engine, give it rules, run it against facts, and observe its runs.

Where to start:

  1. RulesEngineBuilder — choose a match policy with firstMatch, allMatches or uniqueMatch, give it an output supplier, and build() the engine.
  2. Rule — a name, a condition, an action, a priority and the language they're written in, from Rule.builder().
  3. RulesEngine.load(java.util.List) — compiles a rule list; call it again at any time to swap in new rules.
  4. RulesEngine.run(io.github.brantunger.unruly.api.FactStore) — returns the output object, or null when no rule matched; RulesEngine.runWithResult(io.github.brantunger.unruly.api.FactStore) also reports which rules fired and what each condition evaluated to.
  5. RuleListener — callbacks around every run, condition and action.

Types:

Threads: an engine is thread-safe once built: run() from any number of threads, and load() at any time. The builder and a FactMap aren't. Listeners, the output supplier and an output writer are called from every thread that runs the engine, so they must be.

Types in this package are non-null unless annotated Nullable.

See Also: