Class DDEIOPort

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

    public class DDEIOPort
    extends TypedIOPort
    A DDEIOPort is a timed input/output port used in the DDE domain. DDEIOPorts are used to send tokens between actors, and in so doing, associate time with the tokens as they are placed in DDEReceivers.

    DDEIOPorts are not necessary to facilitate communication between actors executing in a DDE model; standard TypedIOPorts are sufficient for most communication. DDEIOPorts become useful when the time stamp to be associated with an outgoing token is greater than the current time of the sending actor.

    The designers of models that incorporate DDEIOPorts should be careful to make sure that output time stamp ordering information is correct. Since the output time stamp of a token being sent through a DDEIOPort can be greater then the sending actor's current time, it is possible on a subsequent token production to create an outgoing token with a time stamp that is greater than the current time but less then the previously produced time stamp. In such cases, an IllegalArgumentException will be thrown.

    Since:
    Ptolemy II 0.3
    Version:
    $Id$
    Author:
    John S. Davis II
    See Also:
    DDEReceiver
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (davisj)
    • Constructor Detail

      • DDEIOPort

        public DDEIOPort()
        Construct a DDEIOPort with no container and an empty string as a name. The constructed port will be neither an input nor an output.
      • DDEIOPort

        public DDEIOPort​(ComponentEntity container,
                         java.lang.String name)
                  throws IllegalActionException,
                         NameDuplicationException
        Construct a DDEIOPort with a containing actor and the specified name that is neither an input nor an output. The specified container must implement the Actor interface, or an exception will be thrown.
        Parameters:
        container - The container actor.
        name - The name of the port.
        Throws:
        IllegalActionException - If the port is not of an acceptable class for the container, or if the container does not implement the Actor interface, or if the container is not atomic.
        NameDuplicationException - If the name coincides with a port already in the container.
      • DDEIOPort

        public DDEIOPort​(ComponentEntity container,
                         java.lang.String name,
                         boolean isInput,
                         boolean isOutput)
                  throws IllegalActionException,
                         NameDuplicationException
        Construct a DDEIOPort with a container and the specified name that is either an input, an output, or both, depending on the third and fourth arguments. The specified container must implement the Actor interface or an exception will be thrown.
        Parameters:
        container - The container actor.
        name - The name of the port.
        isInput - True if this is to be an input port.
        isOutput - True if this is to be an output port.
        Throws:
        IllegalActionException - If the port is not of an acceptable class for the container, or if the container does not implement the Actor interface. , or if the container is not atomic.
        NameDuplicationException - If the name coincides with a port already in the container.
    • Method Detail

      • broadcast

        public void broadcast​(Token token,
                              Time sendTime)
                       throws IllegalActionException,
                              NoRoomException
        Send a token to all connected receivers by calling send on all of the remote receivers connected to this port. If there are no connected receivers, then nothing is sent. Associate a time stamp with the token that is equivalent to the specified sendTime parameter. Throw an IllegalActionException if the port is not an output. Throw a NoRoomException if one of the channels throws it.
        Parameters:
        token - The token to send
        sendTime - The output time of the token being sent.
        Throws:
        IllegalActionException - If the port is not an output or the delay is negative.
        NoRoomException - If a send to one of the channels throws it.
      • send

        public void send​(int chIndex,
                         Token token,
                         Time sendTime)
                  throws IllegalActionException,
                         NoRoomException
        Send the specified token to all receivers connected to the specified channel. The first receiver gets the actual token, while subsequent receivers get a clone. If there are no receivers, then do nothing. Associate a time stamp with the token that is equivalent to the specified sendTime parameter. Throw an IllegalActionException if the port is not an output. Throw a NoRoomException if one of the channels throws it.
        Parameters:
        chIndex - The index of the channel, between (inclusive) 0 to width-1.
        token - The token to send.
        sendTime - The output time of the token being sent.
        Throws:
        NoRoomException - If there is no room in the receiver.
        IllegalActionException - If the port is not an output, if the index is out of range.