Updating scripts.
[smartthings-infrastructure.git] / AeonKeyFob / AeonKeyFobs.groovy
1 //Create a class for aeon key fob
2 package AeonKeyFob
3 import Timer.SimulatedTimer
4
5 //JPF's Verify API
6 import gov.nasa.jpf.vm.Verify
7
8 public class AeonKeyFobs {
9         private int deviceNumbers
10         private List aeonKeyFobs
11         def sendEvent
12
13         //For one device(We cannot have obj.id)-> We should have obj[0].id
14         private String id = "aeonKeyFobID0"
15         private String label = "aeonKeyFob0"
16         private String displayName = "aeonKeyFob0"
17         
18                 
19         AeonKeyFobs(Closure sendEvent, int deviceNumbers) {
20                 this.sendEvent = sendEvent              
21                 this.deviceNumbers = deviceNumbers
22                 this.aeonKeyFobs = []
23
24                 aeonKeyFobs.add(new AeonKeyFob(id, label, displayName))
25         }
26
27         //By Model Checker
28         def setValue(LinkedHashMap eventDataMap) {
29                 aeonKeyFobs[0].setValue(eventDataMap)
30                 sendEvent(eventDataMap)
31         }
32
33         //Methods for closures
34         def count(Closure Input) {
35                 aeonKeyFobs.count(Input)
36         }
37         def size() {
38                 aeonKeyFobs.size()
39         }
40         def each(Closure Input) {
41                 aeonKeyFobs.each(Input)
42         }
43         def sort(Closure Input) {
44                 aeonKeyFobs.sort(Input)
45         }
46         def find(Closure Input) {
47                 aeonKeyFobs.find(Input)
48         }
49         def collect(Closure Input) {
50                 aeonKeyFobs.collect(Input)
51         }
52
53
54         //methods
55         def eventsSince(Date dateObj) {
56                 return aeonKeyFobs[0].eventsSince()
57         }
58
59
60         def getAt(int ix) {
61                 aeonKeyFobs[ix]
62         }
63 }