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


Java Instant.MAX属性代码示例

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


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

示例1: data_adjustInto

@DataProvider(name="adjustInto")
Object[][] data_adjustInto() {
    return new Object[][]{
            {Instant.ofEpochSecond(10, 200), Instant.ofEpochSecond(20), Instant.ofEpochSecond(10, 200), null},
            {Instant.ofEpochSecond(10, -200), Instant.now(), Instant.ofEpochSecond(10, -200), null},
            {Instant.ofEpochSecond(-10), Instant.EPOCH, Instant.ofEpochSecond(-10), null},
            {Instant.ofEpochSecond(10), Instant.MIN, Instant.ofEpochSecond(10), null},
            {Instant.ofEpochSecond(10), Instant.MAX, Instant.ofEpochSecond(10), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20).toInstant(ZoneOffset.UTC), Instant.ofEpochSecond(10, 200), null},
            {Instant.ofEpochSecond(10, 200), OffsetDateTime.of(1970, 1, 1, 0, 0, 20, 10, ZoneOffset.UTC), OffsetDateTime.of(1970, 1, 1, 0, 0, 10, 200, ZoneOffset.UTC), null},
            {Instant.ofEpochSecond(10, 200), OffsetDateTime.of(1970, 1, 1, 0, 0, 20, 10, OFFSET_PTWO), OffsetDateTime.of(1970, 1, 1, 2, 0, 10, 200, OFFSET_PTWO), null},
            {Instant.ofEpochSecond(10, 200), ZonedDateTime.of(1970, 1, 1, 0, 0, 20, 10, ZONE_PARIS), ZonedDateTime.of(1970, 1, 1, 1, 0, 10, 200, ZONE_PARIS), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20), null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), null, null, NullPointerException.class},

    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TCKInstant.java

示例2: data_with

@DataProvider(name="with")
Object[][] data_with() {
    return new Object[][]{
            {Instant.ofEpochSecond(10, 200), Instant.ofEpochSecond(20), Instant.ofEpochSecond(20), null},
            {Instant.ofEpochSecond(10), Instant.ofEpochSecond(20, -100), Instant.ofEpochSecond(20, -100), null},
            {Instant.ofEpochSecond(-10), Instant.EPOCH, Instant.ofEpochSecond(0), null},
            {Instant.ofEpochSecond(10), Instant.MIN, Instant.MIN, null},
            {Instant.ofEpochSecond(10), Instant.MAX, Instant.MAX, null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20).toInstant(ZoneOffset.UTC), Instant.ofEpochSecond(20), null},

            {Instant.ofEpochSecond(10, 200), LocalDateTime.of(1970, 1, 1, 0, 0, 20), null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), null, null, NullPointerException.class},

    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:TCKInstant.java

示例3: addNodeUpdatesDateRangeEnd

@Test
public void addNodeUpdatesDateRangeEnd() {
    final TreeNode root = createDatedTreeNode("Root", Instant.MIN, Instant.MAX);

    final Instant start = NOW.minus(Period.ofWeeks(5));
    final Instant end = NOW.plus(Period.ofWeeks(5));

    final TreeNode node = createDatedTreeNode("Test1", start, end);
    root.addNode(node);

    final TreeNode other = createDatedTreeNode("Test1", start, Instant.MAX);
    root.addNode(other);
    assertEquals(node, root.getExactNode(node).get());

    final Range<Instant> range = new Range<>(start, Instant.MAX);
    assertEquals(range, node.getDateRange());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:17,代码来源:DatedTreeNodeTest.java

示例4: testHashcode

@Test
public void testHashcode() {
    final Instant start = Instant.MIN;
    final Instant end = Instant.MAX;

    final DateRange dateRange = new DateRange(start, end);
    assertEquals(-962094838, dateRange.hashCode());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-jbl,代码行数:8,代码来源:DateRangeTest.java

示例5: testHashcode

@Test
public void testHashcode() {
    final Instant start = Instant.MIN;
    final Instant end = Instant.MAX;

    final Range<Instant> instantRange = new Range<>(start, end);
    assertEquals(-962094838, instantRange.hashCode());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-jbl,代码行数:8,代码来源:RangeTest.java

示例6: dateRange

@Test
public void dateRange() {
    final Instant start = NOW.minus(Period.ofWeeks(5));
    final Instant end = NOW.plus(Period.ofWeeks(5));

    final TreeNode node = createDatedTreeNode("Test1", start, end);

    Range<Instant> range = new Range<>(start, end);
    assertEquals(range, node.getDateRange());

    range = new Range<Instant>(Instant.MIN, Instant.MAX);
    node.setDateRange(range);
    assertEquals(range, node.getDateRange());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:14,代码来源:DatedTreeNodeTest.java

示例7: testConstructionFullConstructor

@Test
public void testConstructionFullConstructor() {
    final DateRange range = new DateRange(Instant.now(), Instant.MAX);

    final UUID id = new UUID(0, 50);
    this.bean = new ValueGroup(id, "test-group", Arrays.asList("input1", "input2"), range);

    this.injectedValues.put("id", id);
    this.injectedValues.put("name", "test-group");
    this.injectedValues.put("values", Arrays.asList("input1", "input2"));
    this.injectedValues.put("range", range);

    JblTestClassUtils.assertGetterCorrectForConstructorInjection(this.injectedValues, this.bean);
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:14,代码来源:ValueGroupTest.java

示例8: updatesValues

@Test
public void updatesValues() {
    final DateRange range = new DateRange(Instant.now(), Instant.MAX);
    final ValueGroup group =
            new ValueGroup(UUID.randomUUID(), "test-group", Arrays.asList("input1", "input2"), range);
    assertThat(group.getValues(), contains("input1", "input2"));

    final List<String> values = Collections.singletonList("input3");
    group.updateValues(values);
    assertThat(group.getValues(), contains("input3"));

    group.updateValues(new ArrayList<>(1));
    assertThat(group.getValues(), contains("input3"));

}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:15,代码来源:ValueGroupTest.java

示例9: equalsCorrect

@Test
public void equalsCorrect() {
    final UUID uuid = new UUID(0, 1);
    final DateRange range = new DateRange(NOW, Instant.MAX);

    final ValueGroup group = new ValueGroup(uuid, "test-group", Arrays.asList("input1", "input2"), range);
    assertTrue(group.equals(group));

    assertFalse(group.equals(null));
    assertFalse(group.equals(Integer.parseInt("1")));

    ValueGroup other = new ValueGroup(new UUID(0, 1), "test-group",
            Arrays.asList("input1", "input2"), new DateRange(NOW, Instant.MAX));
    assertTrue(group.equals(other));

    other = new ValueGroup(new UUID(0, 2), "test-group",
            Arrays.asList("input1", "input2"), new DateRange(NOW, Instant.MAX));
    assertFalse(group.equals(other));

    other = new ValueGroup(new UUID(0, 1), "test-group1",
            Arrays.asList("input1", "input2"), new DateRange(NOW, Instant.MAX));
    assertFalse(group.equals(other));

    other = new ValueGroup(new UUID(0, 1), "test-group",
            Arrays.asList("input1"), new DateRange(NOW, Instant.MAX));
    assertFalse(group.equals(other));

    other = new ValueGroup(new UUID(0, 1), "test-group",
            Arrays.asList("input1", "input2"), ValueGroup.DEFAULT_DATE_RANGE);
    assertFalse(group.equals(other));
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:31,代码来源:ValueGroupTest.java

示例10: hashCodeCorrect

@Test
public void hashCodeCorrect() {
    final UUID uuid = new UUID(0, 1);
    final DateRange range = new DateRange(NOW, Instant.MAX);

    final ValueGroup group = new ValueGroup(uuid, "test-group", Arrays.asList("input1", "input2"), range);

    final ValueGroup other = new ValueGroup(new UUID(0, 1), "test-group",
            Arrays.asList("input1", "input2"), new DateRange(NOW, Instant.MAX));

    assertTrue(group.hashCode() == other.hashCode());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:12,代码来源:ValueGroupTest.java

示例11: toStringCorrect

@Test
public void toStringCorrect() {
    final UUID uuid = new UUID(0, 1);
    final DateRange range = new DateRange(NOW, Instant.MAX);
    final ValueGroup group = new ValueGroup(uuid, "test-group", Arrays.asList("input1", "input2"), range);

    Assert.assertEquals(GroupDriver.VG_PREFIX + new UUID(0, 1), group.toString());
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:8,代码来源:ValueGroupTest.java

示例12: toInstant

/**
 * Converts this {@code FileTime} object to an {@code Instant}.
 *
 * <p> The conversion creates an {@code Instant} that represents the
 * same point on the time-line as this {@code FileTime}.
 *
 * <p> {@code FileTime} can store points on the time-line further in the
 * future and further in the past than {@code Instant}. Conversion
 * from such further time points saturates to {@link Instant#MIN} if
 * earlier than {@code Instant.MIN} or {@link Instant#MAX} if later
 * than {@code Instant.MAX}.
 *
 * @return  an instant representing the same point on the time-line as
 *          this {@code FileTime} object
 * @since 1.8
 */
public Instant toInstant() {
    if (instant == null) {
        long secs = 0L;
        int nanos = 0;
        switch (unit) {
            case DAYS:
                secs = scale(value, SECONDS_PER_DAY,
                             Long.MAX_VALUE/SECONDS_PER_DAY);
                break;
            case HOURS:
                secs = scale(value, SECONDS_PER_HOUR,
                             Long.MAX_VALUE/SECONDS_PER_HOUR);
                break;
            case MINUTES:
                secs = scale(value, SECONDS_PER_MINUTE,
                             Long.MAX_VALUE/SECONDS_PER_MINUTE);
                break;
            case SECONDS:
                secs = value;
                break;
            case MILLISECONDS:
                secs = Math.floorDiv(value, MILLIS_PER_SECOND);
                nanos = (int)Math.floorMod(value, MILLIS_PER_SECOND)
                        * NANOS_PER_MILLI;
                break;
            case MICROSECONDS:
                secs = Math.floorDiv(value, MICROS_PER_SECOND);
                nanos = (int)Math.floorMod(value, MICROS_PER_SECOND)
                        * NANOS_PER_MICRO;
                break;
            case NANOSECONDS:
                secs = Math.floorDiv(value, NANOS_PER_SECOND);
                nanos = (int)Math.floorMod(value, NANOS_PER_SECOND);
                break;
            default : throw new AssertionError("Unit not handled");
        }
        if (secs <= MIN_SECOND)
            instant = Instant.MIN;
        else if (secs >= MAX_SECOND)
            instant = Instant.MAX;
        else
            instant = Instant.ofEpochSecond(secs, nanos);
    }
    return instant;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:61,代码来源:FileTime.java

示例13: samples

@Override
protected List<TemporalAccessor> samples() {
    TemporalAccessor[] array = {TEST_12345_123456789, Instant.MIN, Instant.MAX, Instant.EPOCH};
    return Arrays.asList(array);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:TCKInstant.java

示例14: future

private Instant future() {
    return Instant.MAX;
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:3,代码来源:CachedSupplierTest.java


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