예제 #1
0
 public CharArray(CharArray array)
 {
     this.ordered = array.ordered;
     length       = array.length;
     items        = new char[length];
     JavaSystem.Arraycopy(array.items, 0, items, 0, length);
 }
예제 #2
0
        public override bool Equals(object o)
        {
            if (o == this)
            {
                return(true);
            }
            if (!(o is CharArray))
            {
                return(false);
            }
            CharArray array = (CharArray)o;
            int       n     = length;

            if (n != array.length)
            {
                return(false);
            }
            for (int i = 0; i < n; i++)
            {
                if (items[i] != array.items[i])
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #3
0
 public void AddAll(CharArray array, int offset, int length)
 {
     if (offset + length > array.length)
     {
         throw new LSysException(
                   "offset + length must be <= length: " + offset + " + " + length + " <= " + array.length);
     }
     AddAll(array.items, offset, length);
 }
예제 #4
0
        public static CharArray Range(int start, int end)
        {
            CharArray array = new CharArray(end - start);

            for (int i = start; i < end; i++)
            {
                array.Add((char)i);
            }
            return(array);
        }
예제 #5
0
        public CharArray Where(QueryEvent <Character> test)
        {
            CharArray list = new CharArray();

            for (int i = 0; i < length; i++)
            {
                Character t = Character.ValueOf(Get(i));
                if (test.Hit(t))
                {
                    list.Add(t.CharValue());
                }
            }
            return(list);
        }
예제 #6
0
        public CharArray Splice(int begin, int end)
        {
            CharArray longs = new CharArray(Slice(begin, end));

            if (end - begin >= length)
            {
                items  = new char[0];
                length = 0;
                return(longs);
            }
            else
            {
                RemoveRange(begin, end - 1);
            }
            return(longs);
        }
예제 #7
0
        public bool RemoveAll(CharArray array)
        {
            int length      = this.length;
            int startlength = length;

            char[] items = this.items;
            for (int i = 0, n = array.length; i < n; i++)
            {
                int item = array.Get(i);
                for (int ii = 0; ii < length; ii++)
                {
                    if (item == items[ii])
                    {
                        RemoveIndex(ii);
                        length--;
                        break;
                    }
                }
            }
            return(length != startlength);
        }
예제 #8
0
 public CharArray Concat(CharArray o)
 {
     return(new CharArray(Concat(this.items, this.length, o.items, o.length)));
 }
예제 #9
0
 public void AddAll(CharArray array)
 {
     AddAll(array, 0, array.length);
 }