Skip to content

Instantly share code, notes, and snippets.

@rjdkolb
Created May 20, 2013 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjdkolb/5612663 to your computer and use it in GitHub Desktop.
Save rjdkolb/5612663 to your computer and use it in GitHub Desktop.
Rule Engine
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