Adding path explorations for initializations.
[smartthings-infrastructure.git] / SpeechSynthesis / SpeechSynthesises.groovy
1 //Create a class for speech synthesis
2 package SpeechSynthesis
3 import Timer.SimulatedTimer
4
5 //JPF's Verify API
6 import gov.nasa.jpf.vm.Verify
7
8 public class SpeechSynthesises {
9         private int deviceNumbers
10         private List speechSynthesises
11         def sendEvent
12
13         //For one device(We cannot have obj.id)-> We should have obj[0].id
14         private String id = "speechSynthesisID0"
15         private String label = "speechSynthesis0"
16         private String displayName = "speechSynthesis0"
17         private int level = 50
18
19                 
20         SpeechSynthesises(Closure sendEvent, int deviceNumbers) {
21                 this.sendEvent = sendEvent              
22                 this.deviceNumbers = deviceNumbers
23                 this.speechSynthesises = []
24
25                 def init = Verify.getIntFromList(30, 50, 70)
26                 this.level = init
27
28                 speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
29         }
30
31         //Methods for closures
32         def count(Closure Input) {
33                 speechSynthesises.count(Input)
34         }
35         def size() {
36                 speechSynthesises.size()
37         }
38         def each(Closure Input) {
39                 speechSynthesises.each(Input)
40         }
41         def find(Closure Input) {
42                 speechSynthesises.find(Input)
43         }
44         def collect(Closure Input) {
45                 speechSynthesises.collect(Input)
46         }
47
48         def setLevel(int level) {
49                 speechSynthesises[0].setLevel(level)
50                 this.level = level
51         }
52
53         def speak(String message) {
54                 speechSynthesises[0].speak(message)
55         }
56
57         def getAt(int ix) {
58                 speechSynthesises[ix]
59         }
60 }