public static int GetEncodeSize(Multiple <T> multiple)
 {
     if (multiple == null)
     {
         return(1);
     }
     if ([email protected] != 1)
     {
         return(ArrayEncoding.GetEncodeSize <T>([email protected]()));
     }
     return(AmqpEncoding.GetObjectEncodeSize(multiple.@value[0]));
 }
 public static void Encode(Multiple <T> multiple, ByteBuffer buffer)
 {
     if (multiple == null)
     {
         AmqpEncoding.EncodeNull(buffer);
         return;
     }
     if ([email protected] != 1)
     {
         ArrayEncoding.Encode <T>([email protected](), buffer);
         return;
     }
     AmqpEncoding.EncodeObject(multiple.@value[0], buffer);
 }
Exemple #3
0
 public static void Encode(Multiple <T> multiple, ByteBuffer buffer)
 {
     if (multiple == null)
     {
         AmqpEncoding.EncodeNull(buffer);
     }
     else if (multiple.value.Count == 1)
     {
         AmqpEncoding.EncodeObject(multiple.value[0], buffer);
     }
     else
     {
         ArrayEncoding.Encode(multiple.value.ToArray(), buffer);
     }
 }
Exemple #4
0
 public static int GetEncodeSize(Multiple <T> multiple)
 {
     if (multiple == null)
     {
         return(FixedWidth.NullEncoded);
     }
     else if (multiple.value.Count == 1)
     {
         return(AmqpEncoding.GetObjectEncodeSize(multiple.value[0]));
     }
     else
     {
         return(ArrayEncoding.GetEncodeSize(multiple.value.ToArray()));
     }
 }
        public static IList <T> Intersect(Multiple <T> multiple1, Multiple <T> multiple2)
        {
            List <T> ts = new List <T>();

            if (multiple1 == null || multiple2 == null)
            {
                return(ts);
            }
            foreach (T t in multiple1.@value)
            {
                if ([email protected](t))
                {
                    continue;
                }
                ts.Add(t);
            }
            return(ts);
        }
Exemple #6
0
        public static IList <T> Intersect(Multiple <T> multiple1, Multiple <T> multiple2)
        {
            List <T> list = new List <T>();

            if (multiple1 == null || multiple2 == null)
            {
                return(list);
            }

            foreach (T t1 in multiple1.value)
            {
                if (multiple2.value.Contains(t1))
                {
                    list.Add(t1);
                }
            }

            return(list);
        }
        public static Multiple <T> Decode(ByteBuffer buffer)
        {
            object obj = AmqpEncoding.DecodeObject(buffer);

            if (obj == null)
            {
                return(null);
            }
            if (obj is T)
            {
                Multiple <T> multiple = new Multiple <T>();
                multiple.Add((T)obj);
                return(multiple);
            }
            if (!obj.GetType().IsArray)
            {
                throw new AmqpException(AmqpError.InvalidField);
            }
            return(new Multiple <T>((T[])obj));
        }
Exemple #8
0
        public static Multiple <T> Decode(ByteBuffer buffer)
        {
            object value = AmqpEncoding.DecodeObject(buffer);

            if (value == null)
            {
                return(null);
            }
            else if (value is T)
            {
                Multiple <T> multiple = new Multiple <T>();
                multiple.Add((T)value);
                return(multiple);
            }
            else if (value.GetType().IsArray)
            {
                Multiple <T> multiple = new Multiple <T>((T[])value);
                return(multiple);
            }
            else
            {
                throw new AmqpException(AmqpError.InvalidField);
            }
        }