本文整理了Java中org.matsim.api.core.v01.population.Activity.getType()
方法的一些代码示例,展示了Activity.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getType()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:getType
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public String getType() {
return this.delegate.getType() ;
}
代码示例来源:origin: matsim-org/matsim
@Override
@Deprecated // preferably use SumScoringFunction. kai, oct'13
public void endActivity(final double time, final Activity act) {
assert act != null;
assert currentActivity == null || currentActivity.getType().equals(act.getType());
if (this.firstAct) {
this.firstActivityEndTime = time;
this.firstActivity = act;
this.firstAct = false;
} else {
this.score += calcActScore(this.currentActivityStartTime, time, act);
}
currentActivity = null;
}
代码示例来源:origin: matsim-org/matsim
@Override
public String getType() {
return this.delegate.getType();
}
@Override
代码示例来源: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
public void addActivity( final Id person , final Activity activity ) {
final Map<Id, List<Activity>> activitiesPerPerson =
MapUtils.getMap(
activity.getType(),
map );
final List<Activity> activities =
MapUtils.getList(
person,
activitiesPerPerson );
activities.add( activity );
}
代码示例来源:origin: matsim-org/matsim
private void getFlexibleActs(Plan plan, List<Activity> flexibleActivities) {
for (int i = 0; i < plan.getPlanElements().size(); i = i + 2) {
Activity act = (Activity)plan.getPlanElements().get(i);
if (this.flexibleTypes.contains(this.converter.convertType(act.getType()))) {
flexibleActivities.add(act);
}
}
}
代码示例来源:origin: matsim-org/matsim
@Override
public void handleFirstActivity(Activity act) {
if ( blackList.isStageActivity( act.getType() ) ) return;
delegate.handleFirstActivity( act);
}
代码示例来源:origin: matsim-org/matsim
@Override
public void handleActivity(Activity act) {
if ( blackList.isStageActivity( act.getType() ) ) return;
delegate.handleActivity( act);
}
代码示例来源:origin: matsim-org/matsim
@Override
public void handleLastActivity(Activity act) {
if ( blackList.isStageActivity( act.getType() ) ) return;
delegate.handleLastActivity( act);
}
代码示例来源:origin: matsim-org/matsim
public static Trip findTripStartingAtActivity( final Activity activity, final Plan plan, StageActivityTypes stageActivities ) {
Gbl.assertIf( ! stageActivities.isStageActivity( activity.getType()) ) ;
List<Trip> trips = getTrips( plan, stageActivities ) ;
for ( Trip trip : trips ) {
if ( trip.getOriginActivity().equals( activity ) ) {
return trip ;
}
}
return null ;
}
代码示例来源:origin: matsim-org/matsim
private void checkIfNotStageActivity(Activity origAct) {
if( this.tripRouter.getStageActivityTypes().isStageActivity(origAct.getType()) ){
throw new ReplanningException("trying to replace a helper activity (stage activity) by a real activity; this is not possible") ;
}
}
private static boolean checkIfTripHasAlreadyStarted(MobsimAgent agent, final List<PlanElement> currentTripElements) {
代码示例来源: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 static Trip findTripEndingAtActivity(Activity activity, Plan plan, StageActivityTypes stageActivities ) {
Gbl.assertIf( ! stageActivities.isStageActivity( activity.getType()) ) ;
List<Trip> trips = getTrips(plan.getPlanElements(), stageActivities ) ;
for ( Trip trip : trips ) {
if ( activity.equals( trip.getDestinationActivity() ) ) {
return trip;
}
}
return null ;
}
public static Trip findTripStartingAtActivity( final Activity activity, final Plan plan, StageActivityTypes stageActivities ) {
代码示例来源:origin: matsim-org/matsim
public static Activity createActivity(Activity act) {
Activity newAct = getFactory().createActivityFromLinkId(act.getType(), act.getLinkId()) ;
copyFromTo(act, newAct);
// (this ends up setting type and linkId again)
return newAct ;
}
代码示例来源: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
private void setNewLocationForAct(Activity act, int length) {
ActivityFacilityImpl facility = this.facilitiesOfType.get(act.getType())[super.random.nextInt(length)];
act.setFacilityId(facility.getId());
act.setLinkId(NetworkUtils.getNearestLink(((Network) this.scenario.getNetwork()), facility.getCoord()).getId());
act.setCoord(facility.getCoord());
}
}
代码示例来源:origin: matsim-org/matsim
@Override
public final void endActivityAndComputeNextState(final double now) {
Activity act = (Activity) this.getCurrentPlanElement() ;
this.getEvents().processEvent( new ActivityEndEvent(now, this.getPerson().getId(), this.currentLinkId, act.getFacilityId(), act.getType()));
// note that when we are here we don't know if next is another leg, or an activity Therefore, we go to a general method:
advancePlan(now);
}
@Override
代码示例来源:origin: matsim-org/matsim
private void initializeActivity(Activity act, double now) {
this.setState(MobsimAgent.State.ACTIVITY) ;
this.getEvents().processEvent( new ActivityStartEvent(now, this.getId(), this.getCurrentLinkId(), act.getFacilityId(), act.getType()));
calculateAndSetDepartureTime(act);
getModifiablePlan(); // this is necessary to make the plan modifiable, so that setting the start time (next line) is actually feasible. kai/mz, oct'16
((Activity) getCurrentPlanElement()).setStartTime(now);
}
代码示例来源:origin: matsim-org/matsim
@Override
public void processEvent() {
Event event;
// schedule ActEndEvent
event = new ActivityEndEvent(this.getMessageArrivalTime(), vehicle.getOwnerPerson().getId(), vehicle.getCurrentLinkId(), vehicle
.getPreviousActivity().getFacilityId(), vehicle.getPreviousActivity().getType());
eventsManager.processEvent(event);
// schedule AgentDepartureEvent
event = new PersonDepartureEvent(this.getMessageArrivalTime(), vehicle.getOwnerPerson().getId(), vehicle.getCurrentLinkId(),
vehicle.getCurrentLeg().getMode());
eventsManager.processEvent(event);
}
代码示例来源: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 );
}
内容来源于网络,如有侵权,请联系作者删除!