1 //Create a class for momentory switch device
3 import Timer.SimulatedTimer
6 import gov.nasa.jpf.vm.Verify
8 public class Momentaries {
13 //If we have only one device
14 private String id = "momentaryID0"
15 private String label = "momentary0"
16 private String displayName = "momentary0"
18 Momentaries(Closure sendEvent, int deviceNumbers) {
19 this.sendEvent = sendEvent
20 this.deviceNumbers = deviceNumbers
23 /*def init = Verify.getBoolean()
25 this.doorState = "closed"
26 this.doorLatestValue = "closed"
28 this.doorState = "open"
29 this.doorLatestValue = "open"
31 momentaries.add(new Momentary(sendEvent, id, label, displayName))
34 //Methods for closures
35 def count(Closure Input) {
36 momentaries.count(Input)
41 def each(Closure Input) {
42 momentaries.each(Input)
44 def find(Closure Input) {
45 momentaries.find(Input)
47 def sort(Closure Input) {
48 momentaries.sort(Input)
50 def collect(Closure Input) {
51 momentaries.collect(Input)
60 def setValue(LinkedHashMap eventDataMap) {
61 momentaries[0].setValue(eventDataMap["value"])
62 sendEvent(eventDataMap)