private void startLeg(final Attributes atts) { if (this.routeDescription != null) { finishLastRoute(); } String mode = atts.getValue(ATTR_LEG_MODE); if (VALUE_UNDEF.equals(mode)) { mode = "undefined"; } this.currleg = PopulationUtils.createAndAddLeg( this.currplan, mode.intern() ); this.currleg.setDepartureTime(Time.parseTime(atts.getValue(ATTR_LEG_DEPTIME))); this.currleg.setTravelTime(Time.parseTime(atts.getValue(ATTR_LEG_TRAVTIME))); // LegImpl r = this.currleg; // r.setTravelTime( Time.parseTime(atts.getValue(ATTR_LEG_ARRTIME)) - r.getDepartureTime() ); // arrival time is in dtd, but no longer evaluated in code (according to not being in API). kai, jun'16 }
private void startAct(final Attributes atts) { if (atts.getValue(ATTR_ACT_LINK) != null) { Id<Link> linkId = Id.create(atts.getValue(ATTR_ACT_LINK), Link.class); final Id<Link> linkId1 = linkId; this.curract = PopulationUtils.createAndAddActivityFromLinkId(this.currplan, atts.getValue(ATTR_ACT_TYPE), linkId1); if ((atts.getValue(ATTR_ACT_X) != null) && (atts.getValue(ATTR_ACT_Y) != null)) { final Coord coord = parseCoord( atts ); this.curract.setCoord(coord); } } else if ((atts.getValue(ATTR_ACT_X) != null) && (atts.getValue(ATTR_ACT_Y) != null)) { final Coord coord = parseCoord( atts ); this.curract = PopulationUtils.createAndAddActivityFromCoord(this.currplan, atts.getValue(ATTR_ACT_TYPE), coord); } else { throw new IllegalArgumentException("In this version of MATSim either the coords or the link must be specified for an Act."); } this.curract.setStartTime(Time.parseTime(atts.getValue(ATTR_ACT_STARTTIME))); this.curract.setMaximumDuration(Time.parseTime(atts.getValue(ATTR_ACT_MAXDUR))); this.curract.setEndTime(Time.parseTime(atts.getValue(ATTR_ACT_ENDTIME))); String fId = atts.getValue(ATTR_ACT_FACILITY); if (fId != null) { this.curract.setFacilityId(Id.create(fId, ActivityFacility.class)); } if (this.routeDescription != null) { finishLastRoute(); } }