@Override public PlanElement getCurrentPlanElement() { return planDelegate.getCurrentPlanElement(); }
private static boolean checkIfTripHasAlreadyStarted(MobsimAgent agent, final List<PlanElement> currentTripElements) { return currentTripElements.contains( ((PlanAgent)agent).getCurrentPlanElement() ) ; } private static void checkIfNotInPastOrCurrent(MobsimAgent agent, int index) {
public static Integer getCurrentPlanElementIndex(MobsimAgent agent) { // if (agent instanceof PersonDriverAgentImpl) { // return ((PersonDriverAgentImpl) agent).getCurrentPlanElementIndex() ; // } else // commenting out the above so the new code runs through the existing tests. kai, nov'17 if ( agent instanceof PlanAgent ) { return ((PlanAgent)agent).getCurrentPlan().getPlanElements().indexOf( ((PlanAgent)agent).getCurrentPlanElement() ) ; } else { throw new RuntimeException("Sorry, agent is from type " + agent.getClass().toString() + " which does not support getCurrentPlanElementIndex(...). Aborting!"); } }
private static Collection<Id<Person>> getPassengerIds(final MobsimAgent agent) { if ( !(agent instanceof PlanAgent) ) throw new RuntimeException( agent.getClass().toString() ); final Leg currentLeg = (Leg) ((PlanAgent) agent).getCurrentPlanElement(); final DriverRoute route = (DriverRoute) currentLeg.getRoute(); return route.getPassengersIds(); }
private static Id getDriverId(final MobsimAgent agent) { if ( !(agent instanceof PlanAgent) ) throw new RuntimeException( agent.getClass().toString() ); final Leg currentLeg = (Leg) ((PlanAgent) agent).getCurrentPlanElement(); final PassengerRoute route = (PassengerRoute) currentLeg.getRoute(); return route.getDriverId(); }
@Override public Activity getCurrentActivity(MobsimAgent mobsimAgent) { if (mobsimAgent == null || mobsimAgent.getState() != MobsimAgent.State.ACTIVITY) { return null; } if (mobsimAgent instanceof PlanAgent) { return (Activity) ((PlanAgent)mobsimAgent).getCurrentPlanElement(); } if (nonPlanAgentQueryHelper != null) { return nonPlanAgentQueryHelper.getCurrentActivity(mobsimAgent); } return null; }