/** * propogate the next signal from self to all instances. Callers must be synchronized on 'this' * object. */ public synchronized boolean propogateNextSignalSelf(Debug debugObject) throws LemRuntimeException { /* * First propogate any elapsed delayed signals to self * into the signalSelfQueue. */ while (delayedSignalSelfQueue.size() > 0) { DelayedSignal s; s = (DelayedSignal) delayedSignalSelfQueue.get(0); if (s.getDeliveryTime() <= context.getTimeObject().getTimeMs()) { delayedSignalSelfQueue.remove(s); addSignalSelf(s); } else break; } if (signalSelfQueue.size() > 0) { Signal s = (Signal) signalSelfQueue.remove(0); for (Iterator i = instances.iterator(); i.hasNext(); ) { Instance in = (Instance) i.next(); if (in.isActive) { in.addSignalSelf(s); debugObject.addEntity(); } } debugObject.delEntity(); return true; } return false; }
/** * propogate the next signal (not from self) to all instances. Callers must be synchronized on * 'this' object. */ public boolean propogateNextSignal(Debug debugObject) throws LemRuntimeException { if (signalQueue.size() > 0) { Signal s = (Signal) signalQueue.remove(0); for (Iterator i = instances.iterator(); i.hasNext(); ) { Instance in = (Instance) i.next(); if (in.isActive) { in.addSignal(s); debugObject.addEntity(); } } debugObject.delEntity(); return true; } return false; }