@Override public void handleFirstActivity(Activity act) { assert act != null; this.firstActivityEndTime = act.getEndTime(); this.firstActivity = act; }
@Override public void handleFirstActivity(Activity act) { assert act != null; this.firstActivityEndTime = act.getEndTime(); this.firstActivity = act; this.firstAct = false; }
@Override public double getEndTime() { return act.getEndTime(); }
@Override public double getEndTime() { return this.delegate.getEndTime() ; }
@Override public double getEndTime() { return this.delegate.getEndTime(); } @Override
private static double updateTime( final double currTime, final Activity act) { double e = act.getEndTime(); double d = act.getMaximumDuration(); return e != Time.UNDEFINED_TIME ? e : currTime + ( d != Time.UNDEFINED_TIME ? d : 0 ); }
@Override public DynActivity computeInitialActivity(DynAgent adapterAgent) { this.agent = adapterAgent; Activity act = (Activity)planElemIter.next(); return new IdleDynActivity(act.getType(), act.getEndTime()); }
@Override public final void handleActivity(Activity activity) { if (activity.getStartTime() != Time.UNDEFINED_TIME) { startActivity(activity.getStartTime(), activity); } if (activity.getEndTime() != Time.UNDEFINED_TIME) { endActivity(activity.getEndTime(), activity); } }
public final void handleActivity(Activity activity) { if (activity.getStartTime() != Time.UNDEFINED_TIME) { startActivity(activity.getStartTime(), activity); } if (activity.getEndTime() != Time.UNDEFINED_TIME) { endActivity(activity.getEndTime(), activity); } }
@Override public void handleActivity(Activity act) { this.score += calcActScore(act.getStartTime(), act.getEndTime(), act); }
@Override public void handleActivity(Activity act) { this.score += calcActScore(act.getStartTime(), act.getEndTime(), act); }
public SubtourRecord( final Subtour subtour, final List<VehicleRecord> possibleVehicles) { this.possibleVehicles = possibleVehicles; this.subtour = subtour; final Trip firstTrip = subtour.getTrips().get( 0 ); this.startTime = firstTrip.getOriginActivity().getEndTime(); if ( startTime == Time.UNDEFINED_TIME ) throw new RuntimeException( "no end time in "+firstTrip.getOriginActivity() ); final Trip lastTrip = subtour.getTrips().get( subtour.getTrips().size() - 1 ); this.endTime = calcArrivalTime( lastTrip ); } }
private List<? extends PlanElement> computeTravelTimeFromCompleteRouting( final Person person, final Activity fromAct, final Activity toAct, final String mode) { final List<? extends PlanElement> trip = this.router.calcRoute( mode, new ActivityWrapperFacility( fromAct ), new ActivityWrapperFacility( toAct ), fromAct.getEndTime(), person ); fillInLegTravelTimes( fromAct.getEndTime() , trip ); return trip; } }
@Override public DynAction computeNextAction(DynAction oldAction, double now) { PlanElement planElem = planElemIter.next(); if (planElem instanceof Activity) { Activity act = (Activity)planElem; return new IdleDynActivity(act.getType(), act.getEndTime()); } // only the 'car' mode supported right now Leg leg = (Leg)planElem; return new StaticDriverDynLeg(leg.getMode(), (NetworkRoute)leg.getRoute()); } }
public ActivitySerializable(Activity act) { coord = new CoordSerializable(act.getCoord()); endTime = act.getEndTime(); facIdString = act.getFacilityId() == null ? null : act.getFacilityId().toString(); linkIdString = act.getLinkId() == null ? null : act.getLinkId().toString(); maximumDuration = act.getMaximumDuration(); startTime = act.getStartTime(); type = act.getType(); }
@Override public void run(final Plan plan) { for ( Activity act : TripStructureUtils.getActivities( plan , blackList ) ) { // this is deliberately simplistic. Cleanup up of the time information should be done somewhere else. if ( !Time.isUndefinedTime( act.getEndTime() ) ) { act.setEndTime(mutateTime(act.getEndTime())); } if ( affectingDuration ) { if ( !Time.isUndefinedTime( act.getMaximumDuration() ) ) { act.setMaximumDuration(mutateTime(act.getMaximumDuration())); } } } // the legs are not doing anything. kai, jun'12 }
protected double computeTravelTime(Person person, Activity fromAct, Activity toAct) { Leg leg = PopulationUtils.createLeg(TransportMode.car); leg.setDepartureTime(0.0); leg.setTravelTime(0.0); leg.setTravelTime( 0.0 - leg.getDepartureTime() ); PlanRouterAdapter.handleLeg(router, person, leg, fromAct, toAct, fromAct.getEndTime()); return leg.getTravelTime(); }
public static void copyFromTo(Activity act, Activity newAct) { Coord coord = act.getCoord() == null ? null : new Coord(act.getCoord().getX(), act.getCoord().getY()); // (we don't want to copy the coord ref, but rather the contents!) newAct.setCoord(coord); newAct.setType( act.getType() ); newAct.setLinkId(act.getLinkId()); newAct.setStartTime(act.getStartTime()); newAct.setEndTime(act.getEndTime()); newAct.setMaximumDuration(act.getMaximumDuration()); newAct.setFacilityId(act.getFacilityId()); AttributesUtils.copyAttributesFromTo( act , newAct ); }
@Test public void testCreatesActivty() { EventsToActivities testee = new EventsToActivities(); MockActivityHandler ah = new MockActivityHandler(); testee.addActivityHandler(ah); testee.reset(0); testee.handleEvent(new ActivityStartEvent(10.0, Id.create("1", Person.class), Id.create("l1", Link.class), Id.create("l1", ActivityFacility.class), "work")); testee.handleEvent(new ActivityEndEvent(30.0, Id.create("1", Person.class), Id.create("l1", Link.class), Id.create("l1", ActivityFacility.class), "work")); Assert.assertNotNull(ah.handledActivity); Assert.assertEquals(10.0, ah.handledActivity.getActivity().getStartTime(), 1e-8); Assert.assertEquals(30.0, ah.handledActivity.getActivity().getEndTime(), 1e-8); }
@Test public void testDontCreateNightActivityIfNoneIsBeingPerformedWhenSimulationEnds() { EventsToActivities testee = new EventsToActivities(); MockActivityHandler ah = new MockActivityHandler(); testee.addActivityHandler(ah); testee.reset(0); testee.handleEvent(new ActivityEndEvent(10.0, Id.create("1", Person.class), Id.create("l1", Link.class), Id.create("f1", ActivityFacility.class), "home")); Assert.assertNotNull(ah.handledActivity); Assert.assertEquals(Time.UNDEFINED_TIME, ah.handledActivity.getActivity().getStartTime(), 1e-8); Assert.assertEquals(10.0, ah.handledActivity.getActivity().getEndTime(), 1e-8); ah.reset(); testee.finish(); Assert.assertNull(ah.handledActivity); }