/** * <p>isZero</p> * * @return a boolean. */ public boolean isZero() { return this.equals(ZERO); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FixedPollInterval)) return false; FixedPollInterval that = (FixedPollInterval) o; return duration.equals(that.duration); }
protected Duration handleSpecialCases(Duration lhs, Duration rhs) { if (lhs == FOREVER) { return FOREVER; } else if (rhs == FOREVER) { throw new IllegalArgumentException("Cannot divide by infinity"); } else if (ZERO.equals(lhs)) { return ZERO; } return null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof IterativePollInterval)) return false; IterativePollInterval that = (IterativePollInterval) o; return function.equals(that.function) && startDuration.equals(that.startDuration); }
private long getRemainingTimeInMS(long elapsedTimeInMS, Duration maxWaitTime) { return maxWaitTime.equals(Duration.FOREVER) ? Long.MAX_VALUE : maxWaitTime.getValueInMS() - elapsedTimeInMS; }
protected Duration handleSpecialCases(Duration lhs, Duration rhs) { if (!lhs.isZero() && rhs.isZero()) { return lhs; } else if (lhs == FOREVER) { return FOREVER; } else if (rhs == FOREVER) { return ZERO; } else if (FOREVER.equals(rhs)) { return ZERO; } return null; }
@Test public void duration_is_equal_to_other_duration_if_number_of_milliseconds_are_the_same() { // Given final Duration duration1 = new Duration(1000, MILLISECONDS); final Duration duration2 = new Duration(1, SECONDS); // When final boolean equals = duration1.equals(duration2); // Then assertThat(equals, is(true)); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FixedPollInterval)) return false; FixedPollInterval that = (FixedPollInterval) o; return duration.equals(that.duration); }
/** * <p>isZero</p> * * @return a boolean. */ public boolean isZero() { return this.equals(ZERO); }
protected Duration handleSpecialCases(Duration lhs, Duration rhs) { if (lhs == FOREVER) { return FOREVER; } else if (rhs == FOREVER) { throw new IllegalArgumentException("Cannot divide by infinity"); } else if (ZERO.equals(lhs)) { return ZERO; } return null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof IterativePollInterval)) return false; IterativePollInterval that = (IterativePollInterval) o; return function.equals(that.function) && startDuration.equals(that.startDuration); }
private long getRemainingTimeInMS(long elapsedTimeInMS, Duration maxWaitTime) { return maxWaitTime.equals(Duration.FOREVER) ? Long.MAX_VALUE : maxWaitTime.getValueInMS() - elapsedTimeInMS; }
protected Duration handleSpecialCases(Duration lhs, Duration rhs) { if (!lhs.isZero() && rhs.isZero()) { return lhs; } else if (lhs == FOREVER) { return FOREVER; } else if (rhs == FOREVER) { return ZERO; } else if (FOREVER.equals(rhs)) { return ZERO; } return null; }