class

Bus::Evaluation

Inherits Reference < Object

Constructors

new(message : Bus::Message, receivers, timeout : Float64 = 10.0)

Build an Evaluation object. It takes two arguments. The first is the message that requires a destination. The second is the list of pipelines connecting to the potential receivers for the message.

A lookup table is built that contains the origin string for each pipeline as the key, and the pipeline itself as the value. A second hash is built which pairs the pipelines to the Confidence objects for each receiver.

Source

Instance methods

evaluations
Source
filter_by_strategy(winners)
Source
finished?

Returns true if evaluations have been received for all of the receivers which were provided when the object was created. This also evaluates to true if the timeout period has been exceeded.

Source
message
Source
set(receiver : String, relevance : String | Int = 0, certainty : String | Int = 0, force : String = "")

Takes the origin string for a receiver, and the relevance, certainty, and force values, and sets them inside of the Evaluation object.

Source
start_time
Source
timed_out?

Determine if this evaluation has timed out. If, for some reason, one of the handlers is very slow returning their Confidence, or never returns a Confidence, the evaulation should still be evaluated using all of the entries that responded by the time that the timeout is exceeded.

Source
timeout
Source
timeout=(timeout : Float64)
Source
winners

Determine the winners of the evaluation. The algorithm is as follows:

  1. All receivers with a Confidence force value of false are automatically losers.
  2. All receivers with a Confidence force value of true are automatically winners.
  3. For all others are sorted by relevance and then by `certainty.
  4. Winners are everything with force==true plus everything with the highest relevance and certainty.
Source