PrevTopNext

Element Command Processing (2)

Knack #9: Distinguish preconditions and rules - two priority levels.
Knack #10: Use instanceof with interface name to determine applicability.
Knack #11: Match interfaces to reduce the number of rules.

Rules in DSLR:
# rule / salience 100
precondition "commmand: lock/unlock for switch, signal, goal"
when
    there is an element command
    - with the code LOCK or the code UNLOCK
    and the commanded element
    - is not a lock element
then
    send failed command message "cannot lock/unlock element"
end

rule "execute element command"
when
    there is an element command
then
    execute command
end

PrevTopNext