@Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { if (PERSON.equals(name)) { startPerson(atts); } else if (PLAN.equals(name)) { startPlan(atts); } else if (ACT.equals(name)) { startAct(atts); } else if (LEG.equals(name)) { startLeg(atts); } else if (ROUTE.equals(name)) { startRoute(); } else if (DEMAND.equals(name)) { log.info("The tag <demand> is not supported"); } else if (!SEGMENT.equals(name) && !MODEL.equals(name) && !PARAM.equals(name) && !PLANS.equals(name)) { throw new RuntimeException(this + "[tag=" + name + " not known or not supported]"); } }
private void startAct(final Attributes atts) { if (atts.getValue("zone") != null) { log.info("The attribute 'zone' of <act> will be ignored"); } Activity act; if (atts.getValue("link") != null) { Id<Link> linkId = Id.create(atts.getValue("link"), Link.class); final Id<Link> linkId1 = linkId; act = PopulationUtils.createAndAddActivityFromLinkId(this.currplan, atts.getValue("type"), linkId1); if (atts.getValue(ATTR_X100) != null && atts.getValue(ATTR_Y100) != null) { final Coord coord = parseCoord( atts ); act.setCoord(coord); } } else if (atts.getValue(ATTR_X100) != null && atts.getValue(ATTR_Y100) != null) { final Coord coord = parseCoord( atts ); act = PopulationUtils.createAndAddActivityFromCoord(this.currplan, atts.getValue("type"), coord); } else { throw new IllegalArgumentException("Either the coords or the link must be specified for an Act."); } act.setStartTime(Time.parseTime(atts.getValue("start_time"))); act.setMaximumDuration(Time.parseTime(atts.getValue("dur"))); act.setEndTime(Time.parseTime(atts.getValue("end_time"))); if (this.routeNodes != null) { this.currroute.setLinkIds(this.prevAct.getLinkId(), NetworkUtils.getLinkIds(RouteUtils.getLinksFromNodes(NetworkUtils.getNodes(this.network, this.routeNodes))), act.getLinkId()); this.routeNodes = null; this.currroute = null; } this.prevAct = act; }
case PLANS: this.delegate = new PopulationReaderMatsimV0( transformation, this.scenario);