Output the average of the inputs after the last time a true token is received at the reset port. One output is produced each time the actor is fired. The inputs and outputs can be any token type that supports addition and division by an integer. The output type is constrained to be the same as the input type. Note that if the input is an integer, then the output is an integer, which may not be what you want. You may need to set the input and output ports to double to force the result to be a double.
Note that the type system will fail to catch some errors. Static type checking may result in a resolved type that does not support addition and division. In this case, a run-time error will occur.
@author Edward A. Lee, Jie Liu @version $Id: Average.java,v 1.48 2007/02/04 01:26:47 cxh Exp $ @since Ptolemy II 0.3 @Pt.ProposedRating Green (eal) @Pt.AcceptedRating Green (bilung)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|