com.miginfocom.util.dates
Interface DateRangeI

All Superinterfaces:
java.lang.Comparable, java.io.Serializable, TimeSpan
All Known Subinterfaces:
MutableDateRange
All Known Implementing Classes:
DateRange, ImmutableDateRange

public interface DateRangeI
extends java.io.Serializable, TimeSpan, java.lang.Comparable

Basic interface for a date range. Contains only the get methods. MutableDateRange extends this interface with set methods.
Consists of two dates and a lot of convenient methods for these.
The end date (and time) stored is "inclusive", which means that if a range for example spans exactly one whole day, both start and end date will be in that day. However this also have a downside in that the spanned number of milliseconds is one less that it actually are. For instance one day is from: 00:00:00:000 to 23:59:59:999.
Sometimes this is wanted when returning the end date. E.g. to check which date the range ends, the returned date should be "inclusive", but if the returned values are to be used for labels showing the start and end times (10.00 -> 11.00) the returned value should be excluding (i.e. increased by one).
Therefore the methods returning the end date has a boolean to let you choose if the returned date should be inclusive (not tipped over, or normally millis set to 999) or excluding (normally millis set to 000).
Currently there is no way to represent one single point in time (spanning 0 milliseconds) since by definition, that is not a range. This can be simulated though, by sending in the same start and end date, resulting in the range spanning 1 millisecond. See isSpanningTime()

See Also:
ImmutableDateRange, DateRange, MutableDateRange, isSpanningTime()

Field Summary
static NameValuePair CUSTOM_NVP
           
static java.lang.String[] DATE_RANGE_NAMES
          Zero based names for the ranges.
static NameValuePair[] DATE_RANGES
          Name value pairs of all date ranges except RANGE_TYPE_CUSTOM
static NameValuePair[] DATE_RANGES_CUSTOM
          Name value pairs of all date ranges except RANGE_TYPE_CUSTOM
static NameValuePair[] DATE_RANGES_FROM_DAY
          Name value pairs of date ranges from (including) day date range, except RANGE_TYPE_CUSTOM
static NameValuePair DAY_NVP
           
static NameValuePair HOUR_NVP
           
static NameValuePair MINUTE_NVP
           
static NameValuePair MONTH_NVP
           
static int RANGE_TYPE_CUSTOM
          None of the other range types
static int RANGE_TYPE_DAY
          One day
static int RANGE_TYPE_HOUR
          One hour
static int RANGE_TYPE_MINUTE
          One minute
static int RANGE_TYPE_MONTH
          A whole month.
static int RANGE_TYPE_OFFSET
          The offset to the first type.
static int RANGE_TYPE_SECOND
          One second
static int RANGE_TYPE_WEEK
          A week.
static int RANGE_TYPE_YEAR_MONTHS
          A whole year, month based.
static int RANGE_TYPE_YEAR_WEEKS
          A whole year, week based.
static long[] RANGE_TYPES_MILLIS
          The number of millis every type of range spanns.
static NameValuePair SECOND_NVP
           
static NameValuePair WEEK_NVP
           
static NameValuePair YEAR_MONTHS_NVP
           
static NameValuePair YEAR_WEEKS_NVP
           
 
Method Summary
 java.lang.String getDurationString(java.lang.String formatString)
          Calls DateUtil.getDurationString(java.util.Calendar, java.util.Calendar, boolean, String) for the start and end dates and returns the result.
 java.util.Calendar getEnd()
          This is simply short for: getEnd(false), which means it will typically have milliseconds set to 999.
 java.util.Calendar getEnd(boolean excluding)
          Returns the actual contained Calendar.
 int getEndField(int field)
          This is simply short for: getEndField(field, false), which means it will typically have milliseconds set to 999.
 int getEndField(int field, boolean excluding)
          Forwarded to Calendar#get.
 ImmutableDateRange getEndInstant()
          This is simply short for: getEndInstant(false), which means it will typically have milliseconds set to 999.
 ImmutableDateRange getEndInstant(boolean excluding)
          Returns an ImmutableDateRange representing the end of this date range.
 long getEndMillis()
          This is simply short for: getEndMillis(false), which means it will typically have milliseconds set to 999.
 long getEndMillis(boolean excluding)
          Returns the end date in milliseconds.
 java.util.Date getEndTime()
          This is simply short for: getEndTime(false), which means it will typically have milliseconds set to 999.
 java.util.Date getEndTime(boolean excluding)
          Returns a new Date object representing the end time
 boolean getHasDate()
          A simple settable property that does nothing for the contained values or calculations.
 boolean getHasTime()
          A simple settable property that does nothing for the contained values or calculations.
 ImmutableDateRange getImmutable()
          Returns the range as a true immutable date range.
 java.util.Locale getLocale()
          Returns the locale associated with this time zone or null if the default should be used.
 java.util.Calendar getMiddle()
          Calulates the time in the middle of 'startDate' and 'endDate'.
 long getMiddleMillis()
          Calulates the time in the middle of 'startDate' and 'endDate'.
 long getMillisSpanned(boolean dSTSafe, boolean excluding)
          Returns the number of milliseconds this range spans.
 int getRangeType()
          Returns the type of range that this DataSpan spans.
 java.util.Calendar getRelative(double perc)
          Returns a date that are perc percent into the range.
 long getRelativeMillis(double perc)
          Returns a date that are perc percent into the range.
 DateRangeI getRelativeRange(double startPerc, double endPerc)
          Returns a date range that start from startPerc percent into the range until endPerc into the range.
 int getSize(int rangeType, boolean dSTSafe)
          Returns the number of seconds, minutes, hours, days, weeks, months or years betwen start and end date, inclusive.
 java.util.Calendar getStart()
          Returns a clone of the start date, free to change and it wont affect the range.
 int getStartField(int field)
          Forwarded to Calendar#get.
 ImmutableDateRange getStartInstant()
          Returns an ImmutableDateRange representing the start of this date range.
 long getStartMillis()
          Returns the start date in milliseconds.
 java.util.Date getStartTime()
          Returns a new Date object representing the start time
 java.util.ArrayList getSubDateList(int field, int[] values, int occurField, int[] dayOfWeekOccur, int maxCount, boolean asRanges)
          Runs an iterator over the range with sizes field and returns all date/times that's inside this range and which have a field value that is one of the integers in values.
 java.util.TimeZone getTimeZone()
          Returns the time zone associated with this time zone or null if the default should be used.
 boolean isContaining(DateRangeI innerDateSpan)
          Checks if a 'innerDateSpan' is compleately inside or equal to this range.
 boolean isContaining(long timeInMillis, boolean disregardSorting)
          Returns if the millisecond is within the range, inclusive.
 boolean isContinuous(DateRangeI dateRange)
          Checks if dateRange overlaps (or touches) this date range or if they are next to eachother so that there are no time between them and they thus form a continuous date range.
 boolean isInSame(int rangeType)
          Returns if cal1 and cal2 is in the same range type.
 boolean isOverlapping(DateRangeI dateRange)
          Checks if dateRange overlaps (or touches) this date range.
 boolean isOverlapping(DateRangeI dateRange, DateRangeI withinRange)
          Checks if dateRange overlaps (or touches) this date range.
 boolean isSorted()
          Returns if startDate is before (or same) as endDate (to the millisecond)
 boolean isSpanningTime()
          Returns if start date is not same as end date.
 java.util.Iterator iterator(int boundaryType)
          Returns an iterator that iterates over the range, returning a new DateRangeI for every call to .next().
 java.util.Iterator iterator(int boundaryType, int amount)
          Returns an iterator that iterates over the range, returning a new DateRangeI for every call to .next().
 java.lang.String toString(java.lang.String formatString, boolean endIsExcluding, boolean includeOffset)
          Retuns a string representation of the date range.
 
Methods inherited from interface com.miginfocom.util.dates.TimeSpan
getDateRangeClone, getDateRangeForReading, getWritableDateRange
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

DATE_RANGE_NAMES

static final java.lang.String[] DATE_RANGE_NAMES
Zero based names for the ranges. Reduce range type integer by RANGE_TYPE_OFFSET


CUSTOM_NVP

static final NameValuePair CUSTOM_NVP

SECOND_NVP

static final NameValuePair SECOND_NVP

MINUTE_NVP

static final NameValuePair MINUTE_NVP

HOUR_NVP

static final NameValuePair HOUR_NVP

DAY_NVP

static final NameValuePair DAY_NVP

WEEK_NVP

static final NameValuePair WEEK_NVP

MONTH_NVP

static final NameValuePair MONTH_NVP

YEAR_MONTHS_NVP

static final NameValuePair YEAR_MONTHS_NVP

YEAR_WEEKS_NVP

static final NameValuePair YEAR_WEEKS_NVP

DATE_RANGES_CUSTOM

static final NameValuePair[] DATE_RANGES_CUSTOM
Name value pairs of all date ranges except RANGE_TYPE_CUSTOM


DATE_RANGES

static final NameValuePair[] DATE_RANGES
Name value pairs of all date ranges except RANGE_TYPE_CUSTOM


DATE_RANGES_FROM_DAY

static final NameValuePair[] DATE_RANGES_FROM_DAY
Name value pairs of date ranges from (including) day date range, except RANGE_TYPE_CUSTOM


RANGE_TYPE_OFFSET

static final int RANGE_TYPE_OFFSET
The offset to the first type. != 0 so that it would be possible to distinguish is from Calendar field types if desirable

See Also:
Constant Field Values

RANGE_TYPE_YEAR_WEEKS

static final int RANGE_TYPE_YEAR_WEEKS
A whole year, week based. From start of week 01 to end of week 52 or 53 depending on which year

See Also:
Constant Field Values

RANGE_TYPE_YEAR_MONTHS

static final int RANGE_TYPE_YEAR_MONTHS
A whole year, month based. From 1:st of January to the 31:st of December

See Also:
Constant Field Values

RANGE_TYPE_MONTH

static final int RANGE_TYPE_MONTH
A whole month.

See Also:
Constant Field Values

RANGE_TYPE_WEEK

static final int RANGE_TYPE_WEEK
A week. from firstDayOfWeek to lastDayOfWeek

See Also:
Constant Field Values

RANGE_TYPE_DAY

static final int RANGE_TYPE_DAY
One day

See Also:
Constant Field Values

RANGE_TYPE_HOUR

static final int RANGE_TYPE_HOUR
One hour

See Also:
Constant Field Values

RANGE_TYPE_MINUTE

static final int RANGE_TYPE_MINUTE
One minute

See Also:
Constant Field Values

RANGE_TYPE_SECOND

static final int RANGE_TYPE_SECOND
One second

See Also:
Constant Field Values

RANGE_TYPE_CUSTOM

static final int RANGE_TYPE_CUSTOM
None of the other range types

See Also:
Constant Field Values

RANGE_TYPES_MILLIS

static final long[] RANGE_TYPES_MILLIS
The number of millis every type of range spanns. use [rangeType - DateRangeI.RANGE_TYPE_OFFSET] as index. Note that RANGE_TYPE_YEAR_WEEKS, RANGE_TYPE_YEAR_MONTHS and RANGE_TYPE_MONTH returns -1 since they are of variable length. These values might also have to be compesated for DST transitions.

Method Detail

getTimeZone

java.util.TimeZone getTimeZone()
Returns the time zone associated with this time zone or null if the default should be used.

Returns:
The time zone associated with this time zone or null if the default should be used.

getLocale

java.util.Locale getLocale()
Returns the locale associated with this time zone or null if the default should be used.

Returns:
The locale associated with this time zone or null if the default should be used.

getEnd

java.util.Calendar getEnd(boolean excluding)
Returns the actual contained Calendar. Should absolutely not be changed, though this is not checked. Nasty buggs could be the result of changing this retirned com.miginfocom.calendar.

Parameters:
excluding - If true the returned date will have one millisecond added first. Depending on how the returned com.miginfocom.calendar should be used this might, or might not, be desirable. For example, if the range spans exactly four days and the returned date should be used for displaying in what day it ends, then you should set this argument to false. But if it should be used to show a time range, for instance 09:00 to 10:00 the argument should be true since he actual stored end date/time is 09:59:999 (inclusive). See class info.
Returns:
A cloned com.miginfocom.calendar representing the end date.

getEnd

java.util.Calendar getEnd()
This is simply short for: getEnd(false), which means it will typically have milliseconds set to 999.

See Also:
getEnd(boolean)

getEndTime

java.util.Date getEndTime(boolean excluding)
Returns a new Date object representing the end time

Parameters:
excluding - If true the returned date will have one millisecond added first. Depending on how the returned com.miginfocom.calendar should be used this might, or might not, be desirable. For example, if the range spans exactly four days and the returned date should be used for displaying in what day it ends, then you should set this argument to false. But if it should be used to show a time range, for instance 09:00 to 10:00 the argument should be true since he actual stored end date/time is 09:59:999 (inclusive). See class info.
Returns:
A new Date object representing the end time

getEndTime

java.util.Date getEndTime()
This is simply short for: getEndTime(false), which means it will typically have milliseconds set to 999.

See Also:
getEndTime(boolean)

getStartInstant

ImmutableDateRange getStartInstant()
Returns an ImmutableDateRange representing the start of this date range.

Returns:
An ImmutableDateRange representing the start of this date range.

getEndInstant

ImmutableDateRange getEndInstant(boolean excluding)
Returns an ImmutableDateRange representing the end of this date range.

Parameters:
excluding - If true the returned date range will have one millisecond added first. Depending on how the returned calendar should be used this might, or might not, be desirable. For example, if the range spans exactly four days and the returned date should be used for displaying in what day it ends, then you should set this argument to false. But if it should be used to show a time range, for instance 09:00 to 10:00 the argument should be true since he actual stored end date/time is 09:59:999 (inclusive). See class info.
Returns:
An ImmutableDateRange representing the end of this date range.

getEndInstant

ImmutableDateRange getEndInstant()
This is simply short for: getEndInstant(false), which means it will typically have milliseconds set to 999.

See Also:
getEndInstant(boolean)

getStart

java.util.Calendar getStart()
Returns a clone of the start date, free to change and it wont affect the range.

Returns:
A clone of the start date

getStartTime

java.util.Date getStartTime()
Returns a new Date object representing the start time

Returns:
A new Date object representing the start time

getStartMillis

long getStartMillis()
Returns the start date in milliseconds. Especially useful when dealing with immutable date ranges since no defensive cloning is needed compared to getStart()

Returns:
The start date in milliseconds

getEndMillis

long getEndMillis(boolean excluding)
Returns the end date in milliseconds. Especially useful when dealing with immutable date ranges since no defensive cloning is needed compared to getEnd(boolean)

Parameters:
excluding - If true the returned date will have one millisecond added first. Depending on how the returned com.miginfocom.calendar should be used this might, or might not, be desirable. For example, if the range spans exactly four days and the returned date should be used for displaying in what day it ends, then you should set this argument to false. But if it should be used to show a time range, for instance 09:00 to 10:00 the argument should be true since he actual stored end date/time is 09:59:999 (inclusive). See class info.
Returns:
The end date in milliseconds

getEndMillis

long getEndMillis()
This is simply short for: getEndMillis(false), which means it will typically have milliseconds set to 999.

See Also:
getEndMillis(boolean)

isSorted

boolean isSorted()
Returns if startDate is before (or same) as endDate (to the millisecond)

Returns:
If startDate is before (or same) as endDate (to the millisecond)

isInSame

boolean isInSame(int rangeType)
Returns if cal1 and cal2 is in the same range type. (e.g. DateRangeI.RANGE_TYPE_DAY) Much faster than getSpanCount(rangeType, xxx) == 0 !

Parameters:
rangeType - The range type. DateRangeI.RANGE_TYPE_xxx. Not RANGE_TYPE_CUSTOM.
Returns:
If cal1 and cal2 is in the same range type.d

getSize

int getSize(int rangeType,
            boolean dSTSafe)
Returns the number of seconds, minutes, hours, days, weeks, months or years betwen start and end date, inclusive. For instance 2002-12-31 to 2003-01-01 spans two years!
RANGE_TYPE_MONTH, RANGE_TYPE_YEAR_MONTHS and RANGE_TYPE_YEAR_WEEKS are passed in to getSpanCountIter(...) since their length is variable and has to be iterated anyway.

Parameters:
rangeType - One of: DateRangeI.RANGE_TYPE_SECOND Counts the seconds
DateRangeI.RANGE_TYPE_MINUTE Counts the minutes
DateRangeI.RANGE_TYPE_HOUR Counts the hours
DateRangeI.RANGE_TYPE_DAY Counts the days
DateRangeI.RANGE_TYPE_WEEK Counts the weeks
DateRangeI.RANGE_TYPE_MONTH Counts the months (iterative algorithm)
DateRangeI.RANGE_TYPE_YEAR_MONTHS Counts the years, month based. jan 1 to dec 31 (iterative algorithm)
DateRangeI.RANGE_TYPE_YEAR_WEEKS Counts the years, week based. week 01 to week 52/53 (iterative algorithm)
NOTE! Getting the time zone is currently a quite expensive call. So only set this to true if it is really needed.
dSTSafe - For instance a day can span 23, 24 or 25 hours depending on if it's the Daylight saving day. With this set to true the returned value will be compensated to return 24 for all days. This is also valid for minutes and seconds. Note that if true adding the returned amount to start may not end up on end but on one earlier or later.
Returns:
The number of days, weeks, months or years betwen two dates inclusive, which means never 0.

getMillisSpanned

long getMillisSpanned(boolean dSTSafe,
                      boolean excluding)
Returns the number of milliseconds this range spans.

Parameters:
dSTSafe - If true transitions over a DST border will be compensated for the offset. false is just a endDate.getTimeInMillis() - startDate.getTimeInMillis() + 1. false is as UTC-mode.
excluding - If true the returned value will have one millisecond added first. Depending on how the returned value should be used this might, or might not, be desirable.
Basically setting to true will return 1000 millis for one spanned second and setting to false will return 999 which is the internal representation.
Returns:
The number of milliseconds from start to end date. Always > 0. (E.g. 1000 for one second)
See Also:
getEnd(boolean), isSpanningTime()

isOverlapping

boolean isOverlapping(DateRangeI dateRange)
Checks if dateRange overlaps (or touches) this date range. Inclusive.

Parameters:
dateRange - The date range to check if this is overlapping with
Returns:
If dateRange overlaps (or touches) this date range. Inclusive.

isContinuous

boolean isContinuous(DateRangeI dateRange)
Checks if dateRange overlaps (or touches) this date range or if they are next to eachother so that there are no time between them and they thus form a continuous date range.

Parameters:
dateRange - The date range to check if this is continuous with
Returns:
If dateRange overlaps or is next to this date range.

isOverlapping

boolean isOverlapping(DateRangeI dateRange,
                      DateRangeI withinRange)
Checks if dateRange overlaps (or touches) this date range. Inclusive.

Parameters:
dateRange - The date range to check if this is overlapping with
withinRange - Only return true if there is an overlap within this range. Not null.
Returns:
If dateRange overlaps (or touches) this date range. Inclusive.

isContaining

boolean isContaining(DateRangeI innerDateSpan)
Checks if a 'innerDateSpan' is compleately inside or equal to this range.

Parameters:
innerDateSpan - The possibly inside date range
Returns:
If 'innerDateSpan' is compleately inside or equal to this range.

isContaining

boolean isContaining(long timeInMillis,
                     boolean disregardSorting)
Returns if the millisecond is within the range, inclusive.

Parameters:
timeInMillis -
disregardSorting - If true unsorted ranges (start > end) also returns true if timeInMillis is betweend the boundarys
Returns:
If the millisecond is within the range.

getRangeType

int getRangeType()
Returns the type of range that this DataSpan spans. (RANGE_TYPE_xxx). This method doesn't handle time of day at all. The smallest range type that can be returned is RANGE_TYPE_DAY and it will do that if the range start and end is in the same day.

Only if one day, one week, one month or one year (week or month based) are exactly spanned (end date inclusive) will anything other than RANGE_TYPE_CUSTOM be returned.

Returns:
The type of range that this DataSpan spans. (RANGE_TYPE_xxx)

getMiddle

java.util.Calendar getMiddle()
Calulates the time in the middle of 'startDate' and 'endDate'.

Returns:
The time in the middle of 'startDate' and 'endDate'.

getMiddleMillis

long getMiddleMillis()
Calulates the time in the middle of 'startDate' and 'endDate'.

Returns:
The time im millisoconds in the middle of 'startDate' and 'endDate'.

iterator

java.util.Iterator iterator(int boundaryType)
Returns an iterator that iterates over the range, returning a new DateRangeI for every call to .next(). Every DateRangeI returned will be of the length that 'boundaryType' indicates, except maybe the first and last since these two are NOT rounded to their boundary before starting. If this range's start date and end date are within same 'boundaryType' (eg. week) the iterator will only return one DateRange with range same as 'this'.
This range's start and end dates are read at the initialization of the Iterator and may be changed while using it, without affecting the Iterator or its returned values.
If the date range isn't sorted the iterator will return no ranges as all.

Parameters:
boundaryType - The "size" that this range will be "chopped" to. 'boundaryType'. RANGE_TYPE_xxx
Returns:
An iterator that iterates over the range.

iterator

java.util.Iterator iterator(int boundaryType,
                            int amount)
Returns an iterator that iterates over the range, returning a new DateRangeI for every call to .next(). Every DateRangeI returned will be of the length that 'boundaryType' indicates, except maybe the first and last since these two are NOT rounded to their boundary before staring. If this range's start date and end date are within same 'boundaryType' (eg. week) the iterator will only return one DateRange with range same as 'this'.
This range's start and end dates are read at the initialization of the Iterator and may be changed while using it, without affecting the Iterator or its returned values.
If the date range isn't sorted the iterator will return no ranges as all.

Parameters:
boundaryType - The "size" that this range will be "chopped" to (regardless of amount). 'boundaryType'. RANGE_TYPE_xxx
amount - The amount of boundsryType to add for every iteration.
Returns:
An iterator that iterates over the range.

getRelative

java.util.Calendar getRelative(double perc)
Returns a date that are perc percent into the range. i.e. if perc is 0.5d, a date exactly between start and end date is returned. 0.0d means start date and 1.0d is the end date/time

Parameters:
perc - The percentage.
Returns:
A date that are perc percent in the range.

getRelativeMillis

long getRelativeMillis(double perc)
Returns a date that are perc percent into the range. i.e. if perc is 0.5d, a date exactly between start and end date is returned. 0.0d means start date and 1.0d is the end date/time

Parameters:
perc - The percentage.
Returns:
A date that are perc percent in the range.

getRelativeRange

DateRangeI getRelativeRange(double startPerc,
                            double endPerc)
Returns a date range that start from startPerc percent into the range until endPerc into the range. If endPerc is 1.0d the last millisecond is returned (since it is inclusive), as opposed to #getRelativeDateRange. If startPerc and endPerc is equal, a range with the same start and end date will be returned.

Parameters:
startPerc - A percentage into the range. must be <= endPerc
endPerc - A percentage into the range. must be >= startPerc
Returns:
A date range spanning the relative part of a this date range.

getEndField

int getEndField(int field,
                boolean excluding)
Forwarded to Calendar#get.

Parameters:
field - The field to get
excluding - If true the returned date/time will be for the "next" millisecond that end date denotes. That date actually does not belong to this range but it is common for that value to be used for example when displaying a time range (e.g. 10:00:00.000 -> 11:15:00.000).
Returns:
The field's value
See Also:
Calendar.get(int)

getEndField

int getEndField(int field)
This is simply short for: getEndField(field, false), which means it will typically have milliseconds set to 999.

See Also:
getEndField(int, boolean)

getStartField

int getStartField(int field)
Forwarded to Calendar#get.

Parameters:
field - The field to get. E.g. Calendar.WEEK.
Returns:
The field's value
See Also:
Calendar.get(int)

getSubDateList

java.util.ArrayList getSubDateList(int field,
                                   int[] values,
                                   int occurField,
                                   int[] dayOfWeekOccur,
                                   int maxCount,
                                   boolean asRanges)
Runs an iterator over the range with sizes field and returns all date/times that's inside this range and which have a field value that is one of the integers in values. E.g. if this range is a month and field is Calendar.DAY_OF_WEEK with values == {0, 1} then all sundays and mondays within this range are returned as GegorianCalendars.

Parameters:
field - The field in a Calendar. E.g. Calendar.DAY_OF_WEEK.
values - A number of values for field to match. Not null. Can be negative and if so is relative to the maximum possible value of the field. E.g. -1 when field is Calendar.HOUR is same as 23.
occurField - Either Calendar.DAY_OF_YEAR or Calendar.DAY_OF_MONTH. Only used if occurFilter is non-null. field must also be set to Calendar.DAY_OF_WEEK.
dayOfWeekOccur - Specifies for every value that only an occurence within the month or year (depending on occurField) should be returned.
For instance if values[0] == Calendar.MONDAY, occurField == Calendar.DAY_OF_YEAR and dayOfWeekOccur[0] == 2 then only the second monday of the year is considered a "hit". Negative values means "from the end", so dayOfWeekOccur[0] == -2 would mean second to last monday of the year.
An element that is 0 is as usual (as if dayOfWeekOccur == null) considered to be all mondays (for instance).
If non-null must be same length as values, field must be Calendar.DAY_OF_WEEK. If input is a bad combination an IllegalArgumentException is thrown.
See "BYDAY" paragraph in "RFC 2445" for further explanation.
maxCount - The maximum size of the returned list. -1 means no limit. Can be used as a "protection" against bad input that would return to much data.
asRanges - If true the returned List is made up of DateRanges instead of Calendars. These ranges are set to fill the whole boundary that field indicats. E.g. spans exactly a day for Calendar.DAY_OF_MONTH.
Returns:
A list of GegorianCalendar s and/or MutableDateRanges. Never null but can be of size 0.

isSpanningTime

boolean isSpanningTime()
Returns if start date is not same as end date. Even if they are the same it actually spans 1 millisecond since both start and end date are considered inclusive.
Notice that getMillisSpanned(boolean, boolean) will return 1.

Returns:
If start date is not same as end date.

getHasDate

boolean getHasDate()
A simple settable property that does nothing for the contained values or calculations. It is just a "tag"-boolean that can be interpreted by users of this class.

Returns:
If the range's date should be considered. Default is true.

getHasTime

boolean getHasTime()
A simple settable property that does nothing for the contained values or calculations. It is just a "tag"-boolean that can be interpreted by users of this class.

Returns:
If the range's date should be considered. Default is true.

getImmutable

ImmutableDateRange getImmutable()
Returns the range as a true immutable date range.

Returns:
The range as a true immutable date range.

getDurationString

java.lang.String getDurationString(java.lang.String formatString)
Calls DateUtil.getDurationString(java.util.Calendar, java.util.Calendar, boolean, String) for the start and end dates and returns the result.

Parameters:
formatString - The format string. See DateUtil.getDurationString(java.util.Calendar, java.util.Calendar, boolean, String) for details.
Returns:
The resulting string. Not null.

toString

java.lang.String toString(java.lang.String formatString,
                          boolean endIsExcluding,
                          boolean includeOffset)
Retuns a string representation of the date range. E.g. "yyyy-MM-dd HH:mm:ss:SSS".

Parameters:
formatString - Format for the dates. If null default date time instance is used.
endIsExcluding - Set to true if the end date should be displayed 'excluding' the last millisecond, normally meaning that the milliseconds are are an even number (0).
includeOffset - If the DST (Daylight Savings Time) offset should be included in the output.
Returns:
The string.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.