本文整理汇总了Java中org.bushe.swing.event.EventServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Java EventServiceLocator类的具体用法?Java EventServiceLocator怎么用?Java EventServiceLocator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventServiceLocator类属于org.bushe.swing.event包,在下文中一共展示了EventServiceLocator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGlobalContext
import org.bushe.swing.event.EventServiceLocator; //导入依赖的package包/类
public static GlobalContext getGlobalContext() {
if (_gctx == null) {
_gctx = new GlobalContext();
try {
EventServiceLocator.setEventService(EventServiceLocator.SERVICE_NAME_EVENT_BUS, eventService);
} catch (EventServiceExistsException e) {
logger.error("Error setting event service, likely something using the event bus before GlobalContext is instantiated",e);
}
}
return _gctx;
}
示例2: EvolvedReservoir
import org.bushe.swing.event.EventServiceLocator; //导入依赖的package包/类
public EvolvedReservoir(){
int samples = 300;
//Create input samples
this.analog = SignalGenerator.sine(300, samples, (1.0/2.0), (1.0/4.0), 0, (1.0/2.0));
//Convert to spike trains
this.hsa = new HSA(analog);
hsa.optimize(10, .1, 0, 1, .2);
this.dataset = hsa.encode();
/*
* Lower number increase frequency..but not amplitude
*/
IFSpikingNeuron.MEMORY_CAPACITY_COEF = 3.2;
/*
* Having a 0 refactory period causes an extremely slow system
*/
IFSpikingNeuron.REFACTORY_PEROID = 0;
System.setProperty("org.bushe.swing.event.eventBusClass", "org.bushe.swing.event.DiscreteTimeThreadSafeEventService");
try {
EventServiceLocator.setEventService("DiscreteTimeThreadSafeEventService", new DiscreteTimeThreadSafeEventService());
} catch (EventServiceExistsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}