Class IntToBits

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

    public class IntToBits
    extends SDFConverter
    This actor converts an IntToken into a sequence of Boolean tokens. The number of Boolean tokens is specified by the numberOfBits parameter. It should be a positive integer not bigger than 32. The most significant bit (the sign bit) is the first boolean token send out. It is "false" if the input integer is non-negative, otherwise it is "true". The least significant bit is the last boolean token send out. Let k denotes the value of the numberOfBits parameter. An exception is thrown if the input integer is smaller than -2k or greater 2k - 1.
    Since:
    Ptolemy II 0.4
    Version:
    $Id$
    Author:
    Michael Leung
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Yellow (neuendor)
    • Field Detail

      • numberOfBits

        public Parameter numberOfBits
        The number of Boolean tokens that the input integer is converted to.
    • Method Detail

      • fire

        public final void fire()
                        throws IllegalActionException
        Consume a single IntToken on the input. Produce numberOfBits BooleanTokens on the output port which is the bitwise representation of the input IntToken. The most significant bit (the sign bit) is the first boolean token send out. The least significant bit is the last boolean token send out.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If there is no director. or if the input integer is out of range.