@Test public void testEvaluate() throws Exception { final VariableTime vt = new VariableTime(30, 4, 3, 4, 12, 1972); TimeEvaluator timeEvaluator = new TimeEvaluator(vt, TimeZone.getTimeZone("EST")); Date now = new Date(); int result1 = timeEvaluator.evaluate(now, true); int result2 = timeEvaluator.evaluate(now, false); assertTrue(result1 > 0); assertTrue(result2 > 0); }
public int evaluate(Date reference, boolean usePastDow) { Calendar referenceCal = Calendar.getInstance(); referenceCal.setTimeZone(reportRequestorTimeZone); referenceCal.setTime(reference); Integer year = time.getYear(); if (year != null) { if (year >= -499 && year <= -1) { referenceCal.add(Calendar.YEAR, year); log.debug("year time in the past " + referenceCal.getTime() + ". year value was " + year); } else if (year > 1000 && year < 1900) { referenceCal.add(Calendar.YEAR, (year - 1000)); log.debug("year time in the future " + referenceCal.getTime() + ". year value was " + year); } else if (year >= 1900) { referenceCal.set(Calendar.YEAR, year); } else { log.warn("Invalid year value " + year); } } Integer month = time.getMonth(); if (month != null) { if (month >= 0) { if (month > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MONTH, (month - FUTURE_PLACEHOLDER)); log.debug("month time in the future " + referenceCal.getTime() + ". month value was " + month); } else { referenceCal.set(Calendar.MONTH, month - 1); } } else { referenceCal.add(Calendar.MONTH, month); log.debug("month time in the past " + referenceCal.getTime() + ". month value was " + month); } } Integer dayofmonth = time.getDayOfMonth(); if (dayofmonth != null) { log.debug("dayofmonth"); if (dayofmonth >= 0) { if (dayofmonth > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.DAY_OF_MONTH, (dayofmonth - FUTURE_PLACEHOLDER)); log.debug("dayofmonth time in the future " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { if (dayofmonth == 31) { int actualDayofmonth = referenceCal.getActualMaximum(Calendar.DAY_OF_MONTH); referenceCal.set(Calendar.DAY_OF_MONTH, actualDayofmonth); log.debug("dayofmonth time " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { referenceCal.set(Calendar.DAY_OF_MONTH, dayofmonth); } } } else { referenceCal.add(Calendar.DAY_OF_MONTH, dayofmonth); log.debug("dayofmonth time in the past " + referenceCal.getTime()); } } Integer dayofweek = time.getDayOfWeek(); if (dayofweek != null) { if (dayofweek >= 0) { if (dayofweek > FUTURE_PLACEHOLDER) { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow - (dayofweek - FUTURE_PLACEHOLDER); if (correctionFactor == 0) { referenceCal.add(Calendar.DATE, 7); } else if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, 1 * (7 - correctionFactor)); } else { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } log.debug("dayofweek time in the future " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } else { int refDow = referenceCal.get(Calendar.DAY_OF_WEEK); if (usePastDow) { if (dayofweek > refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, -1); referenceCal.getTime(); } } else { if (dayofweek < refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, 1); referenceCal.getTime(); } } referenceCal.set(Calendar.DAY_OF_WEEK, dayofweek); } } else { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow + dayofweek; if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } else { referenceCal.add(Calendar.DATE, -1 * (7 + correctionFactor)); } log.debug( "dayofweek time in the past " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } } Integer hour = time.getHour(); if (hour != null) { if (hour >= 0) { if (hour > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.HOUR_OF_DAY, (hour - FUTURE_PLACEHOLDER)); log.debug("hour time in the future " + referenceCal.getTime() + ". hour value was " + hour); } else { referenceCal.set(Calendar.HOUR_OF_DAY, hour); } } else { referenceCal.add(Calendar.HOUR_OF_DAY, hour); log.debug("hour time in the past " + referenceCal.getTime() + ". hour value was " + hour); } } Integer minute = time.getMinute(); if (minute != null) { if (minute >= 0) { if (minute > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MINUTE, (minute - FUTURE_PLACEHOLDER)); log.debug("minute time in the future " + referenceCal.getTime() + ". minute value was " + minute); } else { referenceCal.set(Calendar.MINUTE, minute); } } else { referenceCal.add(Calendar.MINUTE, minute); log.debug("minute time in the past " + referenceCal.getTime() + ". minute value was " + minute); } } return (int) (referenceCal.getTimeInMillis() / 1000); }
TimeEvaluator { public int evaluate(Date reference, boolean usePastDow) { Calendar referenceCal = Calendar.getInstance(); referenceCal.setTimeZone(reportRequestorTimeZone); referenceCal.setTime(reference); Integer year = time.getYear(); if (year != null) { if (year >= -499 && year <= -1) { referenceCal.add(Calendar.YEAR, year); log.debug("year time in the past " + referenceCal.getTime() + ". year value was " + year); } else if (year > 1000 && year < 1900) { referenceCal.add(Calendar.YEAR, (year - 1000)); log.debug("year time in the future " + referenceCal.getTime() + ". year value was " + year); } else if (year >= 1900) { referenceCal.set(Calendar.YEAR, year); } else { log.warn("Invalid year value " + year); } } Integer month = time.getMonth(); if (month != null) { if (month >= 0) { if (month > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MONTH, (month - FUTURE_PLACEHOLDER)); log.debug("month time in the future " + referenceCal.getTime() + ". month value was " + month); } else { referenceCal.set(Calendar.MONTH, month - 1); } } else { referenceCal.add(Calendar.MONTH, month); log.debug("month time in the past " + referenceCal.getTime() + ". month value was " + month); } } Integer dayofmonth = time.getDayOfMonth(); if (dayofmonth != null) { log.debug("dayofmonth"); if (dayofmonth >= 0) { if (dayofmonth > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.DAY_OF_MONTH, (dayofmonth - FUTURE_PLACEHOLDER)); log.debug("dayofmonth time in the future " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { if (dayofmonth == 31) { int actualDayofmonth = referenceCal.getActualMaximum(Calendar.DAY_OF_MONTH); referenceCal.set(Calendar.DAY_OF_MONTH, actualDayofmonth); log.debug("dayofmonth time " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { referenceCal.set(Calendar.DAY_OF_MONTH, dayofmonth); } } } else { referenceCal.add(Calendar.DAY_OF_MONTH, dayofmonth); log.debug("dayofmonth time in the past " + referenceCal.getTime()); } } Integer dayofweek = time.getDayOfWeek(); if (dayofweek != null) { if (dayofweek >= 0) { if (dayofweek > FUTURE_PLACEHOLDER) { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow - (dayofweek - FUTURE_PLACEHOLDER); if (correctionFactor == 0) { referenceCal.add(Calendar.DATE, 7); } else if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, 1 * (7 - correctionFactor)); } else { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } log.debug("dayofweek time in the future " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } else { int refDow = referenceCal.get(Calendar.DAY_OF_WEEK); if (usePastDow) { if (dayofweek > refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, -1); referenceCal.getTime(); } } else { if (dayofweek < refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, 1); referenceCal.getTime(); } } referenceCal.set(Calendar.DAY_OF_WEEK, dayofweek); } } else { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow + dayofweek; if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } else { referenceCal.add(Calendar.DATE, -1 * (7 + correctionFactor)); } log.debug( "dayofweek time in the past " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } } Integer hour = time.getHour(); if (hour != null) { if (hour >= 0) { if (hour > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.HOUR_OF_DAY, (hour - FUTURE_PLACEHOLDER)); log.debug("hour time in the future " + referenceCal.getTime() + ". hour value was " + hour); } else { referenceCal.set(Calendar.HOUR_OF_DAY, hour); } } else { referenceCal.add(Calendar.HOUR_OF_DAY, hour); log.debug("hour time in the past " + referenceCal.getTime() + ". hour value was " + hour); } } Integer minute = time.getMinute(); if (minute != null) { if (minute >= 0) { if (minute > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MINUTE, (minute - FUTURE_PLACEHOLDER)); log.debug("minute time in the future " + referenceCal.getTime() + ". minute value was " + minute); } else { referenceCal.set(Calendar.MINUTE, minute); } } else { referenceCal.add(Calendar.MINUTE, minute); log.debug("minute time in the past " + referenceCal.getTime() + ". minute value was " + minute); } } return (int) (referenceCal.getTimeInMillis() / 1000); } }
TimeEvaluator { public int evaluate(Date reference, boolean usePastDow) { Calendar referenceCal = Calendar.getInstance(); referenceCal.setTimeZone(reportRequestorTimeZone); referenceCal.setTime(reference); Integer year = time.getYear(); if (year != null) { if (year >= -499 && year <= -1) { referenceCal.add(Calendar.YEAR, year); log.debug("year time in the past " + referenceCal.getTime() + ". year value was " + year); } else if (year > 1000 && year < 1900) { referenceCal.add(Calendar.YEAR, (year - 1000)); log.debug("year time in the future " + referenceCal.getTime() + ". year value was " + year); } else if (year >= 1900) { referenceCal.set(Calendar.YEAR, year); } else { log.warn("Invalid year value " + year); } } Integer month = time.getMonth(); if (month != null) { if (month >= 0) { if (month > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MONTH, (month - FUTURE_PLACEHOLDER)); log.debug("month time in the future " + referenceCal.getTime() + ". month value was " + month); } else { referenceCal.set(Calendar.MONTH, month - 1); } } else { referenceCal.add(Calendar.MONTH, month); log.debug("month time in the past " + referenceCal.getTime() + ". month value was " + month); } } Integer dayofmonth = time.getDayOfMonth(); if (dayofmonth != null) { log.debug("dayofmonth"); if (dayofmonth >= 0) { if (dayofmonth > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.DAY_OF_MONTH, (dayofmonth - FUTURE_PLACEHOLDER)); log.debug("dayofmonth time in the future " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { if (dayofmonth == 31) { int actualDayofmonth = referenceCal.getActualMaximum(Calendar.DAY_OF_MONTH); referenceCal.set(Calendar.DAY_OF_MONTH, actualDayofmonth); log.debug("dayofmonth time " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { referenceCal.set(Calendar.DAY_OF_MONTH, dayofmonth); } } } else { referenceCal.add(Calendar.DAY_OF_MONTH, dayofmonth); log.debug("dayofmonth time in the past " + referenceCal.getTime()); } } Integer dayofweek = time.getDayOfWeek(); if (dayofweek != null) { if (dayofweek >= 0) { if (dayofweek > FUTURE_PLACEHOLDER) { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow - (dayofweek - FUTURE_PLACEHOLDER); if (correctionFactor == 0) { referenceCal.add(Calendar.DATE, 7); } else if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, 1 * (7 - correctionFactor)); } else { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } log.debug("dayofweek time in the future " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } else { int refDow = referenceCal.get(Calendar.DAY_OF_WEEK); if (usePastDow) { if (dayofweek > refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, -1); referenceCal.getTime(); } } else { if (dayofweek < refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, 1); referenceCal.getTime(); } } referenceCal.set(Calendar.DAY_OF_WEEK, dayofweek); } } else { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow + dayofweek; if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } else { referenceCal.add(Calendar.DATE, -1 * (7 + correctionFactor)); } log.debug( "dayofweek time in the past " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } } Integer hour = time.getHour(); if (hour != null) { if (hour >= 0) { if (hour > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.HOUR_OF_DAY, (hour - FUTURE_PLACEHOLDER)); log.debug("hour time in the future " + referenceCal.getTime() + ". hour value was " + hour); } else { referenceCal.set(Calendar.HOUR_OF_DAY, hour); } } else { referenceCal.add(Calendar.HOUR_OF_DAY, hour); log.debug("hour time in the past " + referenceCal.getTime() + ". hour value was " + hour); } } Integer minute = time.getMinute(); if (minute != null) { if (minute >= 0) { if (minute > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MINUTE, (minute - FUTURE_PLACEHOLDER)); log.debug("minute time in the future " + referenceCal.getTime() + ". minute value was " + minute); } else { referenceCal.set(Calendar.MINUTE, minute); } } else { referenceCal.add(Calendar.MINUTE, minute); log.debug("minute time in the past " + referenceCal.getTime() + ". minute value was " + minute); } } return (int) (referenceCal.getTimeInMillis() / 1000); } TimeEvaluator(IVariableTime time, TimeZone reportRequestorTimeZone); }
TimeEvaluator { public int evaluate(Date reference, boolean usePastDow) { Calendar referenceCal = Calendar.getInstance(); referenceCal.setTimeZone(reportRequestorTimeZone); referenceCal.setTime(reference); Integer year = time.getYear(); if (year != null) { if (year >= -499 && year <= -1) { referenceCal.add(Calendar.YEAR, year); log.debug("year time in the past " + referenceCal.getTime() + ". year value was " + year); } else if (year > 1000 && year < 1900) { referenceCal.add(Calendar.YEAR, (year - 1000)); log.debug("year time in the future " + referenceCal.getTime() + ". year value was " + year); } else if (year >= 1900) { referenceCal.set(Calendar.YEAR, year); } else { log.warn("Invalid year value " + year); } } Integer month = time.getMonth(); if (month != null) { if (month >= 0) { if (month > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MONTH, (month - FUTURE_PLACEHOLDER)); log.debug("month time in the future " + referenceCal.getTime() + ". month value was " + month); } else { referenceCal.set(Calendar.MONTH, month - 1); } } else { referenceCal.add(Calendar.MONTH, month); log.debug("month time in the past " + referenceCal.getTime() + ". month value was " + month); } } Integer dayofmonth = time.getDayOfMonth(); if (dayofmonth != null) { log.debug("dayofmonth"); if (dayofmonth >= 0) { if (dayofmonth > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.DAY_OF_MONTH, (dayofmonth - FUTURE_PLACEHOLDER)); log.debug("dayofmonth time in the future " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { if (dayofmonth == 31) { int actualDayofmonth = referenceCal.getActualMaximum(Calendar.DAY_OF_MONTH); referenceCal.set(Calendar.DAY_OF_MONTH, actualDayofmonth); log.debug("dayofmonth time " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { referenceCal.set(Calendar.DAY_OF_MONTH, dayofmonth); } } } else { referenceCal.add(Calendar.DAY_OF_MONTH, dayofmonth); log.debug("dayofmonth time in the past " + referenceCal.getTime()); } } Integer dayofweek = time.getDayOfWeek(); if (dayofweek != null) { if (dayofweek >= 0) { if (dayofweek > FUTURE_PLACEHOLDER) { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow - (dayofweek - FUTURE_PLACEHOLDER); if (correctionFactor == 0) { referenceCal.add(Calendar.DATE, 7); } else if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, 1 * (7 - correctionFactor)); } else { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } log.debug("dayofweek time in the future " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } else { int refDow = referenceCal.get(Calendar.DAY_OF_WEEK); if (usePastDow) { if (dayofweek > refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, -1); referenceCal.getTime(); } } else { if (dayofweek < refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, 1); referenceCal.getTime(); } } referenceCal.set(Calendar.DAY_OF_WEEK, dayofweek); } } else { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow + dayofweek; if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } else { referenceCal.add(Calendar.DATE, -1 * (7 + correctionFactor)); } log.debug( "dayofweek time in the past " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } } Integer hour = time.getHour(); if (hour != null) { if (hour >= 0) { if (hour > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.HOUR_OF_DAY, (hour - FUTURE_PLACEHOLDER)); log.debug("hour time in the future " + referenceCal.getTime() + ". hour value was " + hour); } else { referenceCal.set(Calendar.HOUR_OF_DAY, hour); } } else { referenceCal.add(Calendar.HOUR_OF_DAY, hour); log.debug("hour time in the past " + referenceCal.getTime() + ". hour value was " + hour); } } Integer minute = time.getMinute(); if (minute != null) { if (minute >= 0) { if (minute > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MINUTE, (minute - FUTURE_PLACEHOLDER)); log.debug("minute time in the future " + referenceCal.getTime() + ". minute value was " + minute); } else { referenceCal.set(Calendar.MINUTE, minute); } } else { referenceCal.add(Calendar.MINUTE, minute); log.debug("minute time in the past " + referenceCal.getTime() + ". minute value was " + minute); } } return (int) (referenceCal.getTimeInMillis() / 1000); } TimeEvaluator(IVariableTime time, TimeZone reportRequestorTimeZone); int evaluate(Date reference, boolean usePastDow); long getTime(Date stime, long baseTime); }
TimeEvaluator { public int evaluate(Date reference, boolean usePastDow) { Calendar referenceCal = Calendar.getInstance(); referenceCal.setTimeZone(reportRequestorTimeZone); referenceCal.setTime(reference); Integer year = time.getYear(); if (year != null) { if (year >= -499 && year <= -1) { referenceCal.add(Calendar.YEAR, year); log.debug("year time in the past " + referenceCal.getTime() + ". year value was " + year); } else if (year > 1000 && year < 1900) { referenceCal.add(Calendar.YEAR, (year - 1000)); log.debug("year time in the future " + referenceCal.getTime() + ". year value was " + year); } else if (year >= 1900) { referenceCal.set(Calendar.YEAR, year); } else { log.warn("Invalid year value " + year); } } Integer month = time.getMonth(); if (month != null) { if (month >= 0) { if (month > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MONTH, (month - FUTURE_PLACEHOLDER)); log.debug("month time in the future " + referenceCal.getTime() + ". month value was " + month); } else { referenceCal.set(Calendar.MONTH, month - 1); } } else { referenceCal.add(Calendar.MONTH, month); log.debug("month time in the past " + referenceCal.getTime() + ". month value was " + month); } } Integer dayofmonth = time.getDayOfMonth(); if (dayofmonth != null) { log.debug("dayofmonth"); if (dayofmonth >= 0) { if (dayofmonth > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.DAY_OF_MONTH, (dayofmonth - FUTURE_PLACEHOLDER)); log.debug("dayofmonth time in the future " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { if (dayofmonth == 31) { int actualDayofmonth = referenceCal.getActualMaximum(Calendar.DAY_OF_MONTH); referenceCal.set(Calendar.DAY_OF_MONTH, actualDayofmonth); log.debug("dayofmonth time " + referenceCal.getTime() + ". dayofmonth value was " + dayofmonth); } else { referenceCal.set(Calendar.DAY_OF_MONTH, dayofmonth); } } } else { referenceCal.add(Calendar.DAY_OF_MONTH, dayofmonth); log.debug("dayofmonth time in the past " + referenceCal.getTime()); } } Integer dayofweek = time.getDayOfWeek(); if (dayofweek != null) { if (dayofweek >= 0) { if (dayofweek > FUTURE_PLACEHOLDER) { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow - (dayofweek - FUTURE_PLACEHOLDER); if (correctionFactor == 0) { referenceCal.add(Calendar.DATE, 7); } else if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, 1 * (7 - correctionFactor)); } else { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } log.debug("dayofweek time in the future " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } else { int refDow = referenceCal.get(Calendar.DAY_OF_WEEK); if (usePastDow) { if (dayofweek > refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, -1); referenceCal.getTime(); } } else { if (dayofweek < refDow) { referenceCal.add(Calendar.WEEK_OF_YEAR, 1); referenceCal.getTime(); } } referenceCal.set(Calendar.DAY_OF_WEEK, dayofweek); } } else { int dowNow = referenceCal.get(Calendar.DAY_OF_WEEK); int correctionFactor = dowNow + dayofweek; if (correctionFactor > 0) { referenceCal.add(Calendar.DATE, -1 * correctionFactor); } else { referenceCal.add(Calendar.DATE, -1 * (7 + correctionFactor)); } log.debug( "dayofweek time in the past " + referenceCal.getTime() + ". dayofweek value was " + dayofweek); } } Integer hour = time.getHour(); if (hour != null) { if (hour >= 0) { if (hour > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.HOUR_OF_DAY, (hour - FUTURE_PLACEHOLDER)); log.debug("hour time in the future " + referenceCal.getTime() + ". hour value was " + hour); } else { referenceCal.set(Calendar.HOUR_OF_DAY, hour); } } else { referenceCal.add(Calendar.HOUR_OF_DAY, hour); log.debug("hour time in the past " + referenceCal.getTime() + ". hour value was " + hour); } } Integer minute = time.getMinute(); if (minute != null) { if (minute >= 0) { if (minute > FUTURE_PLACEHOLDER) { referenceCal.add(Calendar.MINUTE, (minute - FUTURE_PLACEHOLDER)); log.debug("minute time in the future " + referenceCal.getTime() + ". minute value was " + minute); } else { referenceCal.set(Calendar.MINUTE, minute); } } else { referenceCal.add(Calendar.MINUTE, minute); log.debug("minute time in the past " + referenceCal.getTime() + ". minute value was " + minute); } } return (int) (referenceCal.getTimeInMillis() / 1000); } TimeEvaluator(IVariableTime time, TimeZone reportRequestorTimeZone); int evaluate(Date reference, boolean usePastDow); long getTime(Date stime, long baseTime); static final int FUTURE_PLACEHOLDER; }