}
// Now adjusts Empirical Routing (if any) - Now named Probability Routing
keys = tempkey.keySet().iterator();
Object[] classes;
RoutingStrategy rs;
Map oldRouting, newRouting;
// Search in every new inserted station
while (keys.hasNext()) {
newkey = tempkey.get(keys.next());
classes = mediator.getClassDefinition().getClassKeys().toArray();
for (Object classe : classes) {
rs = (RoutingStrategy) mediator.getStationDefinition().getRoutingStrategy(newkey, classe);
if (rs instanceof ProbabilityRouting) {
oldRouting = rs.getValues();
newRouting = new HashMap();
// For each old destination, set new one if it was copied with
Object[] oldDest = oldRouting.keySet().toArray();
for (Object element : oldDest) {
// Now checks if target station was copied with source one and a link connecting them exists
if (tempkey.containsKey(element) && mediator.getStationDefinition().areConnected(newkey, tempkey.get(element))) {
newRouting.put(tempkey.get(element), oldRouting.get(element));
}
}
rs.getValues().clear();
rs.getValues().putAll(newRouting);
}
}
}
// Selects every inserted element