作者:知知亦不知_710 | 来源:互联网 | 2023-10-12 19:15
本文整理了Java中com.github.rinde.rinsim.event.EventAPI.removeListener()
方法的一些代码示例,展示了EventAPI.removeListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventAPI.removeListener()
方法的具体详情如下:
包路径:com.github.rinde.rinsim.event.EventAPI
类名称:EventAPI
方法名:removeListener
EventAPI.removeListener介绍
[英]Removes the specified listener with the specified event types. From now on, listener
will no longer be notified of new Event s with any of eventTypes
. If eventTypes
is empty the listener will be completely removed.
[中]删除具有指定事件类型的指定侦听器。从现在起,listener
将不再收到任何eventTypes
的新事件通知。如果eventTypes
为空,则侦听器将被完全删除。
代码示例
代码示例来源:origin: com.github.rinde/rinlog
ev.removeListener(currentListener, EventType.DONE);
代码示例来源:origin: com.github.rinde/rinlog
ev.removeListener(this, EventType.DONE);
exec = true;
代码示例来源:origin: rinde/RinSim
@Test
public void removeTest() {
final EventDispatcher disp = new EventDispatcher(EventTypes.values());
final EventAPI eventAPI = disp.getPublicEventAPI();
assertTrue(disp.listeners.isEmpty());
eventAPI.addListener(l1, EVENT1, EVENT2, EVENT3);
assertEquals(3, disp.listeners.size());
assertTrue(disp.listeners.containsEntry(EVENT1, l1));
assertTrue(eventAPI.containsListener(l1, EVENT1));
assertTrue(eventAPI.containsListener(l1, EVENT2));
assertTrue(eventAPI.containsListener(l1, EVENT3));
eventAPI.removeListener(l1);
assertTrue(disp.listeners.isEmpty());
assertFalse(eventAPI.containsListener(l1, EVENT1));
assertFalse(eventAPI.containsListener(l1, EVENT2));
assertFalse(eventAPI.containsListener(l1, EVENT3));
}
代码示例来源:origin: rinde/RinSim
assertFalse(dispatcher.containsListener(l3, OTHER_EVENT1));
api.removeListener(l3, new HashSet>());
assertFalse(dispatcher.containsListener(l3, EVENT1));
assertFalse(dispatcher.containsListener(l3, EVENT2));