/** Returns the index of the first occurrence of this one-character pattern * in the specified byte array, seen as an ISO-8859-1 string, * starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the byte array to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final byte[] array, final int from, final int to ) { final byte[] a = array; final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( ( a[ i ] & 0xFF ) == c ) return i; return -1; } else { while( ++i < to ) if ( asciiToLowerCase( (char)( a[ i ] & 0xFF ) ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified byte array, seen as an ISO-8859-1 string, * starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the byte array to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf(final byte[] array, final int from, final int to) { final byte[] a = array; final int c = pattern[0]; int i = from < 0 ? -1 : from - 1; if (caseSensitive) { while(++i < to) if ((a[i] & 0xFF) == c) return i; return -1; } else { while(++i < to) if (asciiToLowerCase((char)(a[i] & 0xFF)) == c) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified byte array, seen as an ISO-8859-1 string, * starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the byte array to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final byte[] array, final int from, final int to ) { final byte[] a = array; final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( ( a[ i ] & 0xFF ) == c ) return i; return -1; } else { while( ++i < to ) if ( asciiToLowerCase( (char)( a[ i ] & 0xFF ) ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character sequence, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param s the character sequence to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if the this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final CharSequence s, final int from, final int to ) { final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( s.charAt( i ) == c ) return i; return -1; } else if ( asciiCase ) { while( ++i < to ) if ( asciiToLowerCase( s.charAt( i ) ) == c ) return i; return -1; } else { while( ++i < to ) if ( unicodeToLowerCase( s.charAt( i ) ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character sequence, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param s the character sequence to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if the this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf(final CharSequence s, final int from, final int to) { final int c = pattern[0]; int i = from < 0 ? -1 : from - 1; if (caseSensitive) { while(++i < to) if (s.charAt(i) == c) return i; return -1; } else if (asciiCase) { while(++i < to) if (asciiToLowerCase(s.charAt(i)) == c) return i; return -1; } else { while(++i < to) if (unicodeToLowerCase(s.charAt(i)) == c) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character sequence, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param s the character sequence to look in. * @param from the index from which the search must start. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if the this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final CharSequence s, final int from, final int to ) { final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( s.charAt( i ) == c ) return i; return -1; } else if ( asciiCase ) { while( ++i < to ) if ( asciiToLowerCase( s.charAt( i ) ) == c ) return i; return -1; } else { while( ++i < to ) if ( unicodeToLowerCase( s.charAt( i ) ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character array, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the character array to look in. * @param from the index from which the search must start. * @param to the index at which the search must end. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final char[] array, final int from, final int to ) { final char[] a = array; final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( a[ i ] == c ) return i; return -1; } else if ( asciiCase ) { while( ++i < to ) if ( asciiToLowerCase( a[ i ] ) == c ) return i; return -1; } else { while( ++i < to ) if ( unicodeToLowerCase( a[ i ] ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character array, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the character array to look in. * @param from the index from which the search must start. * @param to the index at which the search must end. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf( final char[] array, final int from, final int to ) { final char[] a = array; final int c = pattern[ 0 ]; int i = from < 0 ? -1 : from - 1; if ( caseSensitive ) { while( ++i < to ) if ( a[ i ] == c ) return i; return -1; } else if ( asciiCase ) { while( ++i < to ) if ( asciiToLowerCase( a[ i ] ) == c ) return i; return -1; } else { while( ++i < to ) if ( unicodeToLowerCase( a[ i ] ) == c ) return i; return -1; } }
/** Returns the index of the first occurrence of this one-character pattern * in the specified character array, starting at the specified index. * * <P>This method is a fallback for searches on one-character patterns. * * @param array the character array to look in. * @param from the index from which the search must start. * @param to the index at which the search must end. * @return the index of the first occurrence of this pattern or * <code>-1</code>, if this pattern never appears with index greater than * or equal to <code>from</code>. */ private int indexOf(final char[] array, final int from, final int to) { final char[] a = array; final int c = pattern[0]; int i = from < 0 ? -1 : from - 1; if (caseSensitive) { while(++i < to) if (a[i] == c) return i; return -1; } else if (asciiCase) { while(++i < to) if (asciiToLowerCase(a[i]) == c) return i; return -1; } else { while(++i < to) if (unicodeToLowerCase(a[i]) == c) return i; return -1; } }
/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern( final CharSequence pattern, final int flags ) { this.pattern = new char[ pattern.length() ]; MutableString.getChars( pattern, 0, this.pattern.length, this.pattern, 0 ); caseSensitive = ( flags & CASE_INSENSITIVE ) == 0; asciiCase = ( flags & UNICODE_CASE ) == 0; if ( ! caseSensitive ) { int i = this.pattern.length; if ( asciiCase ) while( i-- != 0 ) this.pattern[ i ] = asciiToLowerCase( this.pattern[ i ] ); else while( i-- != 0 ) this.pattern[ i ] = unicodeToLowerCase( this.pattern[ i ] ); } compile(); }
if ( asciiToLowerCase( s.charAt( i ) ) == last ) { j = n - 1; k = i; while( j-- != 0 && asciiToLowerCase( s.charAt( --k ) ) == p[ j ] ); if ( j < 0 ) return k; if ( ( c = asciiToLowerCase( s.charAt( ++i ) ) ) < 128 ) i += asciiShift[ c ]; else { j = shift[ c * c & m ]; while( j-- != 0 && asciiToLowerCase( s.charAt( i-- ) ) == p[ j ] ); if ( j < 0 ) return i + 1;
/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern(final CharSequence pattern, final int flags) { this.pattern = new char[pattern.length()]; MutableString.getChars(pattern, 0, this.pattern.length, this.pattern, 0); caseSensitive = (flags & CASE_INSENSITIVE) == 0; asciiCase = (flags & UNICODE_CASE) == 0; if (! caseSensitive) { int i = this.pattern.length; if (asciiCase) while(i-- != 0) this.pattern[i] = asciiToLowerCase(this.pattern[i]); else while(i-- != 0) this.pattern[i] = unicodeToLowerCase(this.pattern[i]); } compile(); }
/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern( final CharSequence pattern, final int flags ) { this.pattern = new char[ pattern.length() ]; MutableString.getChars( pattern, 0, this.pattern.length, this.pattern, 0 ); caseSensitive = ( flags & CASE_INSENSITIVE ) == 0; asciiCase = ( flags & UNICODE_CASE ) == 0; if ( ! caseSensitive ) { int i = this.pattern.length; if ( asciiCase ) while( i-- != 0 ) this.pattern[ i ] = asciiToLowerCase( this.pattern[ i ] ); else while( i-- != 0 ) this.pattern[ i ] = unicodeToLowerCase( this.pattern[ i ] ); } compile(); }
if (asciiToLowerCase(s.charAt(i)) == last) { j = n - 1; k = i; while(j-- != 0 && asciiToLowerCase(s.charAt(--k)) == p[j]); if (j < 0) return k; if ((c = asciiToLowerCase(s.charAt(++i))) < 128) i += asciiShift[c]; else { j = shift[c * c & m]; while(j-- != 0 && asciiToLowerCase(s.charAt(i--)) == p[j]); if (j < 0) return i + 1;
if ( asciiToLowerCase( s.charAt( i ) ) == last ) { j = n - 1; k = i; while( j-- != 0 && asciiToLowerCase( s.charAt( --k ) ) == p[ j ] ); if ( j < 0 ) return k; if ( ( c = asciiToLowerCase( s.charAt( ++i ) ) ) < 128 ) i += asciiShift[ c ]; else { j = shift[ c * c & m ]; while( j-- != 0 && asciiToLowerCase( s.charAt( i-- ) ) == p[ j ] ); if ( j < 0 ) return i + 1;
if ( asciiToLowerCase( a[ i ] ) == last ) { j = n - 1; k = i; while( j-- != 0 && asciiToLowerCase( a[ --k ] ) == p[ j ] ); if ( j < 0 ) return k; if ( ( c = asciiToLowerCase( a[ ++i ] ) ) < 128 ) i += asciiShift[ c ]; else { j = shift[ c * c & m ]; while( j-- != 0 && asciiToLowerCase( a[ i-- ] ) == p[ j ] ); if ( j < 0 ) return i + 1;
if ( asciiToLowerCase( (char)( a[ i ] & 0xFF ) ) == last ) { j = n - 1; k = i; while( j-- != 0 && asciiToLowerCase( (char)( a[ --k ] & 0xFF ) ) == p[ j ] ); if ( j < 0 ) return k; if ( ( c = asciiToLowerCase( (char)( a[ ++i ] & 0xFF ) ) ) < 128 ) i += asciiShift[ c ]; else { j = shift[ c * c & m ]; while( j-- != 0 && asciiToLowerCase( (char)( a[ i-- ] & 0xFF ) ) == p[ j ] ); if ( j < 0 ) return i + 1;
if (asciiToLowerCase((char)(a[i] & 0xFF)) == last) { j = n - 1; k = i; while(j-- != 0 && asciiToLowerCase((char)(a[--k] & 0xFF)) == p[j]); if (j < 0) return k; if ((c = asciiToLowerCase((char)(a[++i] & 0xFF))) < 128) i += asciiShift[c]; else { j = shift[c * c & m]; while(j-- != 0 && asciiToLowerCase((char)(a[i--] & 0xFF)) == p[j]); if (j < 0) return i + 1;
if ( asciiToLowerCase( list.getChar( i ) ) == last ) { j = n - 1; k = i; while( j-- != 0 && asciiToLowerCase( list.getChar( --k ) ) == p[ j ] ); if ( j < 0 ) return k; if ( ( c = asciiToLowerCase( list.getChar( ++i ) ) ) < 128 ) i += asciiShift[ c ]; else { j = shift[ c * c & m ]; while( j-- != 0 && asciiToLowerCase( list.getChar( i-- ) ) == p[ j ] ); if ( j < 0 ) return i + 1;
if (asciiToLowerCase(list.getChar(i)) == last) { j = n - 1; k = i; while(j-- != 0 && asciiToLowerCase(list.getChar(--k)) == p[j]); if (j < 0) return k; if ((c = asciiToLowerCase(list.getChar(++i))) < 128) i += asciiShift[c]; else { j = shift[c * c & m]; while(j-- != 0 && asciiToLowerCase(list.getChar(i--)) == p[j]); if (j < 0) return i + 1;