Package rinde.sim.event

Examples of rinde.sim.event.Listener


      }
    });

    // checks whether the events contain the decorated instance
    final PDPModel modelRef = model;
    model.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event event) {
        assertSame(event.toString(), modelRef, event.getIssuer());
      }
    }, PDPModelEventType.values());
View Full Code Here


    typeSet.addAll(asList(EventType.values()));
    disp = new EventDispatcher(typeSet);
    disp.addListener(new InternalTimedEventHandler(),
        scenario.getPossibleEventTypes());

    simulator.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        if (simulator.getCurrentTime() == 0) {
          dispatchSetupEvents();
        }
View Full Code Here

    // };

    final boolean[] r = new boolean[1];
    final int[] i = new int[1];

    controller.getEventAPI().addListener(new Listener() {

      @Override
      public void handleEvent(Event e) {
        if (e.getEventType() == ScenarioController.EventType.SCENARIO_STARTED) {
          r[0] = true;
View Full Code Here

        EVENT_A, EVENT_B, EVENT_C), -1);

    final boolean[] r = new boolean[1];
    final int[] i = new int[1];

    controller.getEventAPI().addListener(new Listener() {

      @Override
      public void handleEvent(Event e) {
        if (e.getEventType() == ScenarioController.EventType.SCENARIO_FINISHED) {
          synchronized (controller) {
View Full Code Here

        });
      }

      if (autoClose) {

        final Listener list = callback;

        simulator.getEventAPI().addListener(new Listener() {
          @Override
          public void handleEvent(final Event arg0) {
            if (!shell.isDisposed()) {
              disp.asyncExec(new Runnable() {
                @Override
                public void run() {
                  shell.close();
                }
              });
            }
            if (list != null) {
              list.handleEvent(arg0);
            }
          }
        }, Simulator.SimulatorEventType.STOPPED);
      }
View Full Code Here

    // we have arrived, but no time left to start pickup
    assertEquals(new Point(1, 2.0), rm.getPosition(d));
    assertEquals(d.gotoState, d.stateMachine.getCurrentState());

    // check that pickup occurs exactly at opening of time window
    pm.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        assertEquals(minute(5) + second(30), ((PDPModelEvent) e).time);
      }
    }, PDPModelEventType.START_PICKUP);
View Full Code Here

    tick(4, 5);
    assertEquals(new Point(1, 2.0), rm.getPosition(d));
    assertEquals(d.gotoState, d.stateMachine.getCurrentState());

    // check that pickup occurs exactly at opening of time window
    pm.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        assertEquals(minute(5) + second(30), ((PDPModelEvent) e).time);
      }
    }, PDPModelEventType.START_PICKUP);
View Full Code Here

    tick(4, 5);
    assertEquals(new Point(1, 1.99), rm.getPosition(d));
    assertEquals(d.waitForServiceState, d.stateMachine.getCurrentState());

    // check that pickup occurs exactly at opening of time window
    pm.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        assertEquals(minute(5) + second(30), ((PDPModelEvent) e).time);
      }
    }, PDPModelEventType.START_PICKUP);
View Full Code Here

  @Override
  public void registerModelProvider(ModelProvider mp) {
    final PDPModel pdp = mp.getModel(PDPModel.class);
    checkState(pdp != null, "PDPModel is required.");
    pdp.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        if (e.getEventType() == PDPModelEventType.NEW_PARCEL) {
          final PDPModelEvent event = (PDPModelEvent) e;
          timeline.addParcel(new ParcelInfo(event.time, event.parcel));
View Full Code Here

    }
    for (int i = 0; i < titles.length; i++) {
      eventList.getColumn(i).pack();
    }

    statsTracker.getEventAPI().addListener(new Listener() {
      @Override
      public void handleEvent(Event e) {
        final StatisticsEvent se = (StatisticsEvent) e;
        if (eventList.getDisplay().isDisposed()) {
          return;
View Full Code Here

TOP

Related Classes of rinde.sim.event.Listener

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.