Class TestAbstractReceiver

  • All Implemented Interfaces:
    Receiver

    public class TestAbstractReceiver
    extends AbstractReceiver
    Test AbstractReceiver.
    Since:
    Ptolemy II 5.2
    Version:
    $Id$
    Author:
    Christopher Brooks
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Detail

      • TestAbstractReceiver

        public TestAbstractReceiver​(IOPort container)
                             throws IllegalActionException
        Construct an empty receiver with the specified container.
        Parameters:
        container - The container of the receiver.
        Throws:
        IllegalActionException - If the container does not accept this receiver.
    • Method Detail

      • hasRoom

        public boolean hasRoom()
        Return true if the receiver has room to put a token into it (via the put() method). Returning true in this method guarantees that the next call to put() will not result in an exception.
        Specified by:
        hasRoom in interface Receiver
        Specified by:
        hasRoom in class AbstractReceiver
        Returns:
        True
      • hasRoom

        public boolean hasRoom​(int numberOfTokens)
        Return true if the receiver has room to put the specified number of tokens into it (via the put() method). Returning true in this method guarantees that the next numberOfTokens calls to put() or a corresponding call to putArray() will not result in an exception.
        Specified by:
        hasRoom in interface Receiver
        Specified by:
        hasRoom in class AbstractReceiver
        Parameters:
        numberOfTokens - The number of tokens to put into this receiver.
        Returns:
        True
      • hasToken

        public boolean hasToken()
        Return true if the receiver contains a token that can be obtained by calling the get() method. In an implementation, returning true in this method guarantees that the next call to get() will not result in an exception.
        Specified by:
        hasToken in interface Receiver
        Specified by:
        hasToken in class AbstractReceiver
        Returns:
        True
      • hasToken

        public boolean hasToken​(int numberOfTokens)
        Return true if the receiver contains the specified number of tokens. In an implementation, returning true in this method guarantees that the next numberOfTokens calls to get(), or a corresponding call to getArray(), will not result in an exception.
        Specified by:
        hasToken in interface Receiver
        Specified by:
        hasToken in class AbstractReceiver
        Parameters:
        numberOfTokens - The number of tokens desired.
        Returns:
        True
      • isKnown

        public boolean isKnown()
        Return true. Most domains have no notion of the state of the receiver being unknown. It is always known whether there is a token available. Certain domains with fixed point semantics, however, such as SR, will need to override this method.
        Specified by:
        isKnown in interface Receiver
        Overrides:
        isKnown in class AbstractReceiver
        Returns:
        True.