protected internal AbstractStringBuilder(StringJ s)
 {
     count = s.length();
     shared = false;
     value = new char[count + INITIAL_CAPACITY];
     s.getChars(0, count, value, 0);
 }
Esempio n. 2
0
        public bool regionMatches(int thisStart, StringJ other, int start, int length)
        {
            if (null == other)
            {
                throw new java.lang.NullPointerException();
            }
            if (start < 0 || other.count - start < length)
            {
                return(false);
            }
            if (thisStart < 0 || count - thisStart < length)
            {
                return(false);
            }
            if (length <= 0)
            {
                return(true);
            }
            int o1 = offset + thisStart, o2 = other.offset + start;

            for (int i = 0; i < length; ++i)
            {
                if (this.delegateInstance[o1 + i] != other.delegateInstance[o2 + i])
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 3
0
 protected internal AbstractStringBuilder(StringJ s)
 {
     count  = s.length();
     shared = false;
     value  = new char[count + INITIAL_CAPACITY];
     s.getChars(0, count, value, 0);
 }
Esempio n. 4
0
 protected internal void insert0(int index, CharSequence s, int start, int end)
 {
     if (s == null)
     {
         s = new StringJ("null"); //$NON-NLS-1$
     }
     if (index < 0 || index > count || start < 0 || end < 0 || start > end ||
         end > s.length())
     {
         throw new IndexOutOfBoundsException();
     }
     insert0(index, s.subSequence(start, end).toString());
 }
Esempio n. 5
0
        protected internal void append0(CharSequence s, int start, int end)
        {
            if (s == null)
            {
                s = new StringJ("null"); //$NON-NLS-1$
            }
            if (start < 0 || end < 0 || start > end || end > s.length())
            {
                throw new IndexOutOfBoundsException();
            }

            append0(s.subSequence(start, end).toString());
        }
Esempio n. 6
0
        /**
         * Converts the specified character to its string representation.
         *
         * @param value
         *            the character.
         * @return the character converted to a string.
         */
        public static String valueOf(char value)
        {
            StringJ s;

            if (value < 128)
            {
                s = new StringJ(value, 1, ascii);
            }
            else
            {
                s = new StringJ(0, 1, new char[] { value });
            }
            //s.hashCode = value; //TODO Check way to implement this...
            return(s.ToString());
        }
Esempio n. 7
0
        public bool regionMatches(bool ignoreCase, int thisStart, StringJ other, int start, int length)
        {
            if (!ignoreCase)
            {
                return(this.regionMatches(thisStart, other, start, length));
            }

            if (other != null)
            {
                if (thisStart < 0 || length > count - thisStart)
                {
                    return(false);
                }
                if (start < 0 || length > other.count - start)
                {
                    return(false);
                }

                thisStart += offset;
                start     += other.offset;
                int    end = thisStart + length;
                char   c1, c2;
                char[] target = other.delegateInstance.ToCharArray();
                while (thisStart < end)
                {
                    if ((c1 = other.delegateInstance[thisStart++]) != (c2 = target[start++]) &&
                        c1.ToString().ToUpper() != c2.ToString().ToUpper()
                        // Required for unicode that we test both cases
                        && c1.ToString().ToLower() != c2.ToString().ToLower())
                    {
                        return(false);
                    }
                }
                return(true);
            }
            throw new java.lang.NullPointerException();
        }
 protected internal void insert0(int index, CharSequence s, int start, int end)
 {
     if (s == null) {
         s = new StringJ("null"); //$NON-NLS-1$
     }
     if (index < 0 || index > count || start < 0 || end < 0 || start > end
             || end > s.length()) {
         throw new IndexOutOfBoundsException();
     }
     insert0(index, s.subSequence(start, end).toString());
 }
        protected internal void append0(CharSequence s, int start, int end)
        {
            if (s == null) {
                s = new StringJ("null"); //$NON-NLS-1$
            }
            if (start < 0 || end < 0 || start > end || end > s.length()) {
                throw new IndexOutOfBoundsException();
            }

            append0(s.subSequence(start, end).toString());
        }
Esempio n. 10
0
 public CharSequence subSequence(int start, int end)
 {
     StringJ cs = new StringJ(this.delegateInstance.Substring(start, end - start));
     return cs;
 }
Esempio n. 11
0
        public bool regionMatches(bool ignoreCase, int thisStart, StringJ other, int start, int length)
        {
            if (!ignoreCase) {
                return this.regionMatches(thisStart, other, start, length);
            }

            if (other != null) {
                if (thisStart < 0 || length > count - thisStart) {
                    return false;
                }
                if (start < 0 || length > other.count - start) {
                    return false;
                }

                thisStart += offset;
                start += other.offset;
                int end = thisStart + length;
                char c1, c2;
                char[] target = other.delegateInstance.ToCharArray();
                while (thisStart < end) {
                    if ((c1 = other.delegateInstance[thisStart++]) != (c2 = target[start++])
                            && c1.ToString().ToUpper() != c2.ToString().ToUpper()
                            // Required for unicode that we test both cases
                            && c1.ToString().ToLower() != c2.ToString().ToLower())
                    {
                        return false;
                    }
                }
                return true;
            }
            throw new NullPointerException();
        }
Esempio n. 12
0
 public bool regionMatches(int thisStart, StringJ other, int start, int length)
 {
     if (null == other) {
         throw new NullPointerException();
     }
     if (start < 0 || other.count - start < length) {
         return false;
     }
     if (thisStart < 0 || count - thisStart < length) {
         return false;
     }
     if (length <= 0) {
         return true;
     }
     int o1 = offset + thisStart, o2 = other.offset + start;
     for (int i = 0; i < length; ++i) {
         if (this.delegateInstance[o1 + i] != other.delegateInstance[o2 + i]) {
             return false;
         }
     }
     return true;
 }
Esempio n. 13
0
 /**
  * Converts the specified character to its string representation.
  *
  * @param value
  *            the character.
  * @return the character converted to a string.
  */
 public static String valueOf(char value)
 {
     StringJ s;
     if (value < 128)
     {
         s = new StringJ(value, 1, ascii);
     }
     else
     {
         s = new StringJ(0, 1, new char[] { value });
     }
     //s.hashCode = value; //TODO Check way to implement this...
     return s.ToString();
 }
Esempio n. 14
0
        public CharSequence subSequence(int start, int end)
        {
            StringJ cs = new StringJ(this.delegateInstance.Substring(start, end - start));

            return(cs);
        }
Esempio n. 15
0
 /*
  * Converts the specified boolean to its string representation.
  *
  * @param value
  *            the boolean to convert.
  * @return "true" if {@code value} is {@code true}, "false" otherwise.
  */
 public static String toString(bool value)
 {
     return(StringJ.valueOf(value));
 }
Esempio n. 16
0
        /*
         * Returns a string containing a concise, human-readable description of this
         * boolean.
         *
         * @return "true" if the value of this boolean is {@code true}, "false"
         *         otherwise.
         */

        public override String ToString()
        {
            return(StringJ.valueOf(value));
        }