GGD/target/classes/rules/greenhouse_critical.drl

26 lines
743 B
Plaintext
Raw Normal View History

import eu.hsrw.ias.ggd.Greenhouse;
import eu.hsrw.ias.ggd.Device;
import eu.hsrw.ias.ggd.Severity;
rule "Device of greenhouse gone critical"
when
device: Device(state == Severity.Critical)
greenhouse: Greenhouse(devices contains(device))
//greenhouse: Greenhouse(devices contains(Device(state == Severity.Critical)))
then
modify(greenhouse){
setState(Severity.Critical)
}
System.out.println("Greenhouse: '" + greenhouse.getId() + "' is '" + greenhouse.getState().toString() + "'");
end
rule "Device of greenhouse has gone optimal"
when
device: Device(state == Severity.Optimal)
greenhouse: Greenhouse(devices contains(device))
then
modify(greenhouse){
setState(Severity.Optimal)
}
end