org.matsim.api.core.v01.population.Activity.getEndTime()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中org.matsim.api.core.v01.population.Activity.getEndTime()方法的一些代码示例,展示了Activity.getEndTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getEndTime()方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:getEndTime

Activity.getEndTime介绍

暂无

代码示例

代码示例来源:origin: matsim-org/matsim

@Override
public void handleFirstActivity(Activity act) {
  assert act != null;
  this.firstActivityEndTime = act.getEndTime();
  this.firstActivity = act;
}

代码示例来源:origin: matsim-org/matsim

@Override
public void handleFirstActivity(Activity act) {
  assert act != null;
  this.firstActivityEndTime = act.getEndTime();
  this.firstActivity = act;
  this.firstAct = false;
}

代码示例来源:origin: matsim-org/matsim

@Override
public double getEndTime() {
  return act.getEndTime();
}

代码示例来源:origin: matsim-org/matsim

@Override
public double getEndTime() {
  return this.delegate.getEndTime() ;
}

代码示例来源:origin: matsim-org/matsim

@Override
public double getEndTime() {
  return this.delegate.getEndTime();
}
@Override

代码示例来源:origin: matsim-org/matsim

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 );
}

代码示例来源:origin: matsim-org/matsim

@Override
public DynActivity computeInitialActivity(DynAgent adapterAgent) {
  this.agent = adapterAgent;
  Activity act = (Activity)planElemIter.next();
  return new IdleDynActivity(act.getType(), act.getEndTime());
}

代码示例来源:origin: matsim-org/matsim

@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);
  }
}

代码示例来源:origin: matsim-org/matsim

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);
  }
}

代码示例来源:origin: matsim-org/matsim

@Override
public void handleActivity(Activity act) {
  this.score += calcActScore(act.getStartTime(), act.getEndTime(), act);
}

代码示例来源:origin: matsim-org/matsim

@Override
public void handleActivity(Activity act) {
  this.score += calcActScore(act.getStartTime(), act.getEndTime(), act);
}

代码示例来源:origin: matsim-org/matsim

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 );
  }
}

代码示例来源:origin: matsim-org/matsim

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;
  }
}

代码示例来源:origin: matsim-org/matsim

@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());
  }
}

代码示例来源:origin: matsim-org/matsim

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();
}

代码示例来源:origin: matsim-org/matsim

@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
}

代码示例来源:origin: matsim-org/matsim

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();
}

代码示例来源:origin: matsim-org/matsim

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 );
}

代码示例来源:origin: matsim-org/matsim

@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);
}

代码示例来源:origin: matsim-org/matsim

@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);
}

相关文章