com.github.rinde.rinsim.event.Event.getIssuer()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中com.github.rinde.rinsim.event.Event.getIssuer()方法的一些代码示例,展示了Event.getIssuer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getIssuer()方法的具体详情如下:
包路径:com.github.rinde.rinsim.event.Event
类名称:Event
方法名:getIssuer

Event.getIssuer介绍

暂无

代码示例

代码示例来源:origin: rinde/RinSim

void doHandleEvent(Event e) {
 synchronized (computingSimSolvers) {
  final boolean isComputingBefore = isComputing();
  LOGGER.trace("receive: {}, computing: {}, clock is ticking: {}, {}", e,
   isComputingBefore, clock.isTicking(), computingSimSolvers);
  if (e.getEventType() == EventType.START_COMPUTING) {
   if (!isComputingBefore) {
    LOGGER.debug("start computing -> switch to real time");
    clock.switchToRealTime();
   }
   computingSimSolvers.add((RtSimSolverSchedulerBridge) e.getIssuer());
  } else if (e.getEventType() == EventType.DONE_COMPUTING) {
   // done computing
   checkState(computingSimSolvers.remove(e.getIssuer()));
   // if (!isComputing()) {
   // stop();
   // }
  } else {
   throw new IllegalArgumentException("Unexpected event: " + e);
  }
 }
}

代码示例来源:origin: rinde/RinSim

@Override
 public void handleEvent(Event event) {
  assertSame(event.toString(), modelRef, event.getIssuer());
 }
}, PDPModelEventType.values());

代码示例来源:origin: rinde/RinSim

@Test
public void followPathEventIssuerType() {
 final MovingRoadUser user = new TestRoadUser();
 model.addObjectAt(user, SW);
 final ListenerEventHistory list = new ListenerEventHistory();
 model.getEventAPI().addListener(list, RoadEventType.MOVE);
 assertTrue(list.getHistory().isEmpty());
 model.followPath(user, newLinkedList(asList(SW, SE, NE, NW)),
  TimeLapseFactory.create(0, 10));
 assertEquals(1, list.getHistory().size());
 assertEquals(RoadEventType.MOVE, list.getHistory().get(0).getEventType());
 assertEquals(model, list.getHistory().get(0).getIssuer());
}

代码示例来源:origin: rinde/RinSim

@Test
public void moveToEventIssuerType() {
 final MovingRoadUser user = new TestRoadUser();
 model.addObjectAt(user, SW);
 final ListenerEventHistory list = new ListenerEventHistory();
 model.getEventAPI().addListener(list, RoadEventType.MOVE);
 assertTrue(list.getHistory().isEmpty());
 model.moveTo(user, NW, TimeLapseFactory.create(0, 10));
 assertEquals(1, list.getHistory().size());
 assertEquals(RoadEventType.MOVE, list.getHistory().get(0).getEventType());
 assertEquals(model, list.getHistory().get(0).getIssuer());
}

相关文章