//Create a class for location variable package Location class LocationVar { private int contactBookEnabled private def modes private String mode private List contacts private List phoneNumbers def sendEvent private Phrase helloHome LocationVar(Closure sendEvent) { this.modes = [[name: "home"],[name: "away"],[name: "night"]] this.mode = "home" this.helloHome = new Phrase() this.contactBookEnabled = 1 this.contacts = ['AJ'] this.phoneNumbers = [9495379373] this.sendEvent = sendEvent } //By Model Checker def setValue(LinkedHashMap eventDataMap) { def sentMode = eventDataMap['value'] println("The location is changed to $sentMode!") this.mode = sentMode sendEvent(eventDataMap) } }