List of usage examples for java.time OffsetDateTime compareTo
@Override public int compareTo(OffsetDateTime other)
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.MAX; System.out.println(o.compareTo(OffsetDateTime.MIN)); }
From source file:org.silverpeas.core.date.Period.java
/** * Is this period including the specified temporal? * @param dateTime either a date or a date time. Any other temporal type isn't supported. * @return true if the specified date is included in this period, false otherwise. *//* w ww . j a va 2 s .c o m*/ public boolean includes(final Temporal dateTime) { OffsetDateTime dt = asOffsetDateTime(dateTime); return dt.compareTo(startDateTime) >= 0 && dt.compareTo(endDateTime) < 0; }
From source file:org.silverpeas.core.date.Period.java
/** * Is this period ending before the specified temporal? * @param dateTime either a date or a date time. Any other temporal type isn't supported. * @return true if this period's end date is at or before the specified temporal (the period's * end date is exclusive)./* www.ja v a 2s. c o m*/ */ public boolean endsBefore(final Temporal dateTime) { OffsetDateTime dt = asOffsetDateTime(dateTime); return dt.compareTo(endDateTime) >= 0; }
From source file:org.silverpeas.core.date.Period.java
/** * Is this period ending after the specified temporal? * @param dateTime either a date or a date time. Any other temporal type isn't supported. * @return true if this period's end date is at or before the specified temporal (the period's * end date is exclusive)./*from w w w . j a v a2 s . com*/ */ public boolean endsAfter(final Temporal dateTime) { OffsetDateTime dt = asOffsetDateTime(dateTime); return dt.compareTo(endDateTime) < 0; }
From source file:org.silverpeas.core.date.Period.java
/** * Is this period starting after the specified temporal? * @param dateTime either a date or a date time. Any other temporal type isn't supported. * @return true if this period's start date is after the specified temporal (the period's * start date is inclusive)./*from w w w .jav a2 s .c o m*/ */ public boolean startsAfter(final Temporal dateTime) { OffsetDateTime dt = asOffsetDateTime(dateTime); return dt.compareTo(startDateTime) < 0; }
From source file:net.dv8tion.jda.core.entities.impl.RoleImpl.java
@Override public int compareTo(Role r) { if (this == r) return 0; if (this.getGuild() != r.getGuild()) throw new IllegalArgumentException("Cannot compare roles that aren't from the same guild!"); if (this.getPositionRaw() != r.getPositionRaw()) return this.getPositionRaw() - r.getPositionRaw(); OffsetDateTime thisTime = this.getCreationTime(); OffsetDateTime rTime = r.getCreationTime(); //We compare the provided role's time to this's time instead of the reverse as one would expect due to how // discord deals with hierarchy. The more recent a role was created, the lower its hierarchy ranking when // it shares the same position as another role. return rTime.compareTo(thisTime); }
From source file:net.dv8tion.jda.core.entities.impl.VoiceChannelImpl.java
@Override public int compareTo(VoiceChannel chan) { if (this == chan) return 0; if (this.getGuild() != chan.getGuild()) throw new IllegalArgumentException("Cannot compare VoiceChannels that aren't from the same guild!"); if (this.getPositionRaw() != chan.getPositionRaw()) return chan.getPositionRaw() - this.getPositionRaw(); OffsetDateTime thisTime = this.getCreationTime(); OffsetDateTime chanTime = chan.getCreationTime(); //We compare the provided channel's time to this's time instead of the reverse as one would expect due to how // discord deals with hierarchy. The more recent a channel was created, the lower its hierarchy ranking when // it shares the same position as another channel. return chanTime.compareTo(thisTime); }
From source file:net.dv8tion.jda.core.entities.impl.TextChannelImpl.java
@Override public int compareTo(TextChannel chan) { if (this == chan) return 0; if (!this.getGuild().equals(chan.getGuild())) throw new IllegalArgumentException("Cannot compare TextChannels that aren't from the same guild!"); if (this.getPositionRaw() != chan.getPositionRaw()) return chan.getPositionRaw() - this.getPositionRaw(); OffsetDateTime thisTime = this.getCreationTime(); OffsetDateTime chanTime = chan.getCreationTime(); //We compare the provided channel's time to this's time instead of the reverse as one would expect due to how // discord deals with hierarchy. The more recent a channel was created, the lower its hierarchy ranking when // it shares the same position as another channel. return chanTime.compareTo(thisTime); }
From source file:net.dv8tion.jda.entities.impl.TextChannelImpl.java
@Override public int compareTo(TextChannel chan) { if (this == chan) return 0; if (this.getGuild() != chan.getGuild()) throw new IllegalArgumentException("Cannot compare TextChannels that aren't from the same guild!"); if (this.getPositionRaw() != chan.getPositionRaw()) return chan.getPositionRaw() - this.getPositionRaw(); OffsetDateTime thisTime = MiscUtil.getCreationTime(this); OffsetDateTime chanTime = MiscUtil.getCreationTime(chan); //We compare the provided channel's time to this's time instead of the reverse as one would expect due to how // discord deals with hierarchy. The more recent a channel was created, the lower its hierarchy ranking when // it shares the same position as another channel. return chanTime.compareTo(thisTime); }