Rete.Activation (Rete v0.2.0)

Copy Markdown View Source

A rule whose left hand side is satisfied, waiting to fire.

Internal, but Rete.Session.pending/1 returns these. Read their fields freely. Do not depend on their functions.

Ordered by :salience descending, then :internal_salience descending, then :order ascending. :order is compile order, so two rules of equal salience fire in the order they were written. :internal_salience makes an extracted negation helper run before the rule that negates its marker. See Rete.Compiler.Negation.

Summary

Functions

The sort key of an activation: most salient first, then compile order.

Types

t()

@type t() :: %Rete.Activation{
  internal_salience: integer(),
  node_id: term(),
  order: non_neg_integer(),
  salience: integer(),
  token: Rete.Token.t()
}

Functions

key(activation)

@spec key(t()) :: {integer(), integer(), non_neg_integer()}

The sort key of an activation: most salient first, then compile order.

iex> Rete.Activation.key(%Rete.Activation{salience: 10, order: 3})
{-10, 0, 3}