X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=SpeechSynthesis%2FSpeechSynthesis.groovy;h=1f25d79b5c873edf53c060076b4281ea383c8c5c;hb=6cf2e56e176c75f6e11cc8911420b2c86780dc0a;hp=a13e7f7a0ee5ab5378637350cb92a19b925829db;hpb=b8c0c6eb635704be056e1e4f373620e2bb05b775;p=smartthings-infrastructure.git diff --git a/SpeechSynthesis/SpeechSynthesis.groovy b/SpeechSynthesis/SpeechSynthesis.groovy index a13e7f7..1f25d79 100644 --- a/SpeechSynthesis/SpeechSynthesis.groovy +++ b/SpeechSynthesis/SpeechSynthesis.groovy @@ -7,21 +7,31 @@ public class SpeechSynthesis { private String label private String displayName private int level + private boolean oneUser - SpeechSynthesis(String id, String label, String displayName, int level) { + SpeechSynthesis(String id, String label, String displayName, int level, boolean oneUser) { this.id = id this.label = label this.displayName = displayName this.level = level + this.oneUser = oneUser } def setLevel(int level) { - println("The level of speech synthesis with id:$id is changed to $level") - this.level = level + if (level != this.level) { + println("The level of speech synthesis with id:$id is changed to $level") + this.level = level + } } def speak(String message) { println("Speech synthesis with id:$id, SPEAKING:\"$message\"!") + // As a conflict variable + if (oneUser) { + this.oneUser = false + } else { + this.oneUser = true + } } }