@Override public void endTag(final String name, final String content, final Stack<String> context) { if (Constants.DESCRIPTION.equals(name) && Constants.TRANSIT_ROUTE.equals(context.peek())) { this.currentTransitRoute.description = content; } else if (Constants.TRANSPORT_MODE.equals(name)) { this.currentTransitRoute.mode = content.intern(); } else if (Constants.TRANSIT_ROUTE.equals(name)) { List<TransitRouteStop> stops = new ArrayList<TransitRouteStop>(this.currentTransitRoute.stops.size()); for (TempStop tStop : this.currentTransitRoute.stops) { TransitRouteStopImpl routeStop = new TransitRouteStopImpl(tStop.stop, tStop.arrival, tStop.departure); stops.add(routeStop); routeStop.setAwaitDepartureTime(tStop.awaitDeparture); } NetworkRoute route = null; if (this.currentRouteProfile.firstLinkId != null) { if (this.currentRouteProfile.lastLinkId == null) { this.currentRouteProfile.lastLinkId = this.currentRouteProfile.firstLinkId; } route = this.routeFactory.createRoute(NetworkRoute.class, this.currentRouteProfile.firstLinkId, this.currentRouteProfile.lastLinkId); route.setLinkIds(this.currentRouteProfile.firstLinkId, this.currentRouteProfile.linkIds, this.currentRouteProfile.lastLinkId); } TransitRoute transitRoute = this.schedule.getFactory().createTransitRoute(this.currentTransitRoute.id, route, stops, this.currentTransitRoute.mode); transitRoute.setDescription(this.currentTransitRoute.description); for (Departure departure : this.currentTransitRoute.departures.values()) { transitRoute.addDeparture(departure); } this.currentTransitLine.addRoute(transitRoute); } }
transitRoute.setDescription(this.currentTransitRoute.description); for (Departure departure : this.currentTransitRoute.departures.values()) { transitRoute.addDeparture(departure);
public void testDescription() { Fixture f = new Fixture(); assertNull(f.tRoute.getDescription()); String desc = "some random description string."; f.tRoute.setDescription(desc); assertEquals(desc, f.tRoute.getDescription()); desc += " [updated]"; f.tRoute.setDescription(desc); assertEquals(desc, f.tRoute.getDescription()); }
@Override public void score(Map<Id<Vehicle>, PScoreContainer> pScores, SubsidyI subsidy, RouteDesignScoringManager routeDesignScoringManager) { this.setScoreLastIteration(this.getScore()); this.setScore(0); // score all plans for (PPlan plan : this.getAllPlans()) { scorePlan(pScores, plan, routeDesignScoringManager); if (subsidy != null) { Id<PPlan> pplanId = Id.create(plan.getLine().getId().toString() + "-" + plan.getId().toString(), PPlan.class); double subsidyAmount = subsidy.getSubsidy(pplanId); double newPlanScore = subsidyAmount + plan.getScore(); plan.setScore(newPlanScore); } this.setScore(this.getScore() + plan.getScore()); for (TransitRoute route : plan.getLine().getRoutes().values()) { route.setDescription(plan.toString(this.budget + this.getScore())); } } processScore(); }
route1.setDescription("Just a comment.");