本文整理了Java中org.threeten.bp.LocalTime.equals()
方法的一些代码示例,展示了LocalTime.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.equals()
方法的具体详情如下:
包路径:org.threeten.bp.LocalTime
类名称:LocalTime
方法名:equals
[英]Checks if this time is equal to another time.
The comparison is based on the time-line position of the time within a day.
Only objects of type LocalTime are compared, other types return false. To compare the date of two TemporalAccessor instances, use ChronoField#NANO_OF_DAY as a comparator.
[中]检查此时间是否等于其他时间。
比较基于一天内时间的时间线位置。
仅比较LocalTime类型的对象,其他类型返回false。要比较两个TemporalAccessor实例的日期,请使用ChronoField#NANO_of_DAY作为比较器。
代码示例来源:origin: ThreeTen/threetenbp
/**
* Is the transition local time midnight at the end of day.
* <p>
* The transition may be represented as occurring at 24:00.
*
* @return whether a local time of midnight is at the start or end of the day
*/
public boolean isMidnightEndOfDay() {
return adjustDays == 1 && time.equals(LocalTime.MIDNIGHT);
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Is the transition local time midnight at the end of day.
* <p>
* The transition may be represented as occurring at 24:00.
*
* @return whether a local time of midnight is at the start or end of the day
*/
public boolean isMidnightEndOfDay() {
return adjustDays == 1 && time.equals(LocalTime.MIDNIGHT);
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Checks if this date-time is equal to another date-time.
* <p>
* Compares this {@code LocalDateTime} with another ensuring that the date-time is the same.
* Only objects of type {@code LocalDateTime} are compared, other types return false.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other date-time
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LocalDateTime) {
LocalDateTime other = (LocalDateTime) obj;
return date.equals(other.date) && time.equals(other.time);
}
return false;
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Checks if this date-time is equal to another date-time.
* <p>
* Compares this {@code LocalDateTime} with another ensuring that the date-time is the same.
* Only objects of type {@code LocalDateTime} are compared, other types return false.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other date-time
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof LocalDateTime) {
LocalDateTime other = (LocalDateTime) obj;
return date.equals(other.date) && time.equals(other.time);
}
return false;
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Checks if this time is equal to another time.
* <p>
* The comparison is based on the local-time and the offset.
* To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}.
* <p>
* Only objects of type {@code OffsetTime} are compared, other types return false.
* To compare the underlying local time of two {@code TemporalAccessor} instances,
* use {@link ChronoField#NANO_OF_DAY} as a comparator.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other time
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OffsetTime) {
OffsetTime other = (OffsetTime) obj;
return time.equals(other.time) && offset.equals(other.offset);
}
return false;
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Checks if this time is equal to another time.
* <p>
* The comparison is based on the local-time and the offset.
* To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}.
* <p>
* Only objects of type {@code OffsetTime} are compared, other types return false.
* To compare the underlying local time of two {@code TemporalAccessor} instances,
* use {@link ChronoField#NANO_OF_DAY} as a comparator.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other time
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OffsetTime) {
OffsetTime other = (OffsetTime) obj;
return time.equals(other.time) && offset.equals(other.offset);
}
return false;
}
代码示例来源:origin: com.torodb.torod/torod-core
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ScalarTime)) {
return false;
}
return this.getValue().equals(((ScalarTime) obj).getValue());
}
代码示例来源:origin: com.torodb.kvdocument/kvdocument-core
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof KVTime)) {
return false;
}
return this.getValue().equals(((KVTime) obj).getValue());
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Checks if this object equals another.
* <p>
* The entire state of the object is compared.
*
* @param otherRule the other object to compare to, null returns false
* @return true if equal
*/
@Override
public boolean equals(Object otherRule) {
if (otherRule == this) {
return true;
}
if (otherRule instanceof ZoneOffsetTransitionRule) {
ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule) otherRule;
return month == other.month && dom == other.dom && dow == other.dow &&
timeDefinition == other.timeDefinition &&
adjustDays == other.adjustDays &&
time.equals(other.time) &&
standardOffset.equals(other.standardOffset) &&
offsetBefore.equals(other.offsetBefore) &&
offsetAfter.equals(other.offsetAfter);
}
return false;
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Checks if this object equals another.
* <p>
* The entire state of the object is compared.
*
* @param otherRule the other object to compare to, null returns false
* @return true if equal
*/
@Override
public boolean equals(Object otherRule) {
if (otherRule == this) {
return true;
}
if (otherRule instanceof ZoneOffsetTransitionRule) {
ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule) otherRule;
return month == other.month && dom == other.dom && dow == other.dow &&
timeDefinition == other.timeDefinition &&
adjustDays == other.adjustDays &&
time.equals(other.time) &&
standardOffset.equals(other.standardOffset) &&
offsetBefore.equals(other.offsetBefore) &&
offsetAfter.equals(other.offsetAfter);
}
return false;
}
代码示例来源:origin: ThreeTen/threetenbp
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
代码示例来源:origin: org.threeten/threetenbp
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
代码示例来源:origin: org.threeten/threetenbp
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
代码示例来源:origin: ThreeTen/threetenbp
throw new IllegalArgumentException("Day of month indicator must be between -28 and 31 inclusive excluding zero");
if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
代码示例来源:origin: jeffdcamp/dbtools-android
@Test
public void testTimeText() throws Exception {
// convert to text
String jsr310ResultText = DBToolsThreeTenFormatter.localTimeToDBString(jsr301Time);
// String jodaResultText = DBToolsDateFormatter.dateTimeToDBString(jodaDateTime);
assertEquals(TEXT_TIME, jsr310ResultText);
// assertEquals(TEXT_TIMESTAMP, jodaResultText);
// convert back to object
LocalTime resultJsr310Time = DBToolsThreeTenFormatter.dbStringToLocalTime(jsr310ResultText);
// DateTime resultJodaDateTime = DBToolsDateFormatter.dbStringToDateTime(jodaResultText);
assertNotNull(resultJsr310Time);
assertTrue(jsr301Time.equals(resultJsr310Time));
// assertNotNull(resultJodaDateTime);
// assertTrue(jodaDateTime.isEqual(resultJodaDateTime));
}
}
内容来源于网络,如有侵权,请联系作者删除!