Package it.polito.appeal.traci

Examples of it.polito.appeal.traci.Vehicle


   * @throws IOException
   */
  @Test
  public void testChangeTarget() throws IOException {
    getFirstVehicle();
    Vehicle v = firstVehicle;

    Edge endEdge = conn.getEdgeRepository().getByID("end");
    v.changeTarget(endEdge);
   
    Edge lastEdge = null;
    while (conn.getVehicleRepository().getByID(v.getID()) != null) {
      lastEdge = v.getCurrentEdge();
      assertFalse(lastEdge.getID().equals("rend"));

      conn.nextSimStep();
    }
  }
View Full Code Here


   * @throws IOException
   */
  @Test
  public void testChangeTargetAlsoAffectsRouteList() throws IOException {
    getFirstVehicle();
    Vehicle v = firstVehicle;
    Edge endEdge = conn.getEdgeRepository().getByID("end");
    v.changeTarget(endEdge);
    List<Edge> route = v.getCurrentRoute();
    assertEquals("end", route.get(route.size()-1).getID());
  }
View Full Code Here

   * @throws IOException
   */
  @Test
  public void testChangeRoute() throws IOException {
    getFirstVehicle();
    Vehicle v = firstVehicle;
    List<Edge> newRoute = new ArrayList<Edge>();
    newRoute.add(conn.getEdgeRepository().getByID("beg"));
    newRoute.add(conn.getEdgeRepository().getByID("beg2left"));
    newRoute.add(conn.getEdgeRepository().getByID("left"));
    newRoute.add(conn.getEdgeRepository().getByID("left2end"));
    v.changeRoute(newRoute);
    assertEquals(newRoute, v.getCurrentRoute());
  }
View Full Code Here

      conn.nextSimStep();
      conn.nextSimStep();
     
      Collection<Vehicle> vehicles = conn.getVehicleRepository().getAll().values();

      Vehicle aVehicle = vehicles.iterator().next();
     
      System.out.println("Vehicle " + aVehicle
          + " will traverse these edges: "
          + aVehicle.getCurrentRoute());
     
      conn.close();
    }
    catch(Exception e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of it.polito.appeal.traci.Vehicle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.