A line coder, which converts a sequence of booleans into symbols.
Edward A. Lee, Steve Neuendorffer
$Id: LineCoder.java 70398 2014-10-22 23:44:32Z cxh $
Ptolemy II 0.2
Green (eal)
Yellow (cxh)
The code table. Its value is a token of type ArrayToken.
The array provides the symbol values to produce on the output.
The number of values in this array must be at least
2<sup><i>wordLength</i></sup>, or an exception
will be thrown. The number of tokens consumed by this actor when
it fires is log<sub>2</sub>(<i>tableSize</i>), where
<i>tableSize</i> is the length of the table. If all of these
values are <i>false</i>, then the first array entry is produced
as an output. If only the first one is true, then then second
array value is produced. In general, the <i>N</i> inputs consumed
are taken to be a binary digit that indexes the array,
where the first input is taken to be the low-order bit of the array.
The default code table has two entries, -1.0
and 1.0, so that input <i>false</i> values are mapped to -1.0,
and input <i>true</i> values are mapped to +1.0.
The word length is the number of boolean inputs that are consumed
to construct an index into the table. Its value is an IntToken,
with default value one.