Created
May 20, 2013 14:43
-
-
Save rjdkolb/5612663 to your computer and use it in GitHub Desktop.
Rule Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isUsed(usersHouse.cookingElectricStovePlates) && (isUsed(usersHouse.cookingLPGstovePlates))){//yes the user uses an electric plates and LPG plates | |
addSuggestion("I see you are using LPG gas in combination with an electric stove") | |
} | |
else if (isUsed(usersHouse.cookingElectricStovePlates))//yes the user uses an electric plates but not LPG gas | |
def percent = percent(usersHouse.cookingElectricStovePlates , perfectHouse.cookingLPGstovePlates) | |
if (percent > 150){ | |
addSuggestion("I see you are not using LPG gas, perhaps you should switch and you are using more than 150 % of the IES house") | |
} | |
else if (percent > 110){ | |
addSuggestion("I see you are not using LPG gas, perhaps you should switch") | |
} | |
else if (isUsed(usersHouse.cookingLPGstovePlates)){//yes the user uses a LPG plates | |
def lpgPercent = percent(usersHouse.cookingElectricStovePlates , perfectHouse.cookingLPGstovePlates) | |
if (lpgPercent > 150){ | |
addSuggestion("I see you are using LPG gas, but the usage is above 150 % of the IES house") | |
} | |
else if (lpgPercent > 110){ | |
addSuggestion("I see you are using LPG gas, but the usage is abnormally high") | |
} | |
} | |
else {//hmmm.... no stove usage | |
addSuggestion("It seems you don't use a electric or LPG stove top") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment