상속: NativeInstanceObject
예제 #1
0
 public virtual void Clear(ArrayNI ni)
 {
     // clear members
     int count = ni.mItems.Count;
     for (int i = 0; i < count; i++)
     {
         Variant v = ni.mItems[i];
         v.Clear();
     }
     ni.mItems.Clear();
 }
예제 #2
0
 public virtual int Remove(ArrayNI ni, Variant @ref, bool removeall)
 {
     int count = 0;
     IntVector todelete = new IntVector();
     int arrayCount = ni.mItems.Count;
     for (int i = 0; i < arrayCount; i++)
     {
         Variant v = ni.mItems[i];
         if (@ref.DiscernCompareInternal(v))
         {
             count++;
             todelete.Add(i);
             if (!removeall)
             {
                 break;
             }
         }
     }
     // list objects up
     int delCount = todelete.Size();
     for (int i_1 = 0; i_1 < delCount; i_1++)
     {
         int pos = todelete.Get(i_1);
         Variant v = ni.mItems[pos];
         v.Clear();
     }
     // remove items found
     for (int i_2 = delCount - 1; i_2 >= 0; i_2--)
     {
         ni.mItems.Remove(todelete.Get(i_2));
     }
     todelete = null;
     return count;
 }
예제 #3
0
 public virtual void Add(ArrayNI ni, Variant val)
 {
     ni.mItems.AddItem(new Variant(val));
 }
예제 #4
0
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void Insert(ArrayNI ni, Variant[] val, int num)
 {
     if (num < 0)
     {
         num += ni.mItems.Count;
     }
     if (num < 0)
     {
         throw new TJSException(Error.RangeError);
     }
     int count = ni.mItems.Count;
     if (num > count)
     {
         throw new TJSException(Error.RangeError);
     }
     int end = val.Length;
     ni.mItems.EnsureCapacity(count + end);
     for (int i = 0; i < end; i++)
     {
         ni.mItems.Add(num + i, new Variant(val[i]));
     }
 }
예제 #5
0
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void Insert(ArrayNI ni, Variant val, int num)
 {
     if (num < 0)
     {
         num += ni.mItems.Count;
     }
     if (num < 0)
     {
         throw new TJSException(Error.RangeError);
     }
     int count = ni.mItems.Count;
     if (num > count)
     {
         throw new TJSException(Error.RangeError);
     }
     ni.mItems.Add(num, new Variant(val));
 }
예제 #6
0
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public virtual void Erase(ArrayNI ni, int num)
 {
     if (num < 0)
     {
         num += ni.mItems.Count;
     }
     if (num < 0)
     {
         throw new TJSException(Error.RangeError);
     }
     if (num >= ni.mItems.Count)
     {
         throw new TJSException(Error.RangeError);
     }
     ni.mItems.Remove(num);
 }