Package org.jcsp.net2

Class Net2OneChannel<T>

    • Field Detail

      • in

        private final AltingChannelInput in
        The input channel coming into the networked channel input object from Links or locally connected net channel outputs.
      • data

        private final ChannelData data
        The ChannelData structure representing this channel.
      • lastRead

        private NetworkMessage lastRead
        The lastRead ChannelMessage. Used during an extended read operation to allow the ACK message to be sent to the correct Node.
    • Constructor Detail

      • Net2OneChannel

        private Net2OneChannel​(AltingChannelInput input,
                               ChannelData chanData,
                               NetworkMessageFilter.FilterRx filter)
                        throws JCSPNetworkException
        Private constructor for creating a new instance of a Net2OneChannel. This is called by the create method to create the channel.
        Parameters:
        input - The input channel connecting to the networked channel.
        chanData - The ChannelData object representing the networked channel.
        filter - The filter used to convert the incoming byte array to an object
        Throws:
        JCSPNetworkException
    • Method Detail

      • create

        static <T2> Net2OneChannel<T2> create​(int poisonImmunity,
                                              NetworkMessageFilter.FilterRx filter)
        Static factory method used to create a new Net2OneChannel. Used internally within the architecture.
        Parameters:
        poisonImmunity - The immunity level of the channel
        filter - The filter on the channel used to convert read bytes into an object
        Returns:
        A new Net2OneChannel
      • create

        static <T2> Net2OneChannel<T2> create​(int index,
                                              int poisonImmunity,
                                              NetworkMessageFilter.FilterRx filter)
                                       throws java.lang.IllegalArgumentException
        Static factory method used to create a new Net2OneChannel with a given index. Used internally within the architecture
        Parameters:
        index - The index to create the channel with
        poisonImmunity - The immunity level of the channel
        filter - The filter used to take the incoming byte array and convert it into an object
        Returns:
        A new Net2OneChannel
        Throws:
        java.lang.IllegalArgumentException - Thrown if the index given is already allocated within the ChannelManager
      • getLocation

        public NetLocation getLocation()
        Returns the NetChannelLocation of the channel
        Returns:
        Location of this channel
      • destroy

        public void destroy()
        Destroys the underlying channel
      • getChannelData

        final ChannelData getChannelData()
        Gets the channel data object for this channel.
        Returns:
        The ChannelData for this Channel
      • setDecoder

        public void setDecoder​(NetworkMessageFilter.FilterRx decoder)
        Sets the underlying message filter
        Parameters:
        decoder - The message filter to use