package BeaconSensor
import Timer.SimulatedTimer
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
-
public class BeaconSensors {
private int deviceNumbers
private List beaconSensors
private String presenceLatestValue = "not present"
- BeaconSensors(Closure sendEvent, int deviceNumbers) {
+ BeaconSensors(Closure sendEvent, int deviceNumbers, boolean init) {
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.beaconSensors = []
- def init = Verify.getBoolean()
if (init) {
this.presence = "not present"
+ this.currentPresence = "not present"
this.presenceLatestValue = "not present"
} else {
this.presence = "present"
+ this.currentPresence = "present"
this.presenceLatestValue = "present"
}
beaconSensors.add(new BeaconSensor(id, label, displayName, this.presence, this.presenceLatestValue))
//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
if (eventDataMap["value"] != beaconSensors[0].presence) {
+ this.presenceLatestValue = eventDataMap["value"]
+ this.presence = eventDataMap["value"]
+ this.currentPresence = eventDataMap["value"]
beaconSensors[0].setValue(eventDataMap["value"])
- this.presenceLatestValue = beaconSensors[0].presenceLatestValue
- this.presence = beaconSensors[0].presence
- this.currentPresence = beaconSensors[0].presence
sendEvent(eventDataMap)
}
}
def each(Closure Input) {
beaconSensors.each(Input)
}
+ def sort(Closure Input) {
+ beaconSensors.sort(Input)
+ }
def find(Closure Input) {
beaconSensors.find(Input)
}