projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Integrating List of constant names into the if-statement to avoid creating read/write...
[smartthings-infrastructure.git]
/
Event
/
Event.groovy
diff --git
a/Event/Event.groovy
b/Event/Event.groovy
index 15e34589786222b88aaf895c739efc8bb9572d60..d7abdf490dbb9658f191c955369e06536eecf2e1 100644
(file)
--- a/
Event/Event.groovy
+++ b/
Event/Event.groovy
@@
-16,8
+16,6
@@
public class Event {
private jsonData
private int integerValue
private double doubleValue
private jsonData
private int integerValue
private double doubleValue
- private List integerValues = ["battery", "hue", "saturation", "energy", "level", "temperature",
- "heatingSetpoint", "coolingSetpoint", "thermostatSetpoint", "illuminance"]
private boolean physical
private def date
private boolean physical
private def date
@@
-33,10
+31,10
@@
public class Event {
this.data = data
this.jsonData = new groovy.json.JsonSlurper().parseText(data)
this.displayed = displayed
this.data = data
this.jsonData = new groovy.json.JsonSlurper().parseText(data)
this.displayed = displayed
- if (
integerValues
.contains(name)) {
+ if (
["battery", "hue", "saturation", "energy", "level", "temperature", "heatingSetpoint", "coolingSetpoint", "thermostatSetpoint", "illuminance"]
.contains(name)) {
int dot = value.indexOf('.')
if (dot != -1)
int dot = value.indexOf('.')
if (dot != -1)
- value = value.substring(0, dot)
+
value = value.substring(0, dot)
this.integerValue = value.toInteger()
this.doubleValue = Double.parseDouble(value);
}
this.integerValue = value.toInteger()
this.doubleValue = Double.parseDouble(value);
}