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


Java TimeDefinition类代码示例

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


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

示例1: test_London_getTransitionRules

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:TCKZoneRules.java

示例2: test_toString_floatingWeekBackwards_last

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKZoneOffsetTransitionRule.java

示例3: parseTimeDefinition

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
TimeDefinition parseTimeDefinition(char c) {
    switch (c) {
    case 's':
    case 'S':
        // standard time
        return TimeDefinition.STANDARD;
    case 'u':
    case 'U':
    case 'g':
    case 'G':
    case 'z':
    case 'Z':
        // UTC
        return TimeDefinition.UTC;
    case 'w':
    case 'W':
    default:
        // wall time
        return TimeDefinition.WALL;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:TzdbZoneRulesProvider.java

示例4: test_serialization_unusualOffsets

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的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

示例5: test_serialization_endOfDay

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

示例6: test_serialization_unusualTime

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

示例7: test_serialization_floatingWeek

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

示例8: test_serialization_floatingWeekBackwards

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

示例9: test_serialization_fixedDate

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的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

示例10: test_getters_floatingWeek

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
@Test
public void test_getters_floatingWeek() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.getMonth(), Month.MARCH);
    assertEquals(test.getDayOfMonthIndicator(), 20);
    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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TCKZoneOffsetTransitionRule.java

示例11: test_getters_floatingWeekBackwards

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TCKZoneOffsetTransitionRule.java

示例12: test_getters_fixedDate

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
@Test
public void test_getters_fixedDate() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.getMonth(), Month.MARCH);
    assertEquals(test.getDayOfMonthIndicator(), 20);
    assertEquals(test.getDayOfWeek(), null);
    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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TCKZoneOffsetTransitionRule.java

示例13: test_createTransition_floatingWeek_gap_notEndOfDay

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
@Test
public void test_createTransition_floatingWeek_gap_notEndOfDay() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransition trans = ZoneOffsetTransition.of(
            LocalDateTime.of(2000, Month.MARCH, 26, 1, 0), OFFSET_0200, OFFSET_0300);
    assertEquals(test.createTransition(2000), trans);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKZoneOffsetTransitionRule.java

示例14: test_createTransition_floatingWeek_overlap_endOfDay

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
@Test
public void test_createTransition_floatingWeek_overlap_endOfDay() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, 20, DayOfWeek.SUNDAY, LocalTime.MIDNIGHT, true, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0300, OFFSET_0200);
    ZoneOffsetTransition trans = ZoneOffsetTransition.of(
            LocalDateTime.of(2000, Month.MARCH, 27, 0, 0), OFFSET_0300, OFFSET_0200);
    assertEquals(test.createTransition(2000), trans);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKZoneOffsetTransitionRule.java

示例15: test_createTransition_floatingWeekBackwards_last

import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition; //导入依赖的package包/类
@Test
public void test_createTransition_floatingWeekBackwards_last() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
            Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
            OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransition trans = ZoneOffsetTransition.of(
            LocalDateTime.of(2000, Month.MARCH, 26, 1, 0), OFFSET_0200, OFFSET_0300);
    assertEquals(test.createTransition(2000), trans);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKZoneOffsetTransitionRule.java


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