//Create a class for speech synthesis package SpeechSynthesis import Timer.SimulatedTimer public class SpeechSynthesises { private int deviceNumbers private List speechSynthesises def sendEvent //For one device(We cannot have obj.id)-> We should have obj[0].id private String id = "speechSynthesisID0" private String label = "speechSynthesis0" private String displayName = "speechSynthesis0" private int level = 50 SpeechSynthesises(Closure sendEvent, int deviceNumbers) { this.sendEvent = sendEvent this.deviceNumbers = deviceNumbers this.speechSynthesises = [] speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level)) } //Methods for closures def count(Closure Input) { speechSynthesises.count(Input) } def size() { speechSynthesises.size() } def each(Closure Input) { speechSynthesises.each(Input) } def find(Closure Input) { speechSynthesises.find(Input) } def collect(Closure Input) { speechSynthesises.collect(Input) } def setLevel(int level) { speechSynthesises[0].setLevel(level) this.level = level } def speak(String message) { speechSynthesises[0].speak(message) } def getAt(int ix) { speechSynthesises[ix] } }