Package org.jcsp.net2

Class One2NetChannel<T>

    • Field Detail

      • toLinkTx

        private final ChannelOutput toLinkTx
        The channel connecting to the Link that connects to the networked input end of this channel.
      • linkConnectedTo

        private final Link linkConnectedTo
        The actual Link this output channel sends on. We keep this as it allows us to register and unregister with the Link as we are created and destroyed, allowing the Link to inform the channel when a Link goes down.
      • localChannel

        private final ChannelData localChannel
        This is used if we are ever connected locally. We use this to check the state of a locally connected channel prior to sending a message.
      • theAckChannel

        private final AltingChannelInput theAckChannel
        The channel used to receive acknowledgements from the input end via the Link.
      • data

        private final ChannelData data
        A structure containing the information on the state of the channel.
      • remoteLocation

        private final NetChannelLocation remoteLocation
        The location that this channel is connected to (the input channel ends location)
      • localLocation

        private final NetChannelLocation localLocation
        The local channel end location
      • isLocal

        private final boolean isLocal
        Flag to determine if this is a locally connected channel or not
    • Constructor Detail

      • One2NetChannel

        private One2NetChannel​(AltingChannelInput ackChannel,
                               ChannelOutput toLink,
                               Link link,
                               ChannelData chanData,
                               NetChannelLocation loc,
                               int immunity,
                               NetworkMessageFilter.FilterTx filter)
        Private constructor for creating a One2NetChannel. This is called by the create method.
        Parameters:
        ackChannel - The channel used to receive acknowledgements from Links
        toLink - The channel used to send messages to the input end
        link - The Link that this channel is connected to
        chanData - The structure used to store the state of the channel
        loc - The location of the input end that this channel is connected to
        immunity - The poison immunity level of the channel
        filter - Filter used to encode outgoing messages
    • Method Detail

      • poison

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

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

        NetChannelLocation localLocation()
        Gets the local NetChannelLocation that represents this channel.
        Returns:
        The local location of the output end
      • getChannelData

        final ChannelData getChannelData()
        Gets the channel data state for this channel.
        Returns:
        ChannelData for this channel
      • destroy

        public void destroy()
        Destroys the channel and removes it from the ChannelManager.
        Specified by:
        destroy in interface Networked