QJCC homepage

biz.chitec.quarterback.util
Class EDateUtilities

java.lang.Object
  extended bybiz.chitec.quarterback.util.EDateUtilities

public final class EDateUtilities
extends java.lang.Object

Some helper classes for working with EDates.

Version:
$Id: 20efefc8a564a17c626ebe52c88ad04e694e1267 $
Author:
chitec/Dirk Hillbrecht 2002, cantamen/Dirk Hillbrecht 2004 Distributed under the terms of the GNU LGPL.

Nested Class Summary
private static class EDateUtilities.EDateCanonicalRangeIterator
          Returns series of time ranges with a certain standard length and canonified start- and enddates.
private static class EDateUtilities.EDateDayOfWeekIterator
          Iterator for dates between start and end which belong to certain weekdays.
private static class EDateUtilities.EDateIntervalIterator
          Iterator for equally distanced date values.
private static class EDateUtilities.EDateMonthlyIterator
          Iterator for equally distanced date values.
private static class EDateUtilities.EDateRangeIterator
          Returns series of time ranges with a certain standard length.
 
Constructor Summary
private EDateUtilities()
           
 
Method Summary
static java.util.Iterator getCanonicalTimeRangeIterator(EDate start, EDate end, int rangesymbol)
          Returns series of canonical time ranges.
static java.util.Iterator getDayOfWeekIterator(EDate start, EDate end, int[] dow, boolean includestart)
          Return an iterator which delivers dates on certain days of the week.
static java.util.Iterator getIntervalIterator(EDate start, EDate end, EDate ivsize)
          Return an iterator which delivers equally-distanced dates between start (inclusive) and end (exclusive).
static java.util.Iterator getMonthlyIterator(EDate start, EDate end, int monthforstep, int dayofmonth)
          Return an iterator which delivers dates of the same day in different months.
static java.util.Iterator getTimeRangeIterator(EDate start, EDate end, int rangesymbol)
          Returns series of time ranges with equal length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EDateUtilities

private EDateUtilities()
Method Detail

getIntervalIterator

public static java.util.Iterator getIntervalIterator(EDate start,
                                                     EDate end,
                                                     EDate ivsize)
Return an iterator which delivers equally-distanced dates between start (inclusive) and end (exclusive). Iterator starts with start date and increments delivered dates by ivsize as long as returned value is smaller than end.


getMonthlyIterator

public static java.util.Iterator getMonthlyIterator(EDate start,
                                                    EDate end,
                                                    int monthforstep,
                                                    int dayofmonth)
Return an iterator which delivers dates of the same day in different months. Iterator starts with the first day of a month being equal or greater than start and delivers dates until end is reached (exclusive end value itself). Months are incremented by monthforstep, dates are delivered with given day of month. If day of month does not exist for certain month, nearest smaller day of the same month is delivered.


getDayOfWeekIterator

public static java.util.Iterator getDayOfWeekIterator(EDate start,
                                                      EDate end,
                                                      int[] dow,
                                                      boolean includestart)
Return an iterator which delivers dates on certain days of the week. Iterator starts with start value or first matching days after start value or start value itself (regardless of its matching against wanted days of the week) according to withstart parameter, wanted days of the week are passed in third parameter. Start and end (always excluded) are passed as first and second parameter.


getTimeRangeIterator

public static java.util.Iterator getTimeRangeIterator(EDate start,
                                                      EDate end,
                                                      int rangesymbol)
Returns series of time ranges with equal length. The first returned time range starts at the start date. The last timerange ends with or surrounds the end date, with start being earlier than the given end date and the time range's end being later than or equal to the given end date.

Parameters:
start - Start date for time ranges
end - End date for time ranges
rangesymbol - TimeRangsSymbol as in EDateRangeSymbols
Returns:
Iterator returning EDateRange objects

getCanonicalTimeRangeIterator

public static java.util.Iterator getCanonicalTimeRangeIterator(EDate start,
                                                               EDate end,
                                                               int rangesymbol)
Returns series of canonical time ranges. The first returned time range surrounds the start date with start being earlier or equal to the given start date and end to be later then the given start date. The last timerange ends with or surrounds the end date, with start being earlier than the given end date and the time range's end being later than or equal to the given end date.

Parameters:
start - Start date for time ranges
end - End date for time ranges
rangesymbol - TimeRangsSymbol as in EDateRangeSymbols
Returns:
Iterator returning EDateRange objects

QJCC homepage