Class BitsToInt

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, SequenceActor, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class BitsToInt
    extends SDFConverter
    This actor converts a sequence of BooleanTokens into a single IntToken. The number of Boolean tokens is specified by the numberOfBits parameter and should be a positive integer not larger than 32. Let k denotes the value of the numberOfBits parameter. The output integer is ranged from -2k to 2k - 1. The first boolean token received indicates the sign of the integer. If it is "false", the output integer is a non-negative number. If it is "true", the output integer is a negative number. The least significant bit is the last boolean token received.
    Since:
    Ptolemy II 0.4
    Version:
    $Id$
    Author:
    Michael Leung
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Green (neuendor)
    • Field Detail

      • numberOfBits

        public Parameter numberOfBits
        The number of bits that is converted to the output integer. It should be a positive integer no more than 32.
    • Method Detail

      • fire

        public final void fire()
                        throws IllegalActionException
        Consume numberOfBits BooleanTokens on the input. Output a single IntToken which is representing by the BooleanTokens. The first token consumed is the most significant bit (The sign bit). The last token consumed is the least significant bit
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If there is no director.