Beispiel #1
0
        internal void Add(JMbr e)
        {
            int len = elements.Length;

            if (count >= len)
            {
                JMbr[] alloc = new JMbr[len * 4];
                Array.Copy(elements, 0, alloc, 0, len);
                elements = alloc;
            }
            elements[count++] = e;
        }
Beispiel #2
0
 public void Write <R>(IDataOutput <R> o) where R : IDataOutput <R>
 {
     for (int i = 0; i < count; i++)
     {
         JMbr  mbr = elements[i];
         JType t   = mbr.type;
         if (t == JType.Array)
         {
             o.Put(null, (JArr)mbr);
         }
         else if (t == JType.Object)
         {
             o.Put(null, (JObj)mbr);
         }
         else if (t == JType.String)
         {
             o.Put(null, (string)mbr);
         }
         else if (t == JType.Number)
         {
             o.Put(null, (JNumber)mbr);
         }
         else if (t == JType.True)
         {
             o.Put(null, true);
         }
         else if (t == JType.False)
         {
             o.Put(null, false);
         }
         else if (t == JType.Null)
         {
             o.PutNull(null);
         }
     }
 }