X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=blobdiff_plain;f=SpeechSynthesis%2FSpeechSynthesises.groovy;h=50417cc8615a278a5bb8fce4f87ce69122c29b9b;hp=bcdbbd7a835d9a4bb76f7f314944cb9fa2164da9;hb=ef89c03ba3f5c7b61f30c8948a9170c36c91647f;hpb=9b8d2370b896feb3d8bae8f1aed9c15ea85da222 diff --git a/SpeechSynthesis/SpeechSynthesises.groovy b/SpeechSynthesis/SpeechSynthesises.groovy index bcdbbd7..50417cc 100644 --- a/SpeechSynthesis/SpeechSynthesises.groovy +++ b/SpeechSynthesis/SpeechSynthesises.groovy @@ -2,9 +2,6 @@ package SpeechSynthesis import Timer.SimulatedTimer -//JPF's Verify API -import gov.nasa.jpf.vm.Verify - public class SpeechSynthesises { private int deviceNumbers private List speechSynthesises @@ -17,14 +14,16 @@ public class SpeechSynthesises { private int level = 50 - SpeechSynthesises(Closure sendEvent, int deviceNumbers) { + SpeechSynthesises(Closure sendEvent, int deviceNumbers, boolean init) { this.sendEvent = sendEvent this.deviceNumbers = deviceNumbers this.speechSynthesises = [] - def init = Verify.getIntFromList(30, 50, 70) - this.level = init - + if (init) { + this.level = 50 + } else { + this.level = 60 + } speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level)) } @@ -41,13 +40,18 @@ public class SpeechSynthesises { def find(Closure Input) { speechSynthesises.find(Input) } + def sort(Closure Input) { + speechSynthesises.sort(Input) + } def collect(Closure Input) { speechSynthesises.collect(Input) } def setLevel(int level) { - speechSynthesises[0].setLevel(level) - this.level = level + if (level != this.level) { + this.level = level + speechSynthesises[0].setLevel(level) + } } def speak(String message) {