
OrderedMerge |
ptolemy.actor.lib.OrderedMerge |
This actor merges two monotonically nondecreasing streams of tokens into
one monotonically nondecreasing stream. On each firing, it reads data from
one of the inputs. On the first firing, it simply records that token.
On the second firing, it reads data from the other input and outputs
the smaller of the recorded token and the one it just read. If they
are equal, then it outputs the recorded token. It then
records the larger token. On each subsequent firing, it reads a token
from the input port that did not provide the recorded token, and produces
at the output the smaller of the recorded token and the one just read.
Each time it produces an output token, it also produces
true on the selectedA output
if the output token came from inputA, and false
if it came from inputB.
If both input sequences are nondecreasing, then the output sequence
will be nondecreasing.
Note that if the inputs are not nondecreasing, then the output is
rather complex. The key is that in each firing, it produces the smaller
of the recorded token and the token it is currently reading.
Author(s): Edward A. Lee
Version:$Id: OrderedMerge.java,v 1.26 2005/10/28 19:20:13 cxh Exp $
Pt.Proposed Rating:Red (eal)
Pt.Accepted Rating:Red (eal)
inputA
The first input port, which accepts any scalar token.
inputB
The second input port, which accepts any scalar token with
the same type as the first input port.
output
The output port, which has the same type as the input ports.
selectedA
Output port indicating whether the output token came from
inputA.