Departure
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.matsim.pt.transitSchedule.api.Departure(Showing top 15 results out of 315)

origin: matsim-org/matsim

public void testGetDeparturesImmutable() {
  Fixture f = new Fixture();
  Departure dep1 = new DepartureImpl(Id.create(1, Departure.class), 7.0*3600);
  assertEquals(0, f.tRoute.getDepartures().size());
  try {
    f.tRoute.getDepartures().put(dep1.getId(), dep1);
    fail("missing exception");
  }
  catch (UnsupportedOperationException e) {
    log.info("catched expected exception.", e);
  }
}
origin: matsim-org/matsim

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();
}
origin: matsim-org/matsim

public void setLine(TransitLine line) {
  this.line = line;
  this.vehicleIds = new TreeSet<>();
  for (TransitRoute route : this.line.getRoutes().values()) {
    for (Departure departure : route.getDepartures().values()) {
      this.vehicleIds.add(departure.getVehicleId());
    }
  }
  this.nVehicles = this.vehicleIds.size();
}

origin: matsim-org/matsim

@Override
public void setVehicleId(final Id<Vehicle> vehicleId) {
  this.vehicleId = vehicleId;
  for (UmlaufStueckI umlaufStueck : umlaufStuecke) {
    if (umlaufStueck.isFahrt()) {
      umlaufStueck.getDeparture().setVehicleId(vehicleId);
    }
  }
}
origin: matsim-org/matsim

  public void testVehicleId() {
    Departure dep = createDeparture(Id.create(6791, Departure.class), 7.0*3600);
    assertNull(dep.getVehicleId());
    Id<Vehicle> vehId = Id.create(2491, Vehicle.class);
    dep.setVehicleId(vehId);
    assertEquals(vehId, dep.getVehicleId());
  }
}
origin: matsim-org/matsim

@Override
public void addDeparture(final Departure departure) {
  final Id<Departure> id = departure.getId();
  if (this.departures.containsKey(id)) {
    throw new IllegalArgumentException("There is already a departure with id " + id.toString() + " in transit route " + this.routeId);
  }
  this.departures.put(id, departure);
}
origin: matsim-org/matsim

@Override
public boolean removeDeparture(final Departure departure) {
  return null != this.departures.remove(departure.getId());
}
origin: matsim-org/matsim

private double getNextDeparture(TransitRouterNetworkLink l, double time,
    Person person, Vehicle vehicle){
  // init the departure-time-cache
  initDepartures(l);
  // get the earliest departure
  Departure d = getEarliestPossibleDeparture(l, time, person, vehicle);
  double nextDeparture = d.getDepartureTime() + l.getFromNode().stop.getDepartureOffset();
  // maybe we got a departure somewhere back in time, thus check the next mornings
  while(nextDeparture < time){
    nextDeparture += 24.0*3600;
  }
  return nextDeparture;
}
/**
origin: matsim-org/matsim

public int getLoadAtDeparture(final TransitLine line, final TransitRoute route, final TransitStopFacility stopFacility, final Departure departure) {
  int nOfPassengers = 0;
  for (TransitRouteStop stop : route.getStops()) {
    StopInformation si = getStopInformation(line.getId(), route.getId(), stop.getStopFacility().getId(), departure.getId(), false);
    if (si != null) {
      nOfPassengers -= si.nOfLeaving;
      nOfPassengers += si.nOfEntering;
    }
    if (stop.getStopFacility() == stopFacility) {
      return nOfPassengers;
    }
  }
  return -1;
}
origin: matsim-org/matsim

@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);
}
origin: matsim-org/matsim

final void sendTransitDriverStartsEvent(final double now) {
  // A test initializes this Agent without internalInterface.
  // Actually, I am not sure if agents should send Events (or just be reactive, so they can be
  // tested / exercised as a unit, without a QSim.  michaz
  if (internalInterface != null) {
    // check if "Wenden"
    if(getTransitLine() == null){
      eventsManager.processEvent(new TransitDriverStartsEvent(now, this.dummyPerson.getId(),
          this.vehicle.getId(), Id.create("Wenden", TransitLine.class), Id.create("Wenden", TransitRoute.class), Id.create("Wenden", Departure.class)));
    } else {
      eventsManager.processEvent(new TransitDriverStartsEvent(now, this.dummyPerson.getId(),
          this.vehicle.getId(), getTransitLine().getId(), getTransitRoute().getId(), getDeparture().getId()));
    }
  }
}
origin: matsim-org/matsim

public StopInformation getDepartureStopInformation(final TransitLine line, final TransitRoute route, final TransitStopFacility stopFacility, final Departure departure) {
  return getStopInformation(line.getId(), route.getId(), stopFacility.getId(), departure.getId(), false);
}
origin: matsim-org/matsim

@Override
public int compare(UmlaufStueck o1, UmlaufStueck o2) {
  return Double.compare(o1.getDeparture().getDepartureTime(), o2.getDeparture().getDepartureTime());
}
origin: matsim-org/matsim

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);
}
origin: matsim-org/matsim

@Override
public int compare(Object o1, Object o2) {
  if((!(o1 instanceof DepartureImpl)) || (!(o2 instanceof DepartureImpl))){
    return 0;
  }
  Departure d1 = (Departure) o1;
  Departure d2 = (Departure) o2;
  
  if(d1.getDepartureTime() < d2.getDepartureTime()) return -1;
  if(d1.getDepartureTime() == d2.getDepartureTime()) return 0;
  return 1;
}

org.matsim.pt.transitSchedule.apiDeparture

Javadoc

Describes a single departure along a route in a transit line.

Most used methods

  • setVehicleId
  • getDepartureTime
  • getVehicleId
  • getId

Popular classes and methods

  • getContentResolver (Context)
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)