GGD/src/main/resources/rules/SoilMoisture.drl

30 lines
923 B
Plaintext

import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import eu.hsrw.ias.ggd.ScheduledTask;
import javax.swing.JOptionPane;
rule "Dry Soil Moisture"
when
$map : Map (this["soilMoisture"]<40)
then
System.out.println("It is recommended to have a Soil Moisture higher than : "+$map.get("soilMoisture"));
JOptionPane.showMessageDialog(null,"It is recommended to have a Soil Moisture higher than : "+$map.get("soilMoisture"),"Dry Soil Moisture",JOptionPane.INFORMATION_MESSAGE);
end
rule "Wet Soil Mositure"
when
$map : Map (this["soilMoisture"]>70)
then
System.out.println("Be careful the soil is extremly wet :"+$map.get("soilMoisture")+ "please dont apply water");
JOptionPane.showMessageDialog(null,"Be careful the soil is extremly wet :"+$map.get("soilMoisture")+ "please dont apply water","Wet Soil Moisture",JOptionPane.INFORMATION_MESSAGE);
end