Class DEReceiver

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class DEReceiver
    extends Receiver
    The adapter for DE receiver. This class generates the DE-specific methods for the director. Those methods are : get, hasToken, put It also deals with the type conversions. Note that for now the generated code is C Code. What we need to do later, is to call some non-languages-specific functions in here which are implemented in a specific C adapter.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    William Lucas, based on SDFReceiver.java by Jia Zou, Man-Kit Leung, Isaac Liu, Bert Rodiers
    Pt.AcceptedRating:
    Red (wlc)
    Pt.ProposedRating:
    Red (wlc)
    • Constructor Detail

    • Method Detail

      • generateGetCode

        public java.lang.String generateGetCode​(java.lang.String offset)
                                         throws IllegalActionException
        Generates code for getting tokens from the receiver.
        Specified by:
        generateGetCode in class Receiver
        Parameters:
        offset - The offset of the port.
        Returns:
        The generated get code.
        Throws:
        IllegalActionException - If thrown while getting the component, getting the adapter, getting the director or getting the port reference.
      • generateHasTokenCode

        public java.lang.String generateHasTokenCode​(java.lang.String offset)
                                              throws IllegalActionException
        Generates code to check the receiver has a token.
        Specified by:
        generateHasTokenCode in class Receiver
        Parameters:
        offset - The offset of the receiver, ignored in this base class.
        Returns:
        The generated hasToken code
        Throws:
        IllegalActionException - Not thrown in this base class.
      • generatePutCode

        public java.lang.String generatePutCode​(IOPort sourcePort,
                                                java.lang.String offset,
                                                java.lang.String token)
                                         throws IllegalActionException
        Generate code for putting tokens from the receiver.
        Specified by:
        generatePutCode in class Receiver
        Parameters:
        sourcePort - The source port.
        offset - The offset of the port.
        token - The token.
        Returns:
        The generated put code.
        Throws:
        IllegalActionException - If thrown while getting the component, getting the adapter, getting the director or getting the port reference.
      • _generateTypeConvertStatement

        protected java.lang.String _generateTypeConvertStatement​(ProgramCodeGeneratorAdapter.Channel source)
                                                          throws IllegalActionException
        Description copied from class: Receiver
        Generate the type conversion statement for the particular offset of the two given channels. This assumes that the offset is the same for both channel. Advancing the offset of one has to advance the offset of the other.
        Specified by:
        _generateTypeConvertStatement in class Receiver
        Parameters:
        source - The given source channel.
        Returns:
        The type convert statement for assigning the converted source variable to the sink variable with the given offset.
        Throws:
        IllegalActionException - If there is a problem getting the adapters for the ports or if the conversion cannot be handled.
      • _getDirectorForReceiver

        protected DEDirector _getDirectorForReceiver()
                                              throws IllegalActionException
        Each receiver is associated with a director, return that director.
        Overrides:
        _getDirectorForReceiver in class Receiver
        Returns:
        The director associated with this receiver.
        Throws:
        IllegalActionException - FIXME: this is not exactly correct. This is probably because the information of the receiver is in the director of the container?
      • _getExecutiveDirectorForReceiver

        protected DEDirector _getExecutiveDirectorForReceiver()
                                                       throws IllegalActionException
        Each receiver is associated with a component of some executive director.
        Returns:
        The executive director if the component associated with this receiver.
        Throws:
        IllegalActionException - If thrown while getting the adapter.