forked from kevin.shehu/GGD
32 lines
779 B
Plaintext
32 lines
779 B
Plaintext
import eu.hsrw.ias.ggd.Device;
|
|
import eu.hsrw.ias.ggd.Severity;
|
|
import eu.hsrw.ias.ggd.SensorData;
|
|
|
|
rule "Sensor of device gone critical"
|
|
when
|
|
sensorData: SensorData(state == Severity.Critical)
|
|
device: Device(sensorData contains(sensorData))
|
|
then
|
|
modify(device){
|
|
setState(Severity.Critical)
|
|
}
|
|
System.out.println("Device: \n" +
|
|
"\tID: '" + device.getId() + "'" +
|
|
"\tState: '" + device.getState().toString() + "'"
|
|
);
|
|
// Do something the info that a device is gone critical
|
|
end
|
|
|
|
rule "Sensor of device gone optimal"
|
|
when
|
|
sensorData: SensorData(state == Severity.Optimal)
|
|
device: Device(sensorData contains(sensorData))
|
|
then
|
|
modify(device){
|
|
setState(Severity.Optimal)
|
|
}
|
|
|
|
// Device is gone optimal
|
|
end
|
|
|