本文整理了Java中org.matsim.api.core.v01.population.Activity.setType()
方法的一些代码示例,展示了Activity.setType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.setType()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:setType
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public void setType(String type) {
act.setType(type);
}
代码示例来源:origin: matsim-org/matsim
@Override
public void setType(String type) {
this.delegate.setType(type);
}
@Override
代码示例来源:origin: matsim-org/matsim
private static void copyPlanFieldsToFrom(Plan planTarget, LCPlan planTemplate) {
planTarget.setScore(planTemplate.getScore());
int actLegIndex = 0;
for (PlanElement pe : planTarget.getPlanElements()) {
if (pe instanceof Activity) {
LCActivity actTemplate = ((LCActivity) planTemplate.getPlanElements().get(actLegIndex));
((Activity) pe).setEndTime(actTemplate.getEndTime());
((Activity) pe).setCoord(actTemplate.getCoord());
((Activity) pe).setFacilityId(actTemplate.getFacilityId());
((Activity) pe).setLinkId(actTemplate.getLinkId());
((Activity) pe).setMaximumDuration(actTemplate.getMaximumDuration());
((Activity) pe).setStartTime(actTemplate.getStartTime());
((Activity) pe).setType(actTemplate.getType());
} else if (pe instanceof Leg) {
LCLeg legTemplate = ((LCLeg) planTemplate.getPlanElements().get(actLegIndex));
Leg r = ((Leg) pe);
r.setTravelTime( legTemplate.getArrivalTime() - r.getDepartureTime() );
((Leg) pe).setDepartureTime(legTemplate.getDepartureTime());
((Leg) pe).setMode(legTemplate.getMode());
((Leg) pe).setRoute(legTemplate.getRoute());
((Leg) pe).setTravelTime(legTemplate.getTravelTime());
} else throw new RuntimeException("Unexpected PlanElement type was found: " + pe.getClass().toString() + ". Aborting!");
actLegIndex++;
}
}
代码示例来源:origin: matsim-org/matsim
private static void copyPlanFieldsToFrom1(Plan planTarget, Plan planTemplate) {
planTarget.setScore(planTemplate.getScore());
int actLegIndex = 0;
for (PlanElement pe : planTarget.getPlanElements()) {
if (pe instanceof Activity) {
Activity actTemplate = ((Activity) planTemplate.getPlanElements().get(actLegIndex));
((Activity) pe).setEndTime(actTemplate.getEndTime());
((Activity) pe).setCoord(actTemplate.getCoord());
((Activity) pe).setFacilityId(actTemplate.getFacilityId());
((Activity) pe).setLinkId(actTemplate.getLinkId());
((Activity) pe).setMaximumDuration(actTemplate.getMaximumDuration());
((Activity) pe).setStartTime(actTemplate.getStartTime());
((Activity) pe).setType(actTemplate.getType());
} else if (pe instanceof Leg) {
Leg legTemplate = ((Leg)planTemplate.getPlanElements().get(actLegIndex));
Leg r = ((Leg) pe);
r.setTravelTime( legTemplate.getDepartureTime() + legTemplate.getTravelTime() - r.getDepartureTime() );
((Leg) pe).setDepartureTime(legTemplate.getDepartureTime());
((Leg) pe).setMode(legTemplate.getMode());
((Leg) pe).setRoute(legTemplate.getRoute());
((Leg) pe).setTravelTime(legTemplate.getTravelTime());
} else throw new RuntimeException("Unexpected PlanElement type was found: " + pe.getClass().toString() + ". Aborting!");
actLegIndex++;
}
}
代码示例来源:origin: matsim-org/matsim
Fixture f = new Fixture();
((Activity) f.plan.getPlanElements().get(8)).setType("h2");
代码示例来源: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 );
}
内容来源于网络,如有侵权,请联系作者删除!