protected int matchQuarterString(String text, int start, int field, String[] data, Calendar cal)
    {
        int i = 0;
        int count = data.length;

        // There may be multiple strings in the data[] array which begin with
        // the same prefix (e.g., Cerven and Cervenec (June and July) in Czech).
        // We keep track of the longest match, and return that.  Note that this
        // unfortunately requires us to test all array elements.
        int bestMatchLength = 0, bestMatch = -1;
        int matchLength = 0;
        for (; i<count; ++i) {
            int length = data[i].length();
            // Always compare if we have no match yet; otherwise only compare
            // against potentially better matches (longer strings).
            if (length > bestMatchLength &&
                (matchLength = regionMatchesWithOptionalDot(text, start, data[i], length)) >= 0) {

                bestMatch = i;
                bestMatchLength = matchLength;
            }
        }

        if (bestMatch >= 0) {
            cal.set(field, bestMatch * 3);
            return start + bestMatchLength;
        }

        return -start;
    }
protected int matchQuarterString ( String text , int start , int field , String [ ] data , Calendar cal ) { int i = 0 ; int count = data . length ; int bestMatchLength = 0 , bestMatch = - 1 ; int matchLength = 0 ; for ( ; i < count ; ++ i ) { int length = data [ i ] . length ( ) ; if ( length > bestMatchLength && ( matchLength = regionMatchesWithOptionalDot ( text , start , data [ i ] , length ) ) >= 0 ) { bestMatch = i ; bestMatchLength = matchLength ; } } if ( bestMatch >= 0 ) { cal . set ( field , bestMatch * 3 ) ; return start + bestMatchLength ; } return - start ; }
Attempt to match the text at a given position against an array of quarter
strings.  Since multiple strings in the array may match (for
example, if the array contains "a", "ab", and "abc", all will match
the input string "abcd") the longest match is returned.  As a side
effect, the given field of <code>cal</code> is set to the index
of the best match, if there is one.
@param text the time text being parsed.
@param start where to start parsing.
@param field the date field being parsed.
@param data the string array to parsed.
@return the new start position if matching succeeded; a negative
number indicating matching failure, otherwise.  As a side effect,
sets the <code>cal</code> field <code>field</code> to the index
of the best match, if matching succeeded.