This is a implementation of the EvaluationFunction

Challenge :

The situation where an implementation of the EvlauationFunction is done only to watch out for changes on a specific channel value is a common one. This leads to the requirement for a default structure that already has the logic needed to recognize changes on channel values of interest.

Soulution :

The TriggeredEvaluationFunction. It can watch the values on channels and trigger a result extraction, when the set condition is met. There for that implementation has the following members as a tool set:

Code Example :

Instantiation:

TriggerEvaluationFunction function = new TriggerEvaluationFunction.Builder()
            // set the trigger strategy
            .withTriggerStrategy(TriggerStrategies.onBecomeTrue())
            // set the event extractor
            .withEventExtractor(Extractors.valuesExtractor("U", "I", "T"))
            // set the filter (optional)
            .withFilter(EventFilters.onValueChanged(Suppliers.doubleChannel("T")))
            .build();
            

In this case the TriggerStrategy "onBecomeTrue" is used. This strategy triggers when a value that was false in the last message is now true.

As EventExtractor "valuesExtractor(String... channelName)" is used. This extracts the given channels by their name and puts the results into a new Event object, which is returned after.

As EventFilter "onValueChanged" is used. This Filter memorizes the value from the last call and passes Events only further, if the value has changed since last call.

As Supplier for the EventFilter the "doubleChannel(String channelName)" is used. This Supplier extracts a channel value, defined by the name parameter.

Execution :

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

Back to top

Reflow Maven skin by Andrius Velykis.