Class PtidesBasicReceiver

    • Constructor Detail

      • PtidesBasicReceiver

        public PtidesBasicReceiver​(PtidesReceiver receiver)
                            throws IllegalActionException
        Construct a ptides basic receiver.
        Parameters:
        receiver - The ptolemy.domains.ptides.kernel.PtidesBasicReceiver that corresponds with this adapter.
        Throws:
        IllegalActionException - If throw by the superclass.
    • Method Detail

      • generateGetCode

        public java.lang.String generateGetCode​(java.lang.String offset)
                                         throws IllegalActionException
        Generate code for getting tokens from the receiver.
        Specified by:
        generateGetCode in class Receiver
        Parameters:
        offset - The offset in the array representation of the port.
        Returns:
        generate get code.
        Throws:
        IllegalActionException - If the receiver adapter is not found or it encounters an error while generating the get code.
      • generateHasTokenCode

        public java.lang.String generateHasTokenCode​(java.lang.String offset)
                                              throws IllegalActionException
        Generate code to check if the receiver has a token.
        Specified by:
        generateHasTokenCode in class Receiver
        Parameters:
        offset - The offset in the array representation of the port.
        Returns:
        generate hasToken code.
        Throws:
        IllegalActionException - If an error occurs when getting the receiver adapters or generating their initialize code.
      • generatePutCode

        public java.lang.String generatePutCode​(IOPort sourcePort,
                                                java.lang.String offset,
                                                java.lang.String token)
                                         throws IllegalActionException
        Generate code for putting tokens into the receiver.
        Specified by:
        generatePutCode in class Receiver
        Parameters:
        sourcePort - The port for which to generate the send code.
        offset - The offset in the array representation of the port.
        token - The token to be sent.
        Returns:
        generate type conversion as well as put code.
        Throws:
        IllegalActionException - If the receiver adapter is not found or it encounters an error while generating the send code.
      • _generateTypeConvertStatement

        protected java.lang.String _generateTypeConvertStatement​(ProgramCodeGeneratorAdapter.Channel source)
                                                          throws IllegalActionException
        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.