.withAutoClose() .withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME);
.withAutoClose() .withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME);
view = view.withAutoClose() .withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME) .withAsync() .withAutoPlay() .withAutoClose();
viewBuilder = viewBuilder .withSpeedUp(TEST_SPEEDUP) .withAutoClose() .withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME);
.withSize(150)) .withAutoPlay() .withAutoClose() .withSimulatorEndTime(10000)) .build();
viewBuilder = viewBuilder.withAutoClose() .withSimulatorEndTime(TESTING_END_TIME) .withSpeedUp(TESTING_SPEEDUP);
viewBuilder = viewBuilder.withAutoClose() .withSimulatorEndTime(TESTING_END_TIME) .withSpeedUp(TESTING_SPEEDUP);
viewBuilder = viewBuilder.withAutoClose() .withAutoPlay() .withSpeedUp(TEST_SPEED_UP)
.with(TimeLinePanel.builder()) .withSpeedUp(200) .withAutoClose() .withSimulatorEndTime(1 * 60 * 1000) .withAutoPlay())
viewBuilder = viewBuilder.withAutoClose() .withAutoPlay() .withSpeedUp(TEST_SPEED_UP)
.with(PDPModelRenderer.builder()) .withSpeedUp(50) .withAutoClose() .withAutoPlay());
.withAutoClose() .withSimulatorEndTime(TEST_END_TIME) .withTitleAppendix("TESTING")
.withDestinationLines()) .withAutoPlay() .withAutoClose() .withSimulatorEndTime(5000)) .build();
view = view.withAutoClose() .withAutoPlay() .withSimulatorEndTime(TEST_STOP_TIME) .withAsync() .withAutoPlay() .withAutoClose();
public static void main(String[] args) throws IOException { for (int i = 0; i < 100; i++) { final FabriRechtScenario scenario = FabriRechtParser.fromJson(Files .toString(new File("files/test/fabri-recht/lc101.scenario"), Charsets.UTF_8), 8, 20); Simulator.builder() .addModel( ScenarioController.builder(scenario) .withEventHandler(AddVehicleEvent.class, new TimedEventHandler<AddVehicleEvent>() { @Override public void handleTimedEvent(AddVehicleEvent event, SimulatorAPI simulator) { simulator.register(new Truck(event.getVehicleDTO())); } })) .addModel( View.builder() .with(PlaneRoadModelRenderer.builder()) .with(RoadUserRenderer.builder()) .with(PDPModelRenderer.builder()) .withSpeedUp(50) .withAutoClose() .withAutoPlay()) .build().start(); } } }
.withAutoClose() .withSimulatorEndTime(TEST_END_TIME) .withTitleAppendix("TESTING")
/** * Test of {@link RoadUserRenderer}. */ @Test public void test() { final Simulator sim = Simulator.builder() .addModel(RoadModelBuilders.plane()) .addModel(View.builder() .with(PlaneRoadModelRenderer.builder()) .with(RoadUserRenderer.builder() .withColorAssociation(Agent1.class, new RGB(255, 0, 255)) .withColorAssociation(Agent2.class, new RGB(0, 0, 255)) .withColorAssociation(Agent3.class, new RGB(255, 200, 0)) .withCircleAroundObjects()) .withAutoPlay() .withAutoClose() .withSimulatorEndTime(10000)) .build(); for (int i = 0; i < 11; i++) { if (i != 5) { sim.register(new Agent1(new Point(i, i))); sim.register(new Agent3(new Point(i, 10 - i))); } } sim.register(new Agent2(new Point(5, 5))); sim.start(); }
/** * Test for {@link CommRenderer}. */ @Test public void testRenderer() { final RandomGenerator rng = new MersenneTwister(123L); final Simulator sim = Simulator.builder() .setRandomGenerator(rng) .addModel(CommModel.builder()) .addModel(RoadModelBuilders.plane()) .addModel( View.builder() .with(CommRenderer.builder() .withReliabilityColors(new RGB(0, 0, 255), new RGB(255, 255, 0)) .withReliabilityPercentage() .withMessageCount()) .with(PlaneRoadModelRenderer.builder()) .withAutoPlay() .withAutoClose() .withSpeedUp(10) .withSimulatorEndTime(1000 * 60 * 5)) .addModel(TestModel.Builder.create()) .build(); for (int i = 0; i < 20; i++) { sim.register(new CommAgent(rng, (i + 1) / 10d, i * (1d / 20d))); } sim.register(new CommAgent(rng, -1d, 1d)); sim.start(); }
/** * Test for ui with real time clock. */ @Test public void testRealtime() { final Simulator sim = Simulator.builder() .addModel(TimeModel.builder() .withRealTime() .withTickLength(100L)) .addModel(RoadModelBuilders.plane()) .addModel(View.builder() .withTitleAppendix("ViewTest") .withAutoClose() .withAutoPlay() .withSimulatorEndTime(1000) .with(PlaneRoadModelRenderer.builder()) .with(TestRenderer.builder())) .build(); sim.start(); }
/** * Simple GUI test. */ @Test public void testRenderer() { final Simulator sim = Simulator.builder() .addModel(RoadModelBuilders.plane()) .addModel(View.builder() .withTitleAppendix("ViewTest") .withAutoClose() .withAutoPlay() .withSimulatorEndTime(10000) .with(PlaneRoadModelRenderer.builder()) .with(TestRenderer.builder())) .build(); sim.start(); }