/** * Adds a window that applies until the end of time to the builder that can be * used to filter a set of rules. * <p> * This method defines and adds a window to the zone where the standard offset is specified. * The window limits the effect of subsequent additions of transition rules * or fixed savings. If neither rules or fixed savings are added to the window * then the window will default to no savings. * <p> * This must be added after all other windows. * No more windows can be added after this one. * * @param standardOffset the standard offset, not null * @return this, for chaining * @throws IllegalStateException if a forever window has already been added */ public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) { return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL); }
ZoneRulesBuilder addToBuilder(ZoneRulesBuilder bld, Map<String, List<TZDBRule>> rules) { if (year != null) { bld.addWindow(standardOffset, toDateTime(year.getValue()), timeDefinition); } else { bld.addWindowForever(standardOffset); } if (fixedSavingsSecs != null) { bld.setFixedSavingsToWindow(fixedSavingsSecs); } else { List<TZDBRule> tzdbRules = rules.get(savingsRule); if (tzdbRules == null) { throw new IllegalArgumentException("Rule not found: " + savingsRule); } for (TZDBRule tzdbRule : tzdbRules) { tzdbRule.addToBuilder(bld); } } return bld; }
ZoneRulesBuilder addToBuilder(ZoneRulesBuilder bld, Map<String, List<TZDBRule>> rules) { if (year != null) { bld.addWindow(standardOffset, toDateTime(year.getValue()), timeDefinition); } else { bld.addWindowForever(standardOffset); } if (fixedSavingsSecs != null) { bld.setFixedSavingsToWindow(fixedSavingsSecs); } else { List<TZDBRule> tzdbRules = rules.get(savingsRule); if (tzdbRules == null) { throw new IllegalArgumentException("Rule not found: " + savingsRule); } for (TZDBRule tzdbRule : tzdbRules) { tzdbRule.addToBuilder(bld); } } return bld; }
/** * Adds a window that applies until the end of time to the builder that can be * used to filter a set of rules. * <p> * This method defines and adds a window to the zone where the standard offset is specified. * The window limits the effect of subsequent additions of transition rules * or fixed savings. If neither rules or fixed savings are added to the window * then the window will default to no savings. * <p> * This must be added after all other windows. * No more windows can be added after this one. * * @param standardOffset the standard offset, not null * @return this, for chaining * @throws IllegalStateException if a forever window has already been added */ public ZoneRulesBuilder addWindowForever(ZoneOffset standardOffset) { return addWindow(standardOffset, LocalDateTime.MAX, TimeDefinition.WALL); }