本文整理了Java中java.time.Instant.equals()
方法的一些代码示例,展示了Instant.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.equals()
方法的具体详情如下:
包路径:java.time.Instant
类名称:Instant
方法名:equals
[英]Checks if this instant is equal to the specified instant.
The comparison is based on the time-line position of the instants.
[中]检查此瞬间是否等于指定的瞬间。
比较是基于瞬间的时间线位置。
代码示例来源:origin: embulk/embulk
@Override
public boolean equals(final Object otherObject) {
if (this == otherObject) {
return true;
}
if (!(otherObject instanceof Timestamp)) {
return false;
}
final Timestamp other = (Timestamp) otherObject;
return this.instant.equals(other.instant);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public boolean equals(Object oth) {
if (this==oth) return true;
else if (oth==null || !getClass().isInstance(oth)) return false;
StandardTransactionId id = (StandardTransactionId)oth;
return instanceId.equals(id.instanceId) && transactionId==id.transactionId
&& transactionTime.equals(id.transactionTime);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public boolean equals(Object other) {
if (this==other) return true;
else if (other==null || !getClass().isInstance(other)) return false;
AbstractMessage msg = (AbstractMessage)other;
return timestamp.equals(msg.timestamp) && senderId.equals(msg.senderId) && content.equals(msg.content);
}
}
代码示例来源:origin: GoogleContainerTools/jib
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof LayerEntryTemplate)) {
return false;
}
LayerEntryTemplate otherLayerEntryTemplate = (LayerEntryTemplate) other;
return sourceFile.equals(otherLayerEntryTemplate.sourceFile)
&& extractionPath.equals(otherLayerEntryTemplate.extractionPath)
&& lastModifiedTime.equals(otherLayerEntryTemplate.lastModifiedTime)
&& permissions.equals(otherLayerEntryTemplate.permissions);
}
代码示例来源:origin: thinkaurelius/titan
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ConsistentKeyLockStatus other = (ConsistentKeyLockStatus) obj;
if (checked != other.checked)
return false;
if (expire == null) {
if (other.expire != null)
return false;
} else if (!expire.equals(other.expire))
return false;
return true;
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public boolean equals(Object oth) {
if (this==oth) return true;
else if (oth==null || !getClass().isInstance(oth)) return false;
StandardTransactionId id = (StandardTransactionId)oth;
return instanceId.equals(id.instanceId) && transactionId==id.transactionId
&& transactionTime.equals(id.transactionTime);
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public boolean equals(Object other) {
if (this==other) return true;
else if (other==null || !getClass().isInstance(other)) return false;
AbstractMessage msg = (AbstractMessage)other;
return timestamp.equals(msg.timestamp) && senderId.equals(msg.senderId) && content.equals(msg.content);
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ConsistentKeyLockStatus other = (ConsistentKeyLockStatus) obj;
if (checked != other.checked)
return false;
if (expire == null) {
return other.expire == null;
} else {
return expire.equals(other.expire);
}
}
}
代码示例来源:origin: GoogleContainerTools/jib
@Override
@VisibleForTesting
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof ContainerConfiguration)) {
return false;
}
ContainerConfiguration otherContainerConfiguration = (ContainerConfiguration) other;
return creationTime.equals(otherContainerConfiguration.creationTime)
&& Objects.equals(entrypoint, otherContainerConfiguration.entrypoint)
&& Objects.equals(programArguments, otherContainerConfiguration.programArguments)
&& Objects.equals(environmentMap, otherContainerConfiguration.environmentMap)
&& Objects.equals(exposedPorts, otherContainerConfiguration.exposedPorts)
&& Objects.equals(labels, otherContainerConfiguration.labels)
&& Objects.equals(user, otherContainerConfiguration.user)
&& Objects.equals(workingDirectory, otherContainerConfiguration.workingDirectory);
}
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public int compareTo(ScheduledDeadlineInfo other) {
if (scheduleTime.equals(other.scheduleTime)) {
return Integer.compare(counter, other.counter);
}
return scheduleTime.compareTo(other.scheduleTime);
}
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public int compareTo(StubScheduleToken other) {
if (scheduleTime.equals(other.scheduleTime)) {
return (counter < other.counter) ? -1 : ((counter == other.counter) ? 0 : 1);
}
return scheduleTime.compareTo(other.scheduleTime);
}
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public TrackingToken createTokenAt(Instant dateTime) {
return events.values()
.stream()
.filter(event -> event.getTimestamp().equals(dateTime) || event.getTimestamp().isAfter(dateTime))
.min(Comparator.comparingLong(e -> ((GlobalSequenceTrackingToken) e.trackingToken())
.getGlobalIndex()))
.map(TrackedEventMessage::trackingToken)
.map(tt -> (GlobalSequenceTrackingToken) tt)
.map(tt -> new GlobalSequenceTrackingToken(tt.getGlobalIndex() - 1))
.orElse(null);
}
代码示例来源:origin: Alluxio/alluxio
@Override
public boolean attempt() {
if (mAttemptCount == 0) {
mAttemptCount++;
return true;
}
Instant now = mClock.instant();
if (now.isAfter(mEndTime) || now.equals(mEndTime)) {
return false;
}
Duration nextWaitTime = computeNextWaitTime();
if (now.plus(nextWaitTime).isAfter(mEndTime)) {
nextWaitTime = Duration.between(now, mEndTime);
}
try {
mSleeper.sleep(nextWaitTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
mAttemptCount++;
return true;
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean isNew() {
return this.getCreationTime().equals(this.getLastAccessedTime());
}
代码示例来源:origin: thinkaurelius/titan
@Override
public final void read(Message message) {
assertNotNull(message);
assertNotNull(message.getSenderId());
assertNotNull(message.getContent());
Instant now = Instant.now();
assertTrue(now.isAfter(message.getTimestamp()) || now.equals(message.getTimestamp()));
processMessage(message);
latch.countDown();
}
代码示例来源:origin: spring-projects/spring-security
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
AbstractOAuth2Token that = (AbstractOAuth2Token) obj;
if (!this.getTokenValue().equals(that.getTokenValue())) {
return false;
}
if (this.getIssuedAt() != null ? !this.getIssuedAt().equals(that.getIssuedAt()) : that.getIssuedAt() != null) {
return false;
}
return this.getExpiresAt() != null ? this.getExpiresAt().equals(that.getExpiresAt()) : that.getExpiresAt() == null;
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void read(Message message) {
Instant msgTime = message.getTimestamp();
assertTrue(msgTime.isAfter(startTime) || msgTime.equals(startTime));
assertNotNull(message.getSenderId());
StaticBuffer content = message.getContent();
assertTrue(content != null && content.length() > 0);
TransactionLogHeader.Entry txentry = TransactionLogHeader.parse(content, serializer, times);
Instant txTime = txentry.getHeader().getTimestamp();
assertTrue(txTime.isBefore(msgTime) || txTime.equals(msgTime));
assertTrue(txTime.isAfter(startTime) || txTime.equals(msgTime));
long txid = txentry.getHeader().getId();
assertTrue(txid > 0);
for (TransactionLogHeader.Modification modification : txentry.getContentAsModifications(serializer)) {
assertTrue(modification.state == Change.ADDED || modification.state == Change.REMOVED);
userChangeCounter.get(modification.state).incrementAndGet();
}
userLogMsgCounter.incrementAndGet();
}
});
代码示例来源:origin: JanusGraph/janusgraph
@Override
public void read(Message message) {
final Instant msgTime = message.getTimestamp();
assertTrue(msgTime.isAfter(startTime) || msgTime.equals(startTime));
assertNotNull(message.getSenderId());
final StaticBuffer content = message.getContent();
assertTrue(content != null && content.length() > 0);
final TransactionLogHeader.Entry transactionEntry = TransactionLogHeader.parse(content, serializer, times);
final Instant txTime = transactionEntry.getHeader().getTimestamp();
assertTrue(txTime.isBefore(msgTime) || txTime.equals(msgTime));
assertTrue(txTime.isAfter(startTime) || txTime.equals(msgTime));
final long transactionId = transactionEntry.getHeader().getId();
assertTrue(transactionId > 0);
transactionEntry.getContentAsModifications(serializer).forEach(modification -> {
assertTrue(modification.state == Change.ADDED || modification.state == Change.REMOVED);
userChangeCounter.get(modification.state).incrementAndGet();
});
userLogMsgCounter.incrementAndGet();
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public final void read(Message message) {
assertNotNull(message);
assertNotNull(message.getSenderId());
assertNotNull(message.getContent());
Instant now = Instant.now();
assertTrue(now.isAfter(message.getTimestamp()) || now.equals(message.getTimestamp()));
processMessage(message);
latch.countDown();
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void read(Message message) {
Instant msgTime = message.getTimestamp();
assertTrue(msgTime.isAfter(startTime) || msgTime.equals(startTime));
assertNotNull(message.getSenderId());
TransactionLogHeader.Entry txEntry = TransactionLogHeader.parse(message.getContent(), serializer, times);
TransactionLogHeader header = txEntry.getHeader();
assertTrue(header.getTimestamp().isAfter(startTime) || header.getTimestamp().equals(startTime));
assertTrue(header.getTimestamp().isBefore(msgTime) || header.getTimestamp().equals(msgTime));
assertNotNull(txEntry.getMetadata());
assertNull(txEntry.getMetadata().get(LogTxMeta.GROUPNAME));
内容来源于网络,如有侵权,请联系作者删除!