
Counter |
ptolemy.actor.lib.Counter |
This actor implements an up-down counter of received tokens. Whenever
a token is received from the increment input, the internal
counter is incremented. Whenever a token is received from the
decrement port, the internal counter is decremented. Whenever
a token is received from either input port, a token is created on the
output port with the integer value of the current count. At most one
token will be consumed from each input during each firing. If a token
is present on both input ports during any firing, then the increment
and the decrement will cancel out, and only one output token will be
produced.
Author(s): Steve Neuendorffer
Version:$Id: Counter.java,v 1.20 2005/10/28 19:20:13 cxh Exp $
Pt.Proposed Rating:Yellow (neuendor)
Pt.Accepted Rating:Yellow (neuendor)
increment
The increment port. If this input port
receives a token, then the counter is incremented. The port
has type general.
decrement
The decrement port. If this input port
receives a token, then the counter is decremented. The port
has type general.
output
The output port with type IntToken.