Package org.fluxtream.core

Examples of org.fluxtream.core.TimezoneMap


                    JSONObject details = jsonObject.getJSONObject("details");
                    facet.tz = details.getString("tz");
                    facet.tzs = details.getJSONArray("tzs").toString();
                    TimeZone defaultTimeZone = TimeZone.getTimeZone(facet.tz);
                    TimezoneMap tzMap = getTimeZoneMap(facet.tzs);

                    final LocalDate localDate = ISODateTimeFormat.basicDate().withZoneUTC().parseLocalDate(dateString);
                    facet.date = ISODateTimeFormat.date().withZoneUTC().print(localDate);
                    if (details.has("distance"))
                        facet.distance = details.getInt("distance");
View Full Code Here


            }
        });
    }

    TimezoneMap getTimeZoneMap(final String tzs) {
        TimezoneMap map = new TimezoneMap();
        if (tzs==null) return map;
        JSONArray timezoneArray = JSONArray.fromObject(tzs);
        for (int i=0; i<timezoneArray.size(); i++) {
            JSONArray timezoneInfo = timezoneArray.getJSONArray(i);
            long start = timezoneInfo.getLong(0)*1000;
            // allow some padding for the last element in the map
            long end = start + DateTimeConstants.MILLIS_PER_DAY;
            if (timezoneArray.size()>=i+2)
                end = timezoneArray.getJSONArray(i+1).getLong(0)*1000;
            String ID = timezoneInfo.getString(1);
            map.add(start, end, DateTimeZone.forID(ID));
        }
        //add some padding for the first element in the map
        if (map.spans.size()>0) {
            final TimespanSegment<DateTimeZone> first = map.spans.first();
            first.setStart(first.getStart()-DateTimeConstants.MILLIS_PER_DAY);
View Full Code Here

TOP

Related Classes of org.fluxtream.core.TimezoneMap

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.