Java Code Examples for sun.util.locale.provider.CalendarDataUtility#retrieveFirstDayOfWeek()

The following examples show how to use sun.util.locale.provider.CalendarDataUtility#retrieveFirstDayOfWeek() . 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: Calendar.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 2
Source File: Calendar.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 3
Source File: Calendar.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 4
Source File: Calendar.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 5
Source File: Calendar.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 6
Source File: Calendar.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 7
Source File: Calendar.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 8
Source File: Calendar.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 9
Source File: Calendar.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 10
Source File: Calendar.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 11
Source File: Calendar.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 12
Source File: Calendar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 13
Source File: Calendar.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 14
Source File: Calendar.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 15
Source File: Calendar.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 16
Source File: Calendar.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 17
Source File: Calendar.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
 * They are used to figure out the week count for a specific date for
 * a given locale. These must be set when a Calendar is constructed.
 * @param desiredLocale the given locale.
 */
private void setWeekCountData(Locale desiredLocale)
{
    /* try to get the Locale data from the cache */
    int[] data = cachedLocaleData.get(desiredLocale);
    if (data == null) {  /* cache miss */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
Example 18
Source File: WeekFields.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Obtains an instance of {@code WeekFields} appropriate for a locale.
 * <p>
 * This will look up appropriate values from the provider of localization data.
 * If the locale contains "fw" (First day of week) and/or "rg"
 * (Region Override) <a href="../../util/Locale.html#def_locale_extension">
 * Unicode extensions</a>, returned instance will reflect the values specified with
 * those extensions. If both "fw" and "rg" are specified, the value from
 * the "fw" extension supersedes the implicit one from the "rg" extension.
 *
 * @param locale  the locale to use, not null
 * @return the week-definition, not null
 */
public static WeekFields of(Locale locale) {
    Objects.requireNonNull(locale, "locale");

    int calDow = CalendarDataUtility.retrieveFirstDayOfWeek(locale);
    DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1);
    int minDays = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(locale);
    return WeekFields.of(dow, minDays);
}