示例#1
0
        /**
         * A static factory method to create a new Net2AnyChannel object
         *
         * @param poisonImmunity
         *            The immunity level of the channel
         * @param filter
         *            The filter used to convert an incoming byte array into an object
         * @return A new Net2AnyChannel
         * @//throws JCSPNetworkException
         *             Thrown if there is a problem creating the underlying channel
         */
        internal static Net2AnyChannel create(int poisonImmunity, NetworkMessageFilter.FilterRx filter)
        ////throws JCSPNetworkException
        {
            // Create the underlying channel
            Net2OneChannel chan = Net2OneChannel.create(poisonImmunity, filter);

            // Return a new instance of this object
            return(new Net2AnyChannel(chan));
        }
示例#2
0
        /**
         * Static factory method for creating a new instance of Net2AnyChannel, given a particular index
         *
         * @param index
         *            The index to create the channel with
         * @param poisonImmunity
         *            the immunity level of the channels
         * @param filter
         *            The filter used to convert the byte array back into an object
         * @return A new Net2AnyChannel
         * @//throws ArgumentException
         *             Thrown if a channel with the given index already exists
         * @//throws JCSPNetworkException
         *             Thrown if something goes wrong during the creation of the underlying channel
         */
        internal static Net2AnyChannel create(int index, int poisonImmunity, NetworkMessageFilter.FilterRx filter)
        {
            // Create the underlying channel
            Net2OneChannel chan = null;

            try
            {
                chan = Net2OneChannel.create(index, poisonImmunity, filter);
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e);
            }
            catch (JCSPNetworkException e)
            {
                Console.WriteLine(e);
            }
            // Return a new instance of Net2AnyChannel
            return(new Net2AnyChannel(chan));
        }
示例#3
0
 /**
  * Creates a new NetAltingChannelInput
  *
  * @return A new NetAltingChannelInput
  */
 public NetAltingChannelInput net2one()
 {
     return(Net2OneChannel.create(Int32.MaxValue, new ObjectNetworkMessageFilter.FilterRX()));
 }
示例#4
0
 /**
  * Constructor for Net2AnyChannel
  *
  * @param chan
  *            The underlying channel that this object will wrap around
  */
 private Net2AnyChannel(Net2OneChannel chan)
 {
     this.actualChannel = chan;
 }
示例#5
0
 /**
  * Creates a new NetAltingChannelInput with the given index and given poison immunity, which uses the given filter
  * to decode incoming messages
  *
  * @param index
  *            The index to create the channel with
  * @param immunityLevel
  *            The immunity to poison that the channel has
  * @param filter
  *            The filter used to decode incoming messages
  * @return A new NetAltingChannelInput
  * @//throws ArgumentException
  *             Thrown if a channel with the given index already exists
  */
 public NetAltingChannelInput numberedNet2One(int index, int immunityLevel, NetworkMessageFilter.FilterRx filter)
 ////throws ArgumentException
 {
     return(Net2OneChannel.create(index, immunityLevel, filter));
 }
示例#6
0
 /**
  * Creates a new NetAltingChannelInput with the given index that uses the given filter to decode incoming messages
  *
  * @param index
  *            The index to create the channel with
  * @param filter
  *            The filter used to decode incoming messages
  * @return A new NetAltingChannelInput
  * @//throws ArgumentException
  *             Thrown if a channel with the given index already exists
  */
 public NetAltingChannelInput numberedNet2One(int index, NetworkMessageFilter.FilterRx filter)
 ////throws ArgumentException
 {
     return(Net2OneChannel.create(index, Int32.MaxValue, filter));
 }
示例#7
0
 /**
  * Creates a new NetAltingChannelInput with the given poison immunity level which uses the given filter to decode
  * incoming messages
  *
  * @param immunityLevel
  *            The immunity level to poison for the created channel
  * @param filter
  *            The filter used to decode incoming messages
  * @return A new NetAltingChannelInput
  */
 public NetAltingChannelInput net2one(int immunityLevel, NetworkMessageFilter.FilterRx filter)
 {
     return(Net2OneChannel.create(immunityLevel, filter));
 }
示例#8
0
 /**
  * Creates a new NetAltingChannelInput which uses the given filter to decode incoming messages
  *
  * @param filter
  *            The filter used to decode incoming messages
  * @return A new NetAltingChannelInput
  */
 public NetAltingChannelInput net2one(NetworkMessageFilter.FilterRx filter)
 {
     return(Net2OneChannel.create(Int32.MaxValue, filter));
 }
示例#9
0
 /**
  * Creates a new NetAltingChannelInput with the given immunity level for poison
  *
  * @param immunityLevel
  *            The immunity level for poison
  * @return A new NetAltingChannelInput
  */
 public NetAltingChannelInput net2one(int immunityLevel)
 {
     return(Net2OneChannel.create(immunityLevel, new ObjectNetworkMessageFilter.FilterRX()));
 }