Full Library / Math Operator / Math and Trig / AddSubtract
Block Name: AddSubtract
Code File Location: VisualSim/actor/lib/AddSubtract
The plus input port will typically resolve to the least upper bound of the types presented to it. Thus, for example, if one input channel comes from a source of type BooleanToken and another comes from a source of type IntToken, the resolved type will be StringToken, and addition will be that implemented in StringToken (which concatenates strings). Notice that StringToken does not support subtraction, so if any inputs are presented to the minus port, an exception will be thrown at run time.
Currently, the type system is quite liberal about the resolved types it will permit at the inputs. In particular, it may permit the plus and minus inputs to resolve to types that cannot in fact be subtracted. In these cases, a run-time error will occur. In the future, we hope that the type system will intercept such errors before run time.
This actor does not require that each input channel have a token upon firing. It will add or subtract available tokens at the inputs and ignore the channels that do not have tokens. It consumes at most one input token from each port. If no input tokens are available at all, then no output is produced.
Field Detail |
public TypedIOPort minus
public TypedIOPort output
public TypedIOPort plus
Created with the Personal Edition of HelpNDoc: Create HTML Help, DOC, PDF and print manuals from 1 single source