/*
* constructs a multi-query that advances one step, reads the list of
* active vehicles, the list of teleport-starting and teleport-ending
*/
StringListQ teleportStartQ;
StringListQ teleportEndQ;
MultiQuery multi = new MultiQuery(dos, dis);
{ // begin multi-query
SimStepQuery ssq = new SimStepQuery(dis, dos);
ssq.setTargetTime(currentSimStep * 1000);
multi.add(ssq);
multi.add(vehicleListQuery);
teleportStartQ = new StringListQ(dis, dos,
Constants.CMD_GET_SIM_VARIABLE, "",
Constants.VAR_TELEPORT_STARTING_VEHICLES_IDS);
multi.add(teleportStartQ);
teleportEndQ = new StringListQ(dis, dos,
Constants.CMD_GET_SIM_VARIABLE, "",
Constants.VAR_TELEPORT_ENDING_VEHICLES_IDS);
multi.add(teleportEndQ);
} // end multi-query
multi.run();
/*
* now, compute the difference sets (departed/arrived) and teleports
*/
List<String> teleportStart = teleportStartQ.get();
List<String> teleportEnd = teleportEndQ.get();
Set<String> vehicleListAfter = new HashSet<String>(vehicleListQuery.get());
Set<String> departedIDs = Utils.getAddedItems(vehicleListBefore, vehicleListAfter);
departedIDs.removeAll(teleportEnd);