Make a change in switchLevel class to make its variable specific with variables in...
[smartthings-infrastructure.git] / Lock / Locks.groovy
index 63d93b41131aced268ce3d6e4fcb6247428d2b5d..ad297ab8ed2512c5740582a8fd28324443e5bdff 100644 (file)
@@ -2,9 +2,6 @@
 package Lock
 import Timer.SimulatedTimer
 
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
-
 public class Locks{
        int deviceNumbers       
        List locks      
@@ -19,18 +16,19 @@ public class Locks{
        private String currentLock = "locked"
        private String lockLatestValue = "locked"
 
-       Locks(Closure sendEvent, int deviceNumbers) {
+       Locks(Closure sendEvent, int deviceNumbers, boolean init) {
                this.sendEvent = sendEvent
                this.timers = new SimulatedTimer()
                this.deviceNumbers = deviceNumbers
                this.locks = []
 
-               def init = Verify.getBoolean()
                if (init) {
                        this.lockState = "locked"
+                       this.currentLock = "locked"
                        this.lockLatestValue = "locked"
                } else {
                        this.lockState = "unlocked"
+                       this.currentLock = "unlocked"
                        this.lockLatestValue = "unlocked"
                }
                locks.add(new Lock(sendEvent,id, label, displayName, this.lockState, this.lockLatestValue))
@@ -95,6 +93,9 @@ public class Locks{
        def find(Closure Input) {
                locks.find(Input)
        }
+       def sort(Closure Input) {
+               locks.sort(Input)
+       }
        def collect(Closure Input) {
                locks.collect(Input)
        }