Flag to diversify modes; better combinations of step and goal values.
authorrtrimana <rtrimana@uci.edu>
Fri, 9 Aug 2019 00:43:33 +0000 (17:43 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 9 Aug 2019 00:43:33 +0000 (17:43 -0700)
Extractor/Extractor.groovy
eventSimulator/stepGoalHighEvent.groovy
eventSimulator/stepGoalLowEvent.groovy
eventSimulator/stepStepsHighEvent.groovy
eventSimulator/stepStepsLowEvent.groovy

index b5f3194..5872125 100644 (file)
@@ -101,17 +101,21 @@ import Timer.SimulatedTimer
 @Field File extractedObjectsConstructorApp1 = new File("Extractor/App1/extractedObjectsConstructorApp1.groovy")
 @Field File extractedObjectsConstructorApp2 = new File("Extractor/App2/extractedObjectsConstructorApp2.groovy")
 
+//Set this to true for global-state variable conflict
+@Field assignDifferentModes = false
 @Field chooseMode = 0
 //Empty the files
 if (App == "App1") {
        globalObjects.write("")
        extractedObjectsApp1.write("")
        extractedObjectsConstructorApp1.write("")
-       chooseMode = 0
+       if (assignDifferentModes)
+               chooseMode = 0
 } else if (App == "App2") {
        extractedObjectsApp2.write("")
        extractedObjectsConstructorApp2.write("")
-       chooseMode = 1
+       if (assignDifferentModes)
+               chooseMode = 1
 }
 
 
@@ -1642,12 +1646,16 @@ def input(LinkedHashMap metaData) {
                        //def randomVariable = Math.abs(new Random().nextInt() % 3)
                        def modes = ["away", "home", "night"]
                        // Always assign a different mode to each app
-                       //def userInput = modes[1]
-                       def userInput = modes[chooseMode]
-                       if (chooseMode < 3)
-                               chooseMode++;
-                       else
-                               chooseMode = chooseMode%3
+                       def userInput
+                       if (assignDifferentModes) {                     
+                               userInput = modes[chooseMode]
+                               if (chooseMode < 3)
+                                       chooseMode++;
+                               else
+                                       chooseMode = chooseMode%3
+                       } else {
+                               userInput = modes[1]
+                       }
 
                        if (modeVariables == 0) {
                                mode0 = metaData['name']
index de1ee84..190b5d5 100644 (file)
@@ -1,2 +1,2 @@
-                       stepSensorObject.setValue([name: "goal", value: "100"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                       stepSensorObject.setValue([name: "goal", value: "70"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 6443e66..cbec67f 100644 (file)
@@ -1,2 +1,2 @@
-                       stepSensorObject.setValue([name: "goal", value: "20"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                       stepSensorObject.setValue([name: "goal", value: "40"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 4113fe4..151b5c0 100644 (file)
@@ -1,2 +1,2 @@
-                       stepSensorObject.setValue([name: "steps", value: "70"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                       stepSensorObject.setValue([name: "steps", value: "100"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 3dc916f..60da0e0 100644 (file)
@@ -1,2 +1,2 @@
-                       stepSensorObject.setValue([name: "steps", value: "30"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                       stepSensorObject.setValue([name: "steps", value: "50"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])