Package org.threeten.bp.zone

Examples of org.threeten.bp.zone.ZoneRules$Fixed


        if (!method.equals("default") && !method.equals("glass") && !method.equals("ctm")) {
          if (method.equals("random")) {
            override = new TileOverrideImpl$Random1(propertiesFile, properties, tileLoader);

            if (((TileOverride)override).getNumberOfTiles() == 1) {
              override = new TileOverrideImpl$Fixed(propertiesFile, properties, tileLoader);
            }
          } else if (!method.equals("fixed") && !method.equals("static")) {
            if (!method.equals("bookshelf") && !method.equals("horizontal")) {
              if (!method.equals("horizontal+vertical") && !method.equals("h+v")) {
                if (method.equals("vertical")) {
                  override = new TileOverrideImpl$Vertical(propertiesFile, properties, tileLoader);
                } else if (!method.equals("vertical+horizontal") && !method.equals("v+h")) {
                  if (!method.equals("sandstone") && !method.equals("top")) {
                    if (!method.equals("repeat") && !method.equals("pattern")) {
                      logger.error("%s: unknown method \"%s\"", new Object[] {propertiesFile, method});
                    } else {
                      override = new TileOverrideImpl$Repeat(propertiesFile, properties, tileLoader);
                    }
                  } else {
                    override = new TileOverrideImpl$Top(propertiesFile, properties, tileLoader);
                  }
                } else {
                  override = new TileOverrideImpl$VerticalHorizontal(propertiesFile, properties, tileLoader);
                }
              } else {
                override = new TileOverrideImpl$HorizontalVertical(propertiesFile, properties, tileLoader);
              }
            } else {
              override = new TileOverrideImpl$Horizontal(propertiesFile, properties, tileLoader);
            }
          } else {
            override = new TileOverrideImpl$Fixed(propertiesFile, properties, tileLoader);
          }
        } else {
          override = new TileOverrideImpl$CTM(propertiesFile, properties, tileLoader);
        }
View Full Code Here


     * @throws DateTimeException if the result exceeds the supported range
     */
    public static OffsetDateTime ofInstant(Instant instant, ZoneId zone) {
        Jdk8Methods.requireNonNull(instant, "instant");
        Jdk8Methods.requireNonNull(zone, "zone");
        ZoneRules rules = zone.getRules();
        ZoneOffset offset = rules.getOffset(instant);
        LocalDateTime ldt = LocalDateTime.ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset);
        return new OffsetDateTime(ldt, offset);
    }
View Full Code Here

     * @throws DateTimeException if the result exceeds the supported range
     */
    public static LocalDateTime ofInstant(Instant instant, ZoneId zone) {
        Jdk8Methods.requireNonNull(instant, "instant");
        Jdk8Methods.requireNonNull(zone, "zone");
        ZoneRules rules = zone.getRules();
        ZoneOffset offset = rules.getOffset(instant);
        return ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset);
    }
View Full Code Here

    }

    //-----------------------------------------------------------------------
    private static void jsrRulesLocalGetOffset() {
        LocalDateTime dt = LocalDateTime.of(YEAR, 6, 1, 12, 0);
        ZoneRules tz = ZoneId.of("Europe/London").getRules();
        ZoneOffset[] list = new ZoneOffset[SIZE];
        long start = System.nanoTime();
        for (int i = 0; i < SIZE; i++) {
            list[i] = tz.getOffset(dt);
        }
        long end = System.nanoTime();
        System.out.println("JSR-LoR: Setup:  " + NF.format(end - start) + " ns" + list[0]);
    }
View Full Code Here

    }

    //-----------------------------------------------------------------------
    private static void jsrRulesInstantGetOffset() {
        Instant instant = LocalDateTime.of(YEAR, 6, 1, 12, 0).toInstant(ZoneOffset.ofHours(1));
        ZoneRules tz = ZoneId.of("Europe/London").getRules();
        ZoneOffset[] list = new ZoneOffset[SIZE];
        long start = System.nanoTime();
        for (int i = 0; i < SIZE; i++) {
            list[i] = tz.getOffset(instant);
        }
        long end = System.nanoTime();
        System.out.println("JSR-InR: Setup:  " + NF.format(end - start) + " ns" + list[0]);
    }
View Full Code Here

        Jdk8Methods.requireNonNull(zone, "zone");
        // need to handle case where there is a gap from 11:30 to 00:30
        // standard ZDT factory would result in 01:00 rather than 00:30
        LocalDateTime ldt = atTime(LocalTime.MIDNIGHT);
        if (zone instanceof ZoneOffset == false) {
            ZoneRules rules = zone.getRules();
            ZoneOffsetTransition trans = rules.getTransition(ldt);
            if (trans != null && trans.isGap()) {
                ldt = trans.getDateTimeAfter();
            }
        }
        return ZonedDateTime.of(ldt, zone);
View Full Code Here

     * @return the offset time, not null
     */
    public static OffsetTime ofInstant(Instant instant, ZoneId zone) {
        Jdk8Methods.requireNonNull(instant, "instant");
        Jdk8Methods.requireNonNull(zone, "zone");
        ZoneRules rules = zone.getRules();
        ZoneOffset offset = rules.getOffset(instant);
        long secsOfDay = instant.getEpochSecond() % SECONDS_PER_DAY;
        secsOfDay = (secsOfDay + offset.getTotalSeconds()) % SECONDS_PER_DAY;
        if (secsOfDay < 0) {
            secsOfDay += SECONDS_PER_DAY;
        }
View Full Code Here

     *
     * @return the time-zone unique ID, not null
     */
    public ZoneId normalized() {
        try {
            ZoneRules rules = getRules();
            if (rules.isFixedOffset()) {
                return rules.getOffset(Instant.EPOCH);
            }
        } catch (ZoneRulesException ex) {
            // ignore invalid objects
        }
        return this;
View Full Code Here

    static ZoneRegion ofId(String zoneId, boolean checkAvailable) {
        Jdk8Methods.requireNonNull(zoneId, "zoneId");
        if (zoneId.length() < 2 || PATTERN.matcher(zoneId).matches() == false) {
            throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
        }
        ZoneRules rules = null;
        try {
            // always attempt load for better behavior after deserialization
            rules = ZoneRulesProvider.getRules(zoneId, true);
        } catch (ZoneRulesException ex) {
            // special case as removed from data file
View Full Code Here

        Jdk8Methods.requireNonNull(localDateTime, "localDateTime");
        Jdk8Methods.requireNonNull(zone, "zone");
        if (zone instanceof ZoneOffset) {
            return new ZonedDateTime(localDateTime, (ZoneOffset) zone, zone);
        }
        ZoneRules rules = zone.getRules();
        List<ZoneOffset> validOffsets = rules.getValidOffsets(localDateTime);
        ZoneOffset offset;
        if (validOffsets.size() == 1) {
            offset = validOffsets.get(0);
        } else if (validOffsets.size() == 0) {
            ZoneOffsetTransition trans = rules.getTransition(localDateTime);
            localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds());
            offset = trans.getOffsetAfter();
        } else {
            if (preferredOffset != null && validOffsets.contains(preferredOffset)) {
                offset = preferredOffset;
View Full Code Here

TOP

Related Classes of org.threeten.bp.zone.ZoneRules$Fixed

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.