projects
/
smartthings-infrastructure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c02e3b5
)
Integrating List of constant names into the if-statement to avoid creating read/write...
author
rtrimana
<rtrimana@uci.edu>
Tue, 22 Oct 2019 18:10:26 +0000
(11:10 -0700)
committer
rtrimana
<rtrimana@uci.edu>
Tue, 22 Oct 2019 18:10:26 +0000
(11:10 -0700)
Event/Event.groovy
patch
|
blob
|
history
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);
}