This is a implementation of the EvaluationFunction.

Challange :

The situation where an implementation of the EvaluationFunction is done only to aggregate some typical values is a common one. This leads to the requirement for a default structure that already has the logic needed to aggregate channel values of interest on MRecords.

Soulution :

The WindowedEvaluationFunction. It can aggregate values from channels in a window defined by the RecordWindow. This class has three constructs to support its functionality:

  • RecordWindow : determines when a aggregation phase starts and ends.

  • WindowExtractor : extracts the values of interest in resulting Events.

  • EventFilter : (optional) filters the resulting events, so that only relevant Events are processed further.

Code Example :

Instantiation: WindowedEvaluationFunction function = WindowedEvaluationFunction.builder() .recordWindow(Windows.bitActive(booleanChannel("flag")) .extractor(new MaxWindowExtractor()) .filter((event, record) -> event.getParameter("name").asString().equals("Mixer17")) .build();

In this case the RecordWindow is watching on the Boolean “flag” channel on the records. As long this value is “true”, the window is open. As soon as the window closes, the WindowExtractor kicks in. Here the MaxWindowExtractor implementation in use. It aggregates the maximal value on a channel internally defined in the class. It creates than an Event which holds the max value as a parameter. Than the EventFilter is activated, which looks out for the parameter “name” and compares it with the String “Mixer17”.

Execution :

Since the WindowedEvaluationFunction is a implementation of the EvaluationFunction, it can be executed as such. (see EvaluationFunction)

Back to top

Reflow Maven skin by Andrius Velykis.