src/share/classes/java/util/Calendar.java

Print this page
rev 4788 : Fix bunch of generics warnings


 823 
 824     /**
 825      * The first day of the week, with possible values <code>SUNDAY</code>,
 826      * <code>MONDAY</code>, etc.  This is a locale-dependent value.
 827      * @serial
 828      */
 829     private int             firstDayOfWeek;
 830 
 831     /**
 832      * The number of days required for the first week in a month or year,
 833      * with possible values from 1 to 7.  This is a locale-dependent value.
 834      * @serial
 835      */
 836     private int             minimalDaysInFirstWeek;
 837 
 838     /**
 839      * Cache to hold the firstDayOfWeek and minimalDaysInFirstWeek
 840      * of a Locale.
 841      */
 842     private static final ConcurrentMap<Locale, int[]> cachedLocaleData
 843         = new ConcurrentHashMap<Locale, int[]>(3);
 844 
 845     // Special values of stamp[]
 846     /**
 847      * The corresponding fields[] has no value.
 848      */
 849     private static final int        UNSET = 0;
 850 
 851     /**
 852      * The value of the corresponding fields[] has been calculated internally.
 853      */
 854     private static final int        COMPUTED = 1;
 855 
 856     /**
 857      * The value of the corresponding fields[] has been set externally. Stamp
 858      * values which are greater than 1 represents the (pseudo) time when the
 859      * corresponding fields[] value was set.
 860      */
 861     private static final int        MINIMUM_USER_STAMP = 2;
 862 
 863     /**


1482                 return shortNames;
1483             }
1484             Map<String,Integer> longNames = getDisplayNamesImpl(field, LONG, locale);
1485             if (shortNames == null) {
1486                 return longNames;
1487             }
1488             if (longNames != null) {
1489                 shortNames.putAll(longNames);
1490             }
1491             return shortNames;
1492         }
1493 
1494         // SHORT or LONG
1495         return getDisplayNamesImpl(field, style, locale);
1496     }
1497 
1498     private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
1499         DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
1500         String[] strings = getFieldStrings(field, style, symbols);
1501         if (strings != null) {
1502             Map<String,Integer> names = new HashMap<String,Integer>();
1503             for (int i = 0; i < strings.length; i++) {
1504                 if (strings[i].length() == 0) {
1505                     continue;
1506                 }
1507                 names.put(strings[i], i);
1508             }
1509             return names;
1510         }
1511         return null;
1512     }
1513 
1514     boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle,
1515                                    Locale locale, int fieldMask) {
1516         if (field < 0 || field >= fields.length ||
1517             style < minStyle || style > maxStyle) {
1518             throw new IllegalArgumentException();
1519         }
1520         if (locale == null) {
1521             throw new NullPointerException();
1522         }




 823 
 824     /**
 825      * The first day of the week, with possible values <code>SUNDAY</code>,
 826      * <code>MONDAY</code>, etc.  This is a locale-dependent value.
 827      * @serial
 828      */
 829     private int             firstDayOfWeek;
 830 
 831     /**
 832      * The number of days required for the first week in a month or year,
 833      * with possible values from 1 to 7.  This is a locale-dependent value.
 834      * @serial
 835      */
 836     private int             minimalDaysInFirstWeek;
 837 
 838     /**
 839      * Cache to hold the firstDayOfWeek and minimalDaysInFirstWeek
 840      * of a Locale.
 841      */
 842     private static final ConcurrentMap<Locale, int[]> cachedLocaleData
 843         = new ConcurrentHashMap<>(3);
 844 
 845     // Special values of stamp[]
 846     /**
 847      * The corresponding fields[] has no value.
 848      */
 849     private static final int        UNSET = 0;
 850 
 851     /**
 852      * The value of the corresponding fields[] has been calculated internally.
 853      */
 854     private static final int        COMPUTED = 1;
 855 
 856     /**
 857      * The value of the corresponding fields[] has been set externally. Stamp
 858      * values which are greater than 1 represents the (pseudo) time when the
 859      * corresponding fields[] value was set.
 860      */
 861     private static final int        MINIMUM_USER_STAMP = 2;
 862 
 863     /**


1482                 return shortNames;
1483             }
1484             Map<String,Integer> longNames = getDisplayNamesImpl(field, LONG, locale);
1485             if (shortNames == null) {
1486                 return longNames;
1487             }
1488             if (longNames != null) {
1489                 shortNames.putAll(longNames);
1490             }
1491             return shortNames;
1492         }
1493 
1494         // SHORT or LONG
1495         return getDisplayNamesImpl(field, style, locale);
1496     }
1497 
1498     private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
1499         DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
1500         String[] strings = getFieldStrings(field, style, symbols);
1501         if (strings != null) {
1502             Map<String,Integer> names = new HashMap<>();
1503             for (int i = 0; i < strings.length; i++) {
1504                 if (strings[i].length() == 0) {
1505                     continue;
1506                 }
1507                 names.put(strings[i], i);
1508             }
1509             return names;
1510         }
1511         return null;
1512     }
1513 
1514     boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle,
1515                                    Locale locale, int fieldMask) {
1516         if (field < 0 || field >= fields.length ||
1517             style < minStyle || style > maxStyle) {
1518             throw new IllegalArgumentException();
1519         }
1520         if (locale == null) {
1521             throw new NullPointerException();
1522         }