Java Code Examples for java.time.zone.ZoneRules#getTransitionRules()
The following examples show how to use
java.time.zone.ZoneRules#getTransitionRules() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKZoneRules.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void test_London_nextTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.nextTransition(last.getInstant()), rules.get(0).createTransition(1998)); for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.nextTransition(a.getInstant()), b); assertEquals(test.nextTransition(b.getInstant().minusNanos(1)), b); assertEquals(test.nextTransition(b.getInstant()), c); assertEquals(test.nextTransition(c.getInstant().minusNanos(1)), c); } }
Example 2
Source File: TCKZoneRules.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 3
Source File: TCKZoneRules.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 4
Source File: TCKZoneRules.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 5
Source File: TCKZoneRules.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void test_London_nextTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.nextTransition(last.getInstant()), rules.get(0).createTransition(1998)); for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.nextTransition(a.getInstant()), b); assertEquals(test.nextTransition(b.getInstant().minusNanos(1)), b); assertEquals(test.nextTransition(b.getInstant()), c); assertEquals(test.nextTransition(c.getInstant().minusNanos(1)), c); } }
Example 6
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void test_London_nextTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.nextTransition(last.getInstant()), rules.get(0).createTransition(1998)); for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.nextTransition(a.getInstant()), b); assertEquals(test.nextTransition(b.getInstant().minusNanos(1)), b); assertEquals(test.nextTransition(b.getInstant()), c); assertEquals(test.nextTransition(c.getInstant().minusNanos(1)), c); } }
Example 7
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 8
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 9
Source File: TCKZoneRules.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void test_London_getTransitionRules() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); assertEquals(rules.size(), 2); ZoneOffsetTransitionRule in = rules.get(0); assertEquals(in.getMonth(), Month.MARCH); assertEquals(in.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(in.getLocalTime(), LocalTime.of(1, 0)); assertEquals(in.getTimeDefinition(), TimeDefinition.UTC); assertEquals(in.getStandardOffset(), OFFSET_ZERO); assertEquals(in.getOffsetBefore(), OFFSET_ZERO); assertEquals(in.getOffsetAfter(), OFFSET_PONE); ZoneOffsetTransitionRule out = rules.get(1); assertEquals(out.getMonth(), Month.OCTOBER); assertEquals(out.getDayOfMonthIndicator(), 25); // optimized from -1 assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY); assertEquals(out.getLocalTime(), LocalTime.of(1, 0)); assertEquals(out.getTimeDefinition(), TimeDefinition.UTC); assertEquals(out.getStandardOffset(), OFFSET_ZERO); assertEquals(out.getOffsetBefore(), OFFSET_PONE); assertEquals(out.getOffsetAfter(), OFFSET_ZERO); }
Example 10
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 11
Source File: TCKZoneRules.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 12
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 13
Source File: TCKZoneRules.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 14
Source File: TCKZoneRules.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 15
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }
Example 16
Source File: TCKZoneRules.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }
Example 17
Source File: TCKZoneRules.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }
Example 18
Source File: TCKZoneRules.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }
Example 19
Source File: TCKZoneRules.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }
Example 20
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void test_London_nextTransition_lastYear() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE); assertEquals(test.nextTransition(zot.getInstant()), null); }