当前位置: 首页>>代码示例>>Java>>正文


Java ZoneOffsetTransitionRule.of方法代码示例

本文整理汇总了Java中java.time.zone.ZoneOffsetTransitionRule.of方法的典型用法代码示例。如果您正苦于以下问题:Java ZoneOffsetTransitionRule.of方法的具体用法?Java ZoneOffsetTransitionRule.of怎么用?Java ZoneOffsetTransitionRule.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.zone.ZoneOffsetTransitionRule的用法示例。


在下文中一共展示了ZoneOffsetTransitionRule.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_serialization_unusualOffsets

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_serialization_unusualOffsets() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
            ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50),
            ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34),
            ZoneOffset.ofHours(-18));
    assertSerializable(test);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKZoneOffsetTransitionRuleSerialization.java

示例2: test_toString_fixedDate

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_toString_fixedDate() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.toString(), "TransitionRule[Gap +02:00 to +03:00, MARCH 20 at 01:00 STANDARD, standard offset +02:00]");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKZoneOffsetTransitionRule.java

示例3: test_toString_floatingWeekBackwards_last

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_toString_floatingWeekBackwards_last() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.toString(), "TransitionRule[Gap +02:00 to +03:00, SUNDAY on or before last day of MARCH at 01:00 WALL, standard offset +02:00]");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TCKZoneOffsetTransitionRule.java

示例4: test_equals_dayOfMonthDifferent

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_equals_dayOfMonthDifferent() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, 21, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), false);
    assertEquals(b.equals(a), false);
    assertEquals(b.equals(b), true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:TCKZoneOffsetTransitionRule.java

示例5: test_equals_dayOfWeekDifferentNull

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_equals_dayOfWeekDifferentNull() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), false);
    assertEquals(b.equals(a), false);
    assertEquals(b.equals(b), true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:TCKZoneOffsetTransitionRule.java

示例6: test_serialization_fixedDate

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_serialization_fixedDate() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertSerializable(test);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKZoneOffsetTransitionRuleSerialization.java

示例7: test_equals_localTimeDifferent

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_equals_localTimeDifferent() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), false);
    assertEquals(b.equals(a), false);
    assertEquals(b.equals(b), true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:TCKZoneOffsetTransitionRule.java

示例8: test_getters_floatingWeekBackwards

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_getters_floatingWeekBackwards() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.getMonth(), Month.MARCH);
    assertEquals(test.getDayOfMonthIndicator(), -1);
    assertEquals(test.getDayOfWeek(), DayOfWeek.SUNDAY);
    assertEquals(test.getLocalTime(), TIME_0100);
    assertEquals(test.isMidnightEndOfDay(), false);
    assertEquals(test.getTimeDefinition(), TimeDefinition.WALL);
    assertEquals(test.getStandardOffset(), OFFSET_0200);
    assertEquals(test.getOffsetBefore(), OFFSET_0200);
    assertEquals(test.getOffsetAfter(), OFFSET_0300);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:TCKZoneOffsetTransitionRule.java

示例9: test_hashCode_floatingWeekBackwards

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_hashCode_floatingWeekBackwards() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.hashCode(), b.hashCode());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKZoneOffsetTransitionRule.java

示例10: test_equals_endOfDayDifferent

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_equals_endOfDayDifferent() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, true, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), false);
    assertEquals(b.equals(a), false);
    assertEquals(b.equals(b), true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:TCKZoneOffsetTransitionRule.java

示例11: test_toString_floatingWeek_overlap_endOfDay

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_toString_floatingWeek_overlap_endOfDay() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.OCTOBER, 20, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, true, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0300, OFFSET_0200);
    assertEquals(test.toString(), "TransitionRule[Overlap +03:00 to +02:00, SUNDAY on or after OCTOBER 20 at 24:00 WALL, standard offset +02:00]");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TCKZoneOffsetTransitionRule.java

示例12: test_equals_string_false

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_equals_string_false() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals("TZDB"), false);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKZoneOffsetTransitionRule.java

示例13: test_hashCode_fixedDate

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test
public void test_hashCode_fixedDate() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.hashCode(), b.hashCode());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TCKZoneOffsetTransitionRule.java

示例14: test_of

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
public void test_of(){
    //used for standard offset
    ZoneOffset stdOffset1 = ZoneOffset.UTC;
    ZoneOffset stdOffset2 = ZoneOffset.ofHours(1);
    LocalDateTime time_of_stdOffsetTransition1 = LocalDateTime.of(2013, 1, 5, 1, 0);
    ZoneOffsetTransition  stdOffsetTransition1 = ZoneOffsetTransition.of(time_of_stdOffsetTransition1, stdOffset1, stdOffset2);
    List<ZoneOffsetTransition> stdOffsetTransition_list = new ArrayList<ZoneOffsetTransition>();
    stdOffsetTransition_list.add(stdOffsetTransition1);

    //used for wall offset
    ZoneOffset wallOffset1 = ZoneOffset.ofHours(2);
    ZoneOffset wallOffset2 = ZoneOffset.ofHours(4);
    ZoneOffset wallOffset3 = ZoneOffset.ofHours(7);

    LocalDateTime time_of_wallOffsetTransition1 = LocalDateTime.of(2013, 2, 5, 1, 0);
    LocalDateTime time_of_wallOffsetTransition2 = LocalDateTime.of(2013, 3, 5, 1, 0);
    LocalDateTime time_of_wallOffsetTransition3 = LocalDateTime.of(2013, 10, 5, 1, 0);

    ZoneOffsetTransition  wallOffsetTransition1 = ZoneOffsetTransition.of(time_of_wallOffsetTransition1, wallOffset1, wallOffset2);
    ZoneOffsetTransition  wallOffsetTransition2 = ZoneOffsetTransition.of(time_of_wallOffsetTransition2, wallOffset2, wallOffset3);
    ZoneOffsetTransition  wallOffsetTransition3 = ZoneOffsetTransition.of(time_of_wallOffsetTransition3, wallOffset3, wallOffset1);

    List<ZoneOffsetTransition> wallOffsetTransition_list = new ArrayList<ZoneOffsetTransition>();
    wallOffsetTransition_list.add(wallOffsetTransition1);
    wallOffsetTransition_list.add(wallOffsetTransition2);
    wallOffsetTransition_list.add(wallOffsetTransition3);

    //used for ZoneOffsetTransitionRule
    ZoneOffset ruleOffset = ZoneOffset.ofHours(3);
    ZoneOffsetTransitionRule.TimeDefinition timeDefinition = ZoneOffsetTransitionRule.TimeDefinition.valueOf("WALL");
    ZoneOffsetTransitionRule rule1 = ZoneOffsetTransitionRule.of(Month.FEBRUARY,
                                                                 2,
                                                                 DayOfWeek.MONDAY,
                                                                 LocalTime.of(1, 0),
                                                                 false,
                                                                 timeDefinition,
                                                                 ZoneOffset.UTC,
                                                                 ZoneOffset.UTC,
                                                                 ruleOffset
                                                                 );
     List<ZoneOffsetTransitionRule> rule_list = new ArrayList<ZoneOffsetTransitionRule>();
     rule_list.add(rule1);

     //Begin verification
     ZoneRules zoneRule = ZoneRules.of(stdOffset1,
                                       wallOffset1,
                                       stdOffsetTransition_list,
                                       wallOffsetTransition_list,
                                       rule_list
                                       );

     OffsetDateTime before_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).minusSeconds(1);
     OffsetDateTime after_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).plusSeconds(1);;
     assertEquals(zoneRule.getStandardOffset(before_time_of_stdOffsetTransition1.toInstant()), stdOffset1);
     assertEquals(zoneRule.getStandardOffset(after_time_of_stdOffsetTransition1.toInstant()), stdOffset2);

     OffsetDateTime  before_time_of_wallOffsetTransition1 = OffsetDateTime.of(time_of_wallOffsetTransition1, wallOffset1).minusSeconds(1);
     OffsetDateTime  after_time_of_wallOffsetTransition1 = OffsetDateTime.of(time_of_wallOffsetTransition1, wallOffset1).plusSeconds(1);
     assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition1.toInstant()), wallOffsetTransition1);
     assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition1.toInstant()), wallOffsetTransition2);

     OffsetDateTime  before_time_of_wallOffsetTransition2 = OffsetDateTime.of(time_of_wallOffsetTransition2, wallOffset2).minusSeconds(1);
     OffsetDateTime  after_time_of_wallOffsetTransition2 = OffsetDateTime.of(time_of_wallOffsetTransition2, wallOffset2).plusSeconds(1);
     assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition2.toInstant()), wallOffsetTransition2);
     assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition2.toInstant()), wallOffsetTransition3);

     OffsetDateTime  before_time_of_wallOffsetTransition3 = OffsetDateTime.of(time_of_wallOffsetTransition3, wallOffset3).minusSeconds(1);
     OffsetDateTime  after_time_of_wallOffsetTransition3 = OffsetDateTime.of(time_of_wallOffsetTransition3, wallOffset3).plusSeconds(1);
     assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition3.toInstant()), wallOffsetTransition3);
     assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition3.toInstant()), rule1.createTransition(2014));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:72,代码来源:TCKZoneRules.java

示例15: test_factory_nullTime

import java.time.zone.ZoneOffsetTransitionRule; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void test_factory_nullTime() {
    ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, null, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TCKZoneOffsetTransitionRule.java


注:本文中的java.time.zone.ZoneOffsetTransitionRule.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。