@Test public void testMin() { final TimeValue nanos1 = TimeValue.ofNanoseconds(1); final TimeValue micros1 = TimeValue.ofMicroseconds(1); final TimeValue millis1 = TimeValue.ofMilliseconds(1); final TimeValue seconds1 = TimeValue.ofSeconds(1); final TimeValue minutes1 = TimeValue.ofMinutes(1); final TimeValue hours1 = TimeValue.ofHours(1); final TimeValue days1 = TimeValue.ofDays(1); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(nanos1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(micros1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(millis1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(seconds1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(minutes1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(hours1)); Assert.assertEquals(TimeValue.ZERO_MILLISECONDS, TimeValue.ZERO_MILLISECONDS.min(days1)); Assert.assertEquals(nanos1, nanos1.min(nanos1)); Assert.assertEquals(nanos1, nanos1.min(micros1)); Assert.assertEquals(nanos1, nanos1.min(millis1)); Assert.assertEquals(nanos1, nanos1.min(seconds1)); Assert.assertEquals(nanos1, nanos1.min(minutes1)); Assert.assertEquals(nanos1, nanos1.min(hours1)); Assert.assertEquals(nanos1, nanos1.min(days1)); Assert.assertEquals(nanos1, micros1.min(nanos1)); Assert.assertEquals(micros1, micros1.min(micros1)); Assert.assertEquals(micros1, micros1.min(millis1)); Assert.assertEquals(micros1, micros1.min(seconds1)); Assert.assertEquals(micros1, micros1.min(minutes1)); Assert.assertEquals(micros1, micros1.min(hours1)); Assert.assertEquals(micros1, micros1.min(days1)); Assert.assertEquals(nanos1, millis1.min(nanos1)); Assert.assertEquals(micros1, millis1.min(micros1)); Assert.assertEquals(millis1, millis1.min(millis1)); Assert.assertEquals(millis1, millis1.min(seconds1)); Assert.assertEquals(millis1, millis1.min(minutes1)); Assert.assertEquals(millis1, millis1.min(hours1)); Assert.assertEquals(millis1, millis1.min(days1)); Assert.assertEquals(nanos1, seconds1.min(nanos1)); Assert.assertEquals(micros1, seconds1.min(micros1)); Assert.assertEquals(millis1, seconds1.min(millis1)); Assert.assertEquals(seconds1, seconds1.min(seconds1)); Assert.assertEquals(seconds1, seconds1.min(minutes1)); Assert.assertEquals(seconds1, seconds1.min(hours1)); Assert.assertEquals(seconds1, seconds1.min(days1)); Assert.assertEquals(nanos1, minutes1.min(nanos1)); Assert.assertEquals(micros1, minutes1.min(micros1)); Assert.assertEquals(millis1, minutes1.min(millis1)); Assert.assertEquals(seconds1, minutes1.min(seconds1)); Assert.assertEquals(minutes1, minutes1.min(minutes1)); Assert.assertEquals(minutes1, minutes1.min(hours1)); Assert.assertEquals(minutes1, minutes1.min(days1)); Assert.assertEquals(nanos1, hours1.min(nanos1)); Assert.assertEquals(micros1, hours1.min(micros1)); Assert.assertEquals(millis1, hours1.min(millis1)); Assert.assertEquals(seconds1, hours1.min(seconds1)); Assert.assertEquals(minutes1, hours1.min(minutes1)); Assert.assertEquals(hours1, hours1.min(hours1)); Assert.assertEquals(hours1, hours1.min(days1)); Assert.assertEquals(nanos1, days1.min(nanos1)); Assert.assertEquals(micros1, days1.min(micros1)); Assert.assertEquals(millis1, days1.min(millis1)); Assert.assertEquals(seconds1, days1.min(seconds1)); Assert.assertEquals(minutes1, days1.min(minutes1)); Assert.assertEquals(hours1, days1.min(hours1)); Assert.assertEquals(days1, days1.min(days1)); }
public TimeValue min(final TimeValue other) { return this.compareTo(other) > 0 ? other : this; }
TimeValue implements Comparable<TimeValue> { public TimeValue min(final TimeValue other) { return this.compareTo(other) > 0 ? other : this; } }
TimeValue implements Comparable<TimeValue> { public TimeValue min(final TimeValue other) { return this.compareTo(other) > 0 ? other : this; } TimeValue(final long duration, final TimeUnit timeUnit); }
TimeValue implements Comparable<TimeValue> { public TimeValue min(final TimeValue other) { return this.compareTo(other) > 0 ? other : this; } TimeValue(final long duration, final TimeUnit timeUnit); static int asBoundInt(final long value); static T defaultsTo(final T timeValue, final T defaultValue); static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue); static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue); static TimeValue defaultsToZeroMilliseconds(final TimeValue timeValue); static boolean isNonNegative(final TimeValue timeValue); static boolean isPositive(final TimeValue timeValue); static TimeValue of(final long duration, final TimeUnit timeUnit); static TimeValue ofDays(final long days); static TimeValue ofHours(final long hours); static TimeValue ofMicroseconds(final long microseconds); static TimeValue ofMilliseconds(final long millis); static TimeValue ofMinutes(final long minutes); static TimeValue ofNanoseconds(final long nanoseconds); static TimeValue ofSeconds(final long seconds); static TimeValue parse(final String value); long convert(final TimeUnit targetTimeUnit); @Override boolean equals(final Object obj); TimeValue divide(final long divisor); TimeValue divide(final long divisor, final TimeUnit targetTimeUnit); long getDuration(); TimeUnit getTimeUnit(); @Override int hashCode(); TimeValue min(final TimeValue other); void sleep(); void timedJoin(final Thread thread); void timedWait(final Object obj); long toDays(); long toHours(); long toMicroseconds(); long toMilliseconds(); int toMillisecondsIntBound(); long toMinutes(); long toNanoseconds(); long toSeconds(); int toSecondsIntBound(); @Override int compareTo(final TimeValue other); @Override String toString(); Timeout toTimeout(); }
TimeValue implements Comparable<TimeValue> { public TimeValue min(final TimeValue other) { return this.compareTo(other) > 0 ? other : this; } TimeValue(final long duration, final TimeUnit timeUnit); static int asBoundInt(final long value); static T defaultsTo(final T timeValue, final T defaultValue); static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue); static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue); static TimeValue defaultsToZeroMilliseconds(final TimeValue timeValue); static boolean isNonNegative(final TimeValue timeValue); static boolean isPositive(final TimeValue timeValue); static TimeValue of(final long duration, final TimeUnit timeUnit); static TimeValue ofDays(final long days); static TimeValue ofHours(final long hours); static TimeValue ofMicroseconds(final long microseconds); static TimeValue ofMilliseconds(final long millis); static TimeValue ofMinutes(final long minutes); static TimeValue ofNanoseconds(final long nanoseconds); static TimeValue ofSeconds(final long seconds); static TimeValue parse(final String value); long convert(final TimeUnit targetTimeUnit); @Override boolean equals(final Object obj); TimeValue divide(final long divisor); TimeValue divide(final long divisor, final TimeUnit targetTimeUnit); long getDuration(); TimeUnit getTimeUnit(); @Override int hashCode(); TimeValue min(final TimeValue other); void sleep(); void timedJoin(final Thread thread); void timedWait(final Object obj); long toDays(); long toHours(); long toMicroseconds(); long toMilliseconds(); int toMillisecondsIntBound(); long toMinutes(); long toNanoseconds(); long toSeconds(); int toSecondsIntBound(); @Override int compareTo(final TimeValue other); @Override String toString(); Timeout toTimeout(); static final TimeValue MAX_VALUE; static final TimeValue NEG_ONE_MILLISECOND; static final TimeValue NEG_ONE_SECOND; static final TimeValue ZERO_MILLISECONDS; }