Java Code Examples for java.util.Calendar#LONG

The following examples show how to use java.util.Calendar#LONG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleDateFormat.java    From j2objc with Apache License 2.0 5 votes vote down vote up
private int parseWeekday(String text, int start, int field, boolean useDateFormatSymbols,
                         boolean standalone, CalendarBuilder out) {
    int index = -1;
    if (useDateFormatSymbols) {
        // Want to be able to parse both short and long forms.
        // Try count == 4 (DDDD) first:
        if ((index=matchString(
                text, start, Calendar.DAY_OF_WEEK,
                standalone ? formatData.getStandAloneWeekdays() : formatData.getWeekdays(),
                out)) > 0) {
            return index;
        }

        // DDDD failed, now try DDD
        if ((index = matchString(
                text, start, Calendar.DAY_OF_WEEK,
                standalone ? formatData.getShortStandAloneWeekdays() : formatData.getShortWeekdays(),
                out)) > 0) {
            return index;
        }
    } else {
        int[] styles = { Calendar.LONG, Calendar.SHORT };
        for (int style : styles) {
            Map<String,Integer> map = calendar.getDisplayNames(field, style, locale);
            if ((index = matchString(text, start, field, map, out)) > 0) {
                return index;
            }
        }
    }

    return index;
}