* a future firing to produce it.
* @exception IllegalActionException If there is no director or can not
* schedule future firings to handle delayed input events.
*/
public boolean postfire() throws IllegalActionException {
Time currentTime = getDirector().getModelTime();
// Remove the current output token from _delayedTokens.
if (_currentOutput != null) {
_delayedOutputTokens.take();
}
// If the delayedInputTokensList is not empty and the
// delayedOutputTokens is empty (meaning the timer is ready to process
// a new input), get the first input in the delayedInputTokensList,
// put it into the delayedOutputTokens, and begin processing it.
// Schedule a refiring to produce the corresponding
// output at the time: current time + delay specified by the input
// being processed.
if ((_delayedInputTokensList.size() != 0)
&& _delayedOutputTokens.isEmpty()) {
// NOTE: the input has a fixed data type as double.
DoubleToken delayToken = (DoubleToken) _delayedInputTokensList
.removeFirst();
double delay = delayToken.doubleValue();
_nextTimeFree = currentTime.add(delay);
_delayedOutputTokens.put(new TimedEvent(_nextTimeFree, value
.getToken()));
getDirector().fireAt(this, _nextTimeFree);
}