Package com.ibm.icu.impl

Examples of com.ibm.icu.impl.CalendarData


             */
            // Need the Date/Time pattern for concatnation the date with
            // the time interval.
            // The date/time pattern ( such as {0} {1} ) is saved in
            // calendar, that is why need to get the CalendarData here.
            CalendarData calData = new CalendarData(locale, null);
            String[] patterns = calData.getDateTimePatterns();
            String datePattern =dtpng.getBestPattern(dateSkeleton);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.AM_PM, intervalPatterns);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.HOUR, intervalPatterns);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.MINUTE, intervalPatterns);
        }
View Full Code Here


        /* try to get the Locale data from the cache */
        WeekData data = (WeekData) cachedLocaleData.get(locale);
       
        if (data == null) {  /* cache miss */

            CalendarData calData = new CalendarData(locale, getType());
            int[] dateTimeElements = calData.get("DateTimeElements").getIntVector();
            int[] weekend = calData.get("weekend").getIntVector();
            data = new WeekData(dateTimeElements[0],dateTimeElements[1],
                                weekend[0],
                                weekend[1],
                                weekend[2],
                                weekend[3],
                                calData.getULocale());
            /* cache update */
            cachedLocaleData.put(locale, data);
        }
        setFirstDayOfWeek(data.firstDayOfWeek);
        setMinimalDaysInFirstWeek(data.minimalDaysInFirstWeek);
View Full Code Here

            String key = loc.toString() + cal.getType();
            PatternData patternData = (PatternData) PATTERN_CACHE.get(key);
            if (patternData == null) {
                // Cache missed.  Get one from bundle
                try {
                    CalendarData calData = new CalendarData(loc, cal.getType());
                    patternData = new PatternData(calData.getDateTimePatterns(), calData.getOverrides());
                } catch (MissingResourceException e) {
                    patternData = new PatternData(DEFAULT_PATTERNS, null);
                }
                PATTERN_CACHE.put(key, patternData);
            }
View Full Code Here

        ULocale defaultLocale = ULocale.getDefault();
        if (!defaultLocale.equals(cachedDefaultLocale)) {
            cachedDefaultLocale = defaultLocale;
            Calendar cal = Calendar.getInstance(cachedDefaultLocale);
            try {
                CalendarData calData = new CalendarData(cachedDefaultLocale, cal.getType());
                String[] dateTimePatterns = calData.getDateTimePatterns();
                int glueIndex = 8;
                if (dateTimePatterns.length >= 13)
                {
                    glueIndex += (SHORT + 1);
                }
View Full Code Here

    {
        String key = desiredLocale.toString() + "+" + type;
        DateFormatSymbols dfs = (DateFormatSymbols)DFSCACHE.get(key);
        if (dfs == null) {
            // Initialize data from scratch put a clone of this instance into the cache
            CalendarData calData = new CalendarData(desiredLocale, type);
            initializeData(desiredLocale, calData);
            dfs = (DateFormatSymbols)this.clone();
            DFSCACHE.put(key, dfs);
        } else {
            initializeData(dfs);
View Full Code Here

     * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale)
     * @stable ICU 3.2
     */
    public DateFormatSymbols(ResourceBundle bundle, ULocale locale) {
        initializeData(locale,
            new CalendarData((ICUResourceBundle)bundle, getCalendarType(locale)));
    }
View Full Code Here

      //     the likely subtags.
      // 2). If the locale has an unnecessary script designation then we ignore it,
      //     ( i.e. "en_Latn_US" becomes "en_US" )

      ULocale useLocale;
      CalendarData calData = new CalendarData(locale, getType());
      ULocale min = ULocale.minimizeSubtags(calData.getULocale());
      if (min.getCountry().length() > 0) {
        useLocale = min;
      } else {
        ULocale max = ULocale.addLikelySubtags(min);
        StringBuilder buf = new StringBuilder();
        buf.append(min.getLanguage());
        if (min.getScript().length() > 0) {
          buf.append("_" + min.getScript());
        }
        if (max.getCountry().length() > 0) {
          buf.append("_" + max.getCountry());
        }
        if (min.getVariant().length() > 0) {
          buf.append("_" + min.getVariant());
        }
        useLocale = new ULocale(buf.toString());
      }

      UResourceBundle rb = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "supplementalData",
          ICUResourceBundle.ICU_DATA_CLASS_LOADER);
      UResourceBundle weekDataInfo = rb.get("weekData");
      UResourceBundle weekDataBundle = null;
      try {
        weekDataBundle = weekDataInfo.get(useLocale.getCountry());
      } catch (MissingResourceException mre) {
        // use "001" as fallback
        weekDataBundle = weekDataInfo.get("001");
      }

      int[] wdi = weekDataBundle.getIntVector();
      data = new WeekData(wdi[0], wdi[1], wdi[2], wdi[3], wdi[4], wdi[5], calData.getULocale());
      /* cache update */
      cachedLocaleData.put(locale, data);
    }

    setFirstDayOfWeek(data.firstDayOfWeek);
View Full Code Here

      String key = loc.getBaseName() + "+" + calType;
      PatternData patternData = PATTERN_CACHE.get(key);
      if (patternData == null) {
        // Cache missed.  Get one from bundle
        try {
          CalendarData calData = new CalendarData(loc, calType);
          patternData = new PatternData(calData.getDateTimePatterns(), calData.getOverrides());
        } catch (MissingResourceException e) {
          patternData = new PatternData(DEFAULT_PATTERNS, null);
        }
        PATTERN_CACHE.put(key, patternData);
      }
View Full Code Here

             */
            // Need the Date/Time pattern for concatnation the date with
            // the time interval.
            // The date/time pattern ( such as {0} {1} ) is saved in
            // calendar, that is why need to get the CalendarData here.
            CalendarData calData = new CalendarData(locale, null);
            String[] patterns = calData.get("DateTimePatterns").getStringArray();
            String datePattern =dtpng.getBestPattern(dateSkeleton);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.AM_PM, intervalPatterns);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.HOUR, intervalPatterns);
            concatSingleDate2TimeInterval(patterns[8], datePattern, Calendar.MINUTE, intervalPatterns);
        }
View Full Code Here

    {
        String key = desiredLocale.toString() + "+" + type;
        DateFormatSymbols dfs = (DateFormatSymbols)DFSCACHE.get(key);
        if (dfs == null) {
            // Initialize data from scratch put a clone of this instance into the cache
            CalendarData calData = new CalendarData(desiredLocale, type);
            initializeData(desiredLocale, calData);
            dfs = (DateFormatSymbols)this.clone();
            DFSCACHE.put(key, dfs);
        } else {
            initializeData(dfs);
View Full Code Here

TOP

Related Classes of com.ibm.icu.impl.CalendarData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.