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


Java Instant.MIN属性代码示例

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


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

示例1: getTimeForDatastream

private Instant getTimeForDatastream(Datastream ds) throws ServiceFailureException {
    Id dsId = ds.getId();
    Instant latest = datastreamCache.get(dsId);
    if (latest == null) {
        Observation firstObs = ds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
        if (firstObs == null) {
            latest = Instant.MIN;
        } else {
            TimeObject phenomenonTime = firstObs.getPhenomenonTime();
            if (phenomenonTime.isInterval()) {
                latest = phenomenonTime.getAsInterval().getStart();
            } else {
                latest = phenomenonTime.getAsDateTime().toInstant();
            }
        }
        datastreamCache.put(dsId, latest);
    }
    return latest;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:19,代码来源:ValidatorNewer.java

示例2: getTimeForMultiDatastream

private Instant getTimeForMultiDatastream(MultiDatastream mds) throws ServiceFailureException {
    Id dsId = mds.getId();
    Instant latest = multiDatastreamCache.get(dsId);
    if (latest == null) {
        Observation firstObs = mds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
        if (firstObs == null) {
            latest = Instant.MIN;
        } else {
            TimeObject phenomenonTime = firstObs.getPhenomenonTime();
            if (phenomenonTime.isInterval()) {
                latest = phenomenonTime.getAsInterval().getStart();
            } else {
                latest = phenomenonTime.getAsDateTime().toInstant();
            }
        }
        multiDatastreamCache.put(dsId, latest);
    }
    return latest;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:19,代码来源:ValidatorNewer.java

示例3: registerTimer

/**
 * Timers are uniquely distinguished by plugin & timerName.
 * This method link the existing or newly created timer to the callback function.
 *
 * @param plugin    the plugin the timer belongs to
 * @param timerName the timer name, usually plugin specific
 * @param timerData the timer data & parameters, only for newly created timers.
 *                  for existing timers, you should leave it to null otherwise exception will be thrown
 * @param callback  the callback object for the timer.
 */
public void registerTimer(JavaPlugin plugin, String timerName, TimerData timerData, ITimerCallback callback, ITimerCallback timerResetCallback) {
    String internalName = toInternalName(plugin, timerName);
    if (this.timerData.containsKey(internalName)) {
        if (timerData != null) throw new IllegalArgumentException("Cannot overwrite timerData of existing timer");
    } else {
        TimerPersistData data = new TimerPersistData(timerData);
        data.creationTime = Instant.now();
        data.lastTimerCallback = Instant.MIN;
        data.lastResetCallback = Instant.MIN;
        data.lastCheckpoint = Instant.now();
        data.timeElapsed = Duration.ZERO;
        this.timerData.put(internalName, data);
        save();
    }
    timerCallback.put(internalName, callback == null ? dummyTimerCallback : callback);
    this.timerResetCallback.put(internalName, timerResetCallback == null ? dummyTimerCallback : timerResetCallback);

    //todo check callback status
}
 
开发者ID:NyaaCat,项目名称:NyaaCore,代码行数:29,代码来源:TimerManager.java

示例4: 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

示例5: 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

示例6: testGraphValueChangeWithInstantValue

@Test
public void testGraphValueChangeWithInstantValue(){
	GraphEntityMutation graphEntityMutation = createGraphEntityMutation(null);
	GraphValueChange graphValueChange = graphEntityMutation.new GraphValueChange(
			TartanImplTestConstants.ATTR_DUMMY_ATTRIBUTE_NAME);
	Instant value = Instant.MIN;
	Mutation value2 = graphValueChange.value(value);
	assertNull(value2);
}
 
开发者ID:intuit,项目名称:universal-graph-client,代码行数:9,代码来源:GraphEntityMutationTest.java

示例7: testSend

/**
 * Test of send method, of class EmailAggregate.
 */
@Test
public void testSend() throws Exception {
    final Email email = new Email("alex", "[email protected]", EmailState.CREATED);
    String uuid = UUID.randomUUID().toString();
    EmailAggregate aggregateWithStateCreated = getAggregateWithStateCreated(email, uuid);
    EmailSendCommand command = new EmailSendCommand(uuid, Instant.MIN);
    EmailAggregate result = aggregateWithStateCreated.send(command);
    
    assertEquals(EmailState.SENT, result.getState().getState());
}
 
开发者ID:apssouza22,项目名称:java-microservice,代码行数:13,代码来源:EmailAggregateTest.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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


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