本文整理了Java中org.matsim.api.core.v01.population.Activity.getFacilityId()
方法的一些代码示例,展示了Activity.getFacilityId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getFacilityId()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:getFacilityId
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public Id<ActivityFacility> getFacilityId() {
return act.getFacilityId();
}
代码示例来源:origin: matsim-org/matsim
@Override
public Id<ActivityFacility> getFacilityId() {
return this.delegate.getFacilityId() ;
}
@Override
代码示例来源:origin: matsim-org/matsim
@Override
public Id<ActivityFacility> getId() {
return this.wrapped.getFacilityId();
}
代码示例来源:origin: matsim-org/matsim
private Id<? extends BasicLocation> getLocationId(Activity activity) {
return activity.getFacilityId()!=null ?
activity.getFacilityId() :
activity.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
@Override
public Id<ActivityFacility> getFacilityId() {
return this.delegate.getFacilityId();
}
public EqualsActivity(final String type, final Id<Link> link) {
代码示例来源:origin: matsim-org/matsim
private boolean atSameLocation(Activity firstLegUsingMode,
Activity lastLegUsingMode) {
return firstLegUsingMode.getFacilityId()!=null ?
firstLegUsingMode.getFacilityId().equals(
lastLegUsingMode.getFacilityId() ) :
firstLegUsingMode.getLinkId().equals(
lastLegUsingMode.getLinkId() );
}
代码示例来源:origin: matsim-org/matsim
public BasicFacility(
final Activity act) {
this.coord = act.getCoord();
this.id = act.getFacilityId();
this.link = act.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
private static Facility getFacility(Activity activity, Scenario scenario) {
ActivityFacility fac = scenario.getActivityFacilities().getFacilities().get( activity.getFacilityId() ) ;
return ( fac != null) ? fac : new ActivityWrapperFacility( activity );
}
}
代码示例来源:origin: matsim-org/matsim
final Coord calcBarycenterCoord(
final List<Activity> activitiesToMutate ) {
double sumX = 0;
double sumY = 0;
for ( Activity act : activitiesToMutate ) {
final Id facilityId = act.getFacilityId();
if ( facilityId == null ) throw new RuntimeException( "no facility for act "+act );
final ActivityFacility fac = facilities.getFacilities().get( facilityId );
sumX += fac.getCoord().getX();
sumY += fac.getCoord().getY();
}
return new Coord(sumX / activitiesToMutate.size(), sumY / activitiesToMutate.size());
}
代码示例来源:origin: matsim-org/matsim
private Facility toFacility(final Activity act) {
if ((act.getLinkId() == null || act.getCoord() == null)
&& facilities != null
&& !facilities.getFacilities().isEmpty()) {
// use facilities only if the activity does not provides the required fields.
return facilities.getFacilities().get( act.getFacilityId() );
}
return new ActivityWrapperFacility( act );
}
代码示例来源: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
public static Id<Link> decideOnLinkIdForActivity( Activity act, Scenario sc ) {
if ( act.getFacilityId() !=null ) {
final ActivityFacility facility = sc.getActivityFacilities().getFacilities().get( act.getFacilityId() );;
if ( facility==null ) {
throw new RuntimeException("facility ID given but not in facilities container") ;
}
Gbl.assertNotNull( facility.getLinkId() );
return facility.getLinkId();
}
Gbl.assertNotNull( act.getLinkId() );
return act.getLinkId() ;
}
public static Coord decideOnCoordForActivity( Activity act, Scenario sc ) {
代码示例来源:origin: matsim-org/matsim
public double getDestinationScore(Activity act, double fVar, int activityIndex, Id<Person> personId) {
double score = 0.0;
if (this.scaleEpsilon.isFlexibleType(act.getType())) {
/*
* The following will not work if activities are inserted or removed during replanning (e.g. ptInteractionActivities). kai/mz, oct'14
*/
int actIndex = 2*activityIndex ; // "2": retrofitting; this used to be the PlanElementIndex. One could probably remove the "2",
// but then the test fail because this is equivalent to a different random seed. So more diligent checking would be needed.
if (fVar < 0.0) fVar = this.scaleEpsilon.getEpsilonFactor(act.getType());
score += (fVar * this.getEpsilonAlternative(act.getFacilityId(), personId, actIndex));
score += this.getAttributesScore(act.getFacilityId(), personId );
}
return score;
}
代码示例来源:origin: matsim-org/matsim
@Override
public Facility getDestinationFacility() {
PlanElement pe = this.getCurrentPlanElement() ;
if ( pe instanceof Leg ) {
Activity activity = this.getNextActivity() ;
ActivityFacility fac = this.scenario.getActivityFacilities().getFacilities().get( activity.getFacilityId() ) ;
return getFacility(activity, scenario);
// the above assumes alternating acts/legs. I start having the suspicion that we should revoke our decision to give that up.
// If not, one will have to use TripUtils to find the preceeding activity ... but things get more difficult. Preferably, the
// factility should then sit in the leg (since there it is used for routing). kai, dec'15
} else if ( pe instanceof Activity ) {
return null ;
}
throw new RuntimeException("unexpected type of PlanElement") ;
}
代码示例来源:origin: matsim-org/matsim
private List<? extends PlanElement> newTripToNewActivity(Activity newAct, String mainMode, double now,
MobsimAgent agent, Person person, Scenario scenario) {
log.debug("entering newTripToNewActivity") ;
Link currentLink = scenario.getNetwork().getLinks().get( agent.getCurrentLinkId() ) ;
Facility fromFacility = new LinkWrapperFacility( currentLink ) ;
Facility toFacility = scenario.getActivityFacilities().getFacilities().get( newAct.getFacilityId() ) ;
if ( toFacility == null ) {
toFacility = new ActivityWrapperFacility( newAct ) ;
}
List<? extends PlanElement> newTrip = tripRouter.calcRoute(mainMode, fromFacility, toFacility, now, person) ;
return newTrip;
}
// replan from stage activity:
代码示例来源: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 assertPlan(Plan plan, String homeFacilityId, String workFacilityId, boolean linkCoordMustBeNull) {
Activity home1 = (Activity) plan.getPlanElements().get(0);
Activity work = (Activity) plan.getPlanElements().get(2);
Activity home2 = (Activity) plan.getPlanElements().get(4);
Assert.assertEquals(homeFacilityId, home1.getFacilityId().toString());
Assert.assertEquals(workFacilityId, work.getFacilityId().toString());
Assert.assertEquals(homeFacilityId, home2.getFacilityId().toString());
if (linkCoordMustBeNull) {
Assert.assertNull(home1.getLinkId());
Assert.assertNull(home1.getCoord());
Assert.assertNull(work.getLinkId());
Assert.assertNull(work.getCoord());
Assert.assertNull(home2.getLinkId());
Assert.assertNull(home2.getCoord());
}
}
代码示例来源: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 );
}
内容来源于网络,如有侵权,请联系作者删除!