HeaRTDroid is a rule-based inference engine both for Android mobile devices, and desktop solutions
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
pub:software:heartdroid:tutorials:callbacks [2016/12/28 13:31] admin [Actions] |
pub:software:heartdroid:tutorials:callbacks [2016/12/29 06:42] admin [Actions] |
||
---|---|---|---|
Line 97: | Line 97: | ||
There are several differences though: | There are several differences though: | ||
* Actions are associated with rules and are fired when the rule fires | * Actions are associated with rules and are fired when the rule fires | ||
+ | * Each rule may have severl actions assigned | ||
* Actions should implement Action interface, instead of Callback interface | * Actions should implement Action interface, instead of Callback interface | ||
* Action cannot modify the state of attributes, although have insight into the current state of the system (current values of all the attributes from the model) | * Action cannot modify the state of attributes, although have insight into the current state of the system (current values of all the attributes from the model) | ||
+ | |||
+ | To add an action to your rule, use the ''<nowiki>**></nowiki>'' operator, like in the listing below: | ||
+ | <code> | ||
+ | xrule parkingReminder/1: | ||
+ | [ | ||
+ | location eq pay_zone, | ||
+ | tariff eq pay | ||
+ | ] | ||
+ | ==> | ||
+ | [ | ||
+ | notification set start_parking_fee | ||
+ | ] | ||
+ | **> | ||
+ | [ | ||
+ | 'ShowNotification', | ||
+ | 'StartPayment' | ||
+ | ].#1 | ||
+ | </code> | ||
+ | |||