/** * <p>Compare Times (hour, minute, second and millisecond - not date).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * time is less than the seconds and +1 if the first * time is greater than. */ public int compareTime(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MILLISECOND); }
/** * <p>Compare Hours.</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's hour is less than the seconds and +1 if the first * parameter's hour is greater than. */ public int compareHours(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.HOUR_OF_DAY); }
/** * <p>Compare Minutes (hours and minutes).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's minutes are less than the seconds and +1 if the first * parameter's minutes are greater than. */ public int compareMinutes(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MINUTE); }
/** * <p>Compare Seconds (hours, minutes and seconds).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's seconds are less than the seconds and +1 if the first * parameter's seconds are greater than. */ public int compareSeconds(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.SECOND); }
Calendar hourLess = createTime(GMT, testTime - hour, 100); // -1 hour assertEquals("mili LT", -1, validator.compareTime(value, milliGreater)); // > milli assertEquals("mili EQ", 0, validator.compareTime(value, value)); // same time assertEquals("mili GT", 1, validator.compareTime(value, milliLess)); // < milli
/** * <p>Compare Hours.</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's hour is less than the seconds and +1 if the first * parameter's hour is greater than. */ public int compareHours(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.HOUR_OF_DAY); }
/** * <p>Compare Times (hour, minute, second and millisecond - not date).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * time is less than the seconds and +1 if the first * time is greater than. */ public int compareTime(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MILLISECOND); }
/** * <p>Compare Hours.</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's hour is less than the seconds and +1 if the first * parameter's hour is greater than. */ public int compareHours(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.HOUR_OF_DAY); }
/** * <p>Compare Times (hour, minute, second and millisecond - not date).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * time is less than the seconds and +1 if the first * time is greater than. */ public int compareTime(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MILLISECOND); }
/** * <p>Compare Seconds (hours, minutes and seconds).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's seconds are less than the seconds and +1 if the first * parameter's seconds are greater than. */ public int compareSeconds(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.SECOND); }
/** * <p>Compare Minutes (hours and minutes).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's minutes are less than the seconds and +1 if the first * parameter's minutes are greater than. */ public int compareMinutes(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MINUTE); }
/** * <p>Compare Seconds (hours, minutes and seconds).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's seconds are less than the seconds and +1 if the first * parameter's seconds are greater than. */ public int compareSeconds(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.SECOND); }
/** * <p>Compare Minutes (hours and minutes).</p> * * @param value The <code>Calendar</code> value to check. * @param compare The <code>Calendar</code> to compare the value to. * @return Zero if the hours are equal, -1 if first * parameter's minutes are less than the seconds and +1 if the first * parameter's minutes are greater than. */ public int compareMinutes(Calendar value, Calendar compare) { return compareTime(value, compare, Calendar.MINUTE); }