Package it.polito.appeal.traci

Examples of it.polito.appeal.traci.Phase


   
    Phase[] phases = logic.getPhases();
    assertEquals(8, phases.length);
   
    for (int i=0; i<phases.length; i++) {
      Phase ph = phases[i];
      assertEquals(PHASES_DURATION[i] * 1000, ph.getDuration());
      assertArrayEquals(PHASES[i], ph.getState().lightStates);
    }
  }
View Full Code Here


   
    Phase[] phases = logic.getPhases();
    assertEquals(8, phases.length);
   
    for (int i=0; i<phases.length; i++) {
      Phase ph = phases[i];
      assertEquals(PHASES_DURATION[i] * 1000, ph.getDuration());
      assertArrayEquals(PHASES[i], ph.getState().lightStates);
    }
  }
View Full Code Here

  @Test
  public void testChangingCompleteProgramDefinition() throws IOException {
    TrafficLight tl = repo.getByID("0");
   
    final Logic expectedLogic = new Logic("0", 0, new Phase[] {
      new Phase(10000, new TLState("rrGGyyyyggrryryr")),
      new Phase(15000, new TLState("GGyyrrrrrrGGrGrG")),
      new Phase(55000, new TLState("yyrrGGGGGGyyGyGy"))
    });
    tl.queryChangeCompleteProgramDefinition().setValue(expectedLogic);
    tl.queryChangeCompleteProgramDefinition().run();
   
    Program newProgram = tl.queryReadCompleteDefinition().get();
   
    assertEquals(1, newProgram.getLogics().length);
    Logic actualLogic = newProgram.getLogics()[0];

    assertEquals(
        expectedLogic.getSubID(),
        actualLogic.getSubID());
    assertEquals(
        expectedLogic.getCurrentPhaseIndex(),
        actualLogic.getCurrentPhaseIndex());

    Phase[] actualPhases = actualLogic.getPhases();
    Phase[] expectedPhases = expectedLogic.getPhases();
    assertEquals(expectedPhases.length, actualPhases.length);

    for (int i = 0; i < actualPhases.length; i++) {
      Phase actualPhase = actualPhases[i];
      Phase expectedPhase = expectedPhases[i];
      assertEquals(
          expectedPhase.getDuration(),
          actualPhase.getDuration());
      assertArrayEquals(
          expectedPhase.getState().lightStates,
          actualPhase.getState().lightStates);
    }
  }
View Full Code Here

TOP

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

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.