コード例 #1
0
ファイル: TraCITest.java プロジェクト: p1tt1/TraCI4J
  /**
   * Returns the first vehicle entered in the simulation. Since all vehicles depart from the same
   * road, and SUMO lets at most one vehicle to depart from a given road at each step, the vehicle
   * returned from this function will always be the same.
   *
   * @throws IOException
   */
  public void getFirstVehicle() throws IOException {
    Repository<Vehicle> repo = conn.getVehicleRepository();
    while (repo.getAll().isEmpty()) conn.nextSimStep();

    firstVehicle = repo.getAll().values().iterator().next();
  }