Пример #1
0
        private int getHashCode(CharSequence text)
        {
            int code;

            if (_ignoreCase)
            {
                code = 0;
                int len = text.length();
                for (int i = 0; i < len; i++)
                {
                    code = code * 31 + Character.toLowerCase(text.charAt(i));
                }
            }
            else
            {
#pragma warning disable 184
                if (false && text is string)
#pragma warning restore 184
                {
                    code = text.GetHashCode();
                }
                else
                {
                    code = 0;
                    int len = text.length();
                    for (int i = 0; i < len; i++)
                    {
                        code = code * 31 + text.charAt(i);
                    }
                }
            }
            return(code);
        }
Пример #2
0
        private bool equals(CharSequence text1, char[] text2)
        {
            int len = text1.length();

            if (len != text2.Length)
            {
                return(false);
            }
            if (_ignoreCase)
            {
                for (int i = 0; i < len; i++)
                {
                    if (Character.toLowerCase(text1.charAt(i)) != text2[i])
                    {
                        return(false);
                    }
                }
            }
            else
            {
                for (int i = 0; i < len; i++)
                {
                    if (text1.charAt(i) != text2[i])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #3
0
 internal CharSequenceAdapter(java.lang.CharSequence chseq)
 {
     base.@this(chseq.length());
     sequence = chseq;
 }