Package org.jcsp.net2

Class Any2NetChannel<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private One2NetChannel chan
      The underlying One2NetChannel used by this channel.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Any2NetChannel​(One2NetChannel channel)
      Constructor wrapping an existing One2NetChannel in an Any2NetChannel
    • Field Detail

      • chan

        private final One2NetChannel chan
        The underlying One2NetChannel used by this channel. This class acts like a wrapper, protecting the underlying unshared connection.
    • Constructor Detail

      • Any2NetChannel

        private Any2NetChannel​(One2NetChannel channel)
        Constructor wrapping an existing One2NetChannel in an Any2NetChannel
        Parameters:
        channel - The One2NetChannel to be wrapped.
    • Method Detail

      • create

        static <T2> Any2NetChannel<T2> create​(NetChannelLocation loc,
                                              int immunity,
                                              NetworkMessageFilter.FilterTx filter)
                                       throws JCSPNetworkException
        Static factory method used to create an Any2NetChannel
        Parameters:
        loc - The location of the input channel end
        immunity - The immunity level of the channel
        filter - The filter used to convert the object being sent into bytes
        Returns:
        A new Any2NetChannel connected to the input end.
        Throws:
        JCSPNetworkException - Thrown if a connection to the Node cannot be made.
      • poison

        public void poison​(int strength)
        Poisons the underlying channel
        Specified by:
        poison in interface Poisonable
        Parameters:
        strength - The strength of the poison being put on the channel
      • getLocation

        public NetLocation getLocation()
        Gets the NetChannelLocation of the input end this channel is connected to.
        Specified by:
        getLocation in interface Networked
        Returns:
        The location of the input end that this output end is connected to.
      • destroy

        public void destroy()
        Removes the channel from the ChannelManager, and sets the state to DESTROYED
        Specified by:
        destroy in interface Networked