ObservableGate

class ObservableGate(delegate: ExtractionGate, listener: DiceEventListener = DiceEventListener.DEV_NULL) : ExtractionGate

Decorator that adds event emission to any ExtractionGate.

Delegates the evaluation to the wrapped gate and then, depending on the GateDecision, emits the matching routing event through the supplied DiceEventListener. The delegate's GateEvaluation is always returned unchanged — the decorator fires events, it never alters the decision.

Event mapping:

Each emitted event carries the full Proposition. Wrap the listener in SafeDiceEventListener so a throwing listener cannot abort the gate run; this decorator does not handle exceptions itself.

Example usage:

val gate = ObservableGate(confidenceGate, SafeDiceEventListener(myListener))
val evaluation = gate.evaluate(proposition, gateContext)

Constructors

Link copied to clipboard
constructor(delegate: ExtractionGate, listener: DiceEventListener = DiceEventListener.DEV_NULL)

Functions

Link copied to clipboard
open override fun evaluate(proposition: Proposition, context: GateContext): GateEvaluation

Evaluate a single proposition against this gate's policy.