當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。