Skip to content
Snippets Groups Projects
Commit 846e5a2e authored by Jesper's avatar Jesper
Browse files

Make TrackElement.monitoringSensors() a collection attribute

Includes latest JastAdd2 version which has improved collection
attribute dependency handling.
parent ff631d60
No related branches found
No related tags found
No related merge requests found
No preview for this file type
import java.util.HashSet;
aspect TreeNavigation { aspect TreeNavigation {
// collections of things // collections of things
...@@ -214,29 +216,25 @@ aspect TreeNavigation { ...@@ -214,29 +216,25 @@ aspect TreeNavigation {
return getTarget().asSwitch(); return getTarget().asSwitch();
} }
syn Collection<Sensor> TrackElement.monitoringSensors() { coll ArrayList<Sensor> TrackElement.monitoringSensors() [new ArrayList()] with add;
return getRoot().monitoringSensorsMap().get(this.id());
}
syn Map<Integer,Set<Sensor>> RailwayContainer.monitoringSensorsMap() { Sensor contributes this
Map<Integer,Set<Sensor>> sensorMap = new java.util.HashMap<Integer,Set<Sensor>>(); to TrackElement.monitoringSensors()
for each monitoredElements();
// fill the keys RailwayContainer contributes {
for (Region region: getRegionList()) { // Explicitly traverses regions, skips routes.
for (TrackElement trackElement: region.getTrackElementList()) { getRegionList().collectContributions();
sensorMap.put(trackElement.id(), new java.util.HashSet()); } to TrackElement.monitoringSensors();
}
}
// update the values Region contributes {
for (Sensor sensor : sensors()) { // Explicitly traverses sensors, skips elements.
for (Ref teRef : sensor.getMonitoredElementList()) { getSensorList().collectContributions();
sensorMap.get(teRef.getValue()).add(sensor); } to TrackElement.monitoringSensors();
}
}
return sensorMap; Sensor contributes {
} // Stop at sensor, only contains refs.
} to TrackElement.monitoringSensors();
syn Collection<Route> Sensor.requiringRoutes() { syn Collection<Route> Sensor.requiringRoutes() {
return getRoot().requiringRoutesMap().get(this.id()); return getRoot().requiringRoutesMap().get(this.id());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment