Full Library / Defining_Flow / Switching / OrderedMerge
Block Name: 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.
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.
- Version:
- $Id: OrderedMerge.java,v 1.6 2003/01/08 01:22:19
inputA
public TypedIOPort inputA
- The first input port, which accepts any scalar token.
inputB
public TypedIOPort inputB
- The second input port, which accepts any scalar token with the same type as the first input port.
output
public TypedIOPort output
- The output port, which has the same type as the input ports.
recordedToken
private ScalarToken recordedToken
nextPort
private TypedIOPort nextPort
- The port from which to read next.
tentativeRecordedToken
private ScalarToken tentativeRecordedToken
- The tentative recorded token.
tentativeNextPort
private TypedIOPort tentativeNextPort
- The tentative port from which to read next.
Created with the Personal Edition of HelpNDoc: Produce online help for Qt applications