private void setLeg(final TransitLine line, final TransitRoute route, final Departure departure) { this.transitLine = line; this.transitRoute = route; this.departure = departure; this.departureTime = departure.getDepartureTime(); this.carRoute = route.getRoute(); }
@Override public int compare(UmlaufStueck o1, UmlaufStueck o2) { return Double.compare(o1.getDeparture().getDepartureTime(), o2.getDeparture().getDepartureTime()); }
System.out.print(Time.writeTime(departure.getDepartureTime())); Map<Id, Integer> accessCounter = getAccessCounter(departure); for (Id id : stopFacilityIds) {
private void writeDepartures(final Map<Id<Departure>, Departure> departures) throws UncheckedIOException { this.writeStartTag(Constants.DEPARTURES, null); // optimization: only create one List for multiple departures List<Tuple<String, String>> attributes = new ArrayList<Tuple<String, String>>(3); for (Departure dep : departures.values()) { attributes.clear(); attributes.add(this.createTuple(Constants.ID, dep.getId().toString())); attributes.add(this.createTimeTuple(Constants.DEPARTURE_TIME, dep.getDepartureTime())); if (dep.getVehicleId() != null) { attributes.add(this.createTuple(Constants.VEHICLE_REF_ID, dep.getVehicleId().toString())); } this.writeStartTag(Constants.DEPARTURE, attributes, true); } this.writeEndTag(Constants.DEPARTURES); } }
int i = 0; for (Departure dep : route.getDepartures().values()) { cache[i++] = dep.getDepartureTime();
double stopDepartureTime = departure.getDepartureTime() + offset;
Departure newDeparture = transitScheduleFactory.createDeparture(newDepartureId, oldDeparture.getDepartureTime()); newDeparture.setVehicleId(oldDeparture.getVehicleId()); mergeDestination.addDeparture(newDeparture);
private void writeDepartures(final Map<Id<Departure>, Departure> departures) throws IOException, UncheckedIOException { this.writeStartTag(Constants.DEPARTURES, null); // optimization: only create one List for multiple departures List<Tuple<String, String>> attributes = new ArrayList<>(3); for (Departure dep : departures.values()) { attributes.clear(); attributes.add(createTuple(Constants.ID, dep.getId().toString())); attributes.add(createTimeTuple(Constants.DEPARTURE_TIME, dep.getDepartureTime())); if (dep.getVehicleId() != null) { attributes.add(createTuple(Constants.VEHICLE_REF_ID, dep.getVehicleId().toString())); } if (AttributesUtils.isEmpty(dep.getAttributes())) { this.writeStartTag(Constants.DEPARTURE, attributes, true); } else { this.writeStartTag(Constants.DEPARTURE, attributes, false); this.writer.write(NL); this.attributesWriter.writeAttributes("\t\t\t\t\t", this.writer, dep.getAttributes()); this.writeEndTag(Constants.DEPARTURE); } } this.writeEndTag(Constants.DEPARTURES); } }
if (startTime > departure.getDepartureTime()) { startTime = departure.getDepartureTime(); if (endTime < departure.getDepartureTime()) { endTime = departure.getDepartureTime();
private void processEventVehicleArrives(final TransitStopFacility stop, final double now) { if (this.currentStop == null) { this.currentStop = this.nextStop; double delay = now - this.getDeparture().getDepartureTime(); if (! ( Double.isNaN(this.currentStop.getArrivalOffset()) && Double.isInfinite(this.currentStop.getArrivalOffset())) ){ delay = delay - this.currentStop.getArrivalOffset(); } else if (! (Double.isNaN(this.currentStop.getDepartureOffset()) && Double.isInfinite(this.currentStop.getDepartureOffset()))) { delay = delay - this.currentStop.getDepartureOffset(); } else { log.warn("Could not calculate delay!"); } eventsManager.processEvent(new VehicleArrivesAtFacilityEvent(now, this.vehicle.getVehicle().getId(), stop.getId(), delay)); } }
int d = 0; for (Departure departure : route.getDepartures().values()) sortedDepartures[d++] = departure.getDepartureTime(); Arrays.sort(sortedDepartures); Map<String, WaitTimeData> stopsMap = new HashMap<String, WaitTimeData>(100);
int d=0; for(Departure departure:route.getDepartures().values()) sortedDepartures[d++] = departure.getDepartureTime(); Arrays.sort(sortedDepartures); Map<Id<TransitStopFacility>, WaitTimeData> stopsMap = new HashMap<Id<TransitStopFacility>, WaitTimeData>(100);
private void depart(final double now) { double delay = now - this.getDeparture().getDepartureTime(); if (this.isBadDouble(this.getDeparture().getDepartureTime())){ //this is the case if the next stop is null delay = 0; } if (! this.isBadDouble(this.currentStop.getDepartureOffset())){ delay = delay - this.currentStop.getDepartureOffset(); } else if (! this.isBadDouble(this.currentStop.getArrivalOffset()) ){ delay = delay - this.currentStop.getArrivalOffset(); } else { log.warn("Could not calculate delay!"); } eventsManager.processEvent(new VehicleDepartsAtFacilityEvent(now, this.vehicle.getVehicle().getId(), this.currentStop.getStopFacility().getId(), delay)); this.nextStop = (stopIterator.hasNext() ? stopIterator.next() : null); if(this.nextStop == null) { assertVehicleIsEmpty(); } this.currentStop = null; }
int d=0; for(Departure departure:route.getDepartures().values()) sortedDepartures[d++] = departure.getDepartureTime(); Arrays.sort(sortedDepartures); Map<Id<TransitStopFacility>, WaitTimeData> stopsMap = new HashMap<Id<TransitStopFacility>, WaitTimeData>(100);
public void testInitialization() { Id<Departure> id = Id.create(1591, Departure.class); double time = 11.0 * 3600; Departure dep = createDeparture(id, time); assertEquals(id, dep.getId()); assertEquals(time, dep.getDepartureTime(), EPSILON); }
@Test public void testCreateDeparture() { TransitScheduleFactory builder = createTransitScheduleBuilder(); Id<Departure> id = Id.create(8, Departure.class); double time = 9.0*3600; Departure dep = builder.createDeparture(id, time); Assert.assertEquals(id, dep.getId()); Assert.assertEquals(time, dep.getDepartureTime(), MatsimTestUtils.EPSILON); }
assertNotNull(dep1); assertEquals(depId1, dep1.getId()); assertEquals(Time.parseTime(depTime1), dep1.getDepartureTime(), MatsimTestCase.EPSILON);
assertNotNull(dep1); assertEquals(depId1, dep1.getId()); assertEquals(Time.parseTime(depTime1), dep1.getDepartureTime(), MatsimTestCase.EPSILON); Departure dep2 = route.getDepartures().get(depId2); assertNotNull(dep2); assertEquals(depId2, dep2.getId()); assertEquals(Time.parseTime(depTime2), dep2.getDepartureTime(), MatsimTestCase.EPSILON);
Departure departureA = routeA.getDepartures().get(departureE.getId()); assertNotNull("departure not found: " + departureE.getId().toString(), departureA); assertEquals("different departure times.", departureE.getDepartureTime(), departureA.getDepartureTime(), EPSILON); assertEquals("different vehicle ids.", departureE.getVehicleId(), departureA.getVehicleId());
assertNotNull(dep1); assertEquals(depId1, dep1.getId()); assertEquals(Time.parseTime(depTime1), dep1.getDepartureTime(), MatsimTestCase.EPSILON); assertEquals(Id.create("v 975", Vehicle.class), dep1.getVehicleId()); Departure dep2 = route.getDepartures().get(depId2); assertNotNull(dep2); assertEquals(depId2, dep2.getId()); assertEquals(Time.parseTime(depTime2), dep2.getDepartureTime(), MatsimTestCase.EPSILON); assertNull(dep2.getVehicleId());