|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.miginfocom.util.dates.BoundaryRounder
public class BoundaryRounder
Rounds DateRangeI's and Calendar's to specified intervals.
NOTE! This rounder rounds to a specific point i absolute time with no compensation for rounding
over daylight savings and such..
| Constructor Summary | |
|---|---|
BoundaryRounder(int boundaryType)
Constructor that rounds start and end but doesn't try to keep the same length |
|
BoundaryRounder(int boundaryType,
boolean roundStart,
boolean roundEnd,
boolean keepSameLength)
Constructor. |
|
BoundaryRounder(int boundaryType,
boolean roundStart,
boolean roundEnd,
boolean keepSameLength,
java.lang.Integer minSize,
java.lang.Integer maxSize,
java.lang.Integer cutAlignment)
Constructor. |
|
| Method Summary | |
|---|---|
int |
getBoundaryType()
Return the boundary type to round to. |
int |
getCutAlignment()
Returns how to align a cutted/expanded oundary. |
boolean |
getKeepSameLength()
Returns if the length of the rounded range should be kept. |
int |
getMaximumSize()
Returns the maximum number of boundaryType that the rounded MutableDateRange should be
able to span. |
int |
getMinimumSize()
Returns the minimum number of boundaryType that the rounded MutableDateRange should be
able to span. |
boolean |
getRoundEnd()
Returns if the end date/time should be rounded. |
boolean |
getRoundStart()
Returns if the start date/time should be rounded. |
MutableDateRange |
round(MutableDateRange dateRange)
Rounds the start and/or end dates and possibly ajdusts the not rounded date/time so the length will be same. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BoundaryRounder(int boundaryType)
boundaryType - The boundary type to round to. E.g. DateRangeI.RANGE_TYPE_DAY.
public BoundaryRounder(int boundaryType,
boolean roundStart,
boolean roundEnd,
boolean keepSameLength)
boundaryType - The boundary type to round to. E.g. DateRangeI.RANGE_TYPE_DAY.roundStart - If the start date/time should be rounded.roundEnd - If the end date/time should be rounded.keepSameLength - If not both of roundStart and roundEnd of a MutableDateRange
are rounded and keepSameLength is true, the one of roundStart or roundEnd
time that is not rounded will be set so that the spanned time in the range will remain the same.true, the result is actually a rounded move of the range rather than a resize.keepSameLength can't be true if both roundStart and roundEnd is true.
public BoundaryRounder(int boundaryType,
boolean roundStart,
boolean roundEnd,
boolean keepSameLength,
java.lang.Integer minSize,
java.lang.Integer maxSize,
java.lang.Integer cutAlignment)
boundaryType - The boundary type to round to. E.g. DateRangeI.RANGE_TYPE_DAY.roundStart - If the start date/time should be rounded.roundEnd - If the end date/time should be rounded.keepSameLength - If not both of roundStart and roundEnd of a MutableDateRange
are rounded and keepSameLength is true, the one of roundStart or roundEnd
time that is not rounded will be set so that the spanned time in the range will remain the same.true, the result is actually a rounded move of the range rather than a resize.keepSameLength can't be true if both roundStart and roundEnd is true.minSize and maxSize has precidence over keepSameLength.minSize - Minimum number of boundaryType that the rounded MutableDateRange should be
able to span. null means no boundary.maxSize - Maximum number of boundaryType that the rounded MutableDateRange should be
able to span. null means no boundary.cutAlignment - If the range has to be cutted or expanded to comply with minSize or maxSize there is a matter of where to
cut/add the superfluous/extra time. If null the rounded edge is always cut/added to and if both are rounded both sides are handled equally
thus the alignment can be said to be "centered".MutableDateRange.ALIGN_CENTER_DOWN, MutableDateRange.ALIGN_CENTER_UP, MutableDateRange.ALIGN_START,
MutableDateRange.ALIGN_END, MutableDateRange.ALIGN_EARLIEST, MutableDateRange.ALIGN_LATEST.| Method Detail |
|---|
public MutableDateRange round(MutableDateRange dateRange)
DateRangeRounder
round in interface DateRangeRounderdateRange - The MutableDateRange to round. Will be changed.
dateRange for the possiblility to chain.public int getBoundaryType()
DateRangeI.RANGE_TYPE_DAY.
DateRangeI.RANGE_TYPE_DAY.public int getCutAlignment()
MutableDateRange.ALIGN_CENTER_DOWN, MutableDateRange.ALIGN_CENTER_UP,
MutableDateRange.ALIGN_START, MutableDateRange.ALIGN_END, MutableDateRange.ALIGN_EARLIEST, MutableDateRange.ALIGN_LATEST.
MutableDateRange.ALIGN_END.getAlignment(boolean, boolean)public boolean getKeepSameLength()
roundStart and roundEnd of a MutableDateRange
are rounded and keepSameLength is true, the one of roundStart or roundEnd
time that is not rounded will be set so that the spanned time in the range will remain the same.true, the result is actually a rounded move of the range rather than a resize.keepSameLength can't be true if both roundStart and roundEnd is true.minSize and maxSize has precidence over keepSameLength.
public int getMinimumSize()
boundaryType that the rounded MutableDateRange should be
able to span.
boundaryType that the rounded MutableDateRange should be
able to span.public int getMaximumSize()
boundaryType that the rounded MutableDateRange should be
able to span.
boundaryType that the rounded MutableDateRange should be
able to span.public boolean getRoundStart()
public boolean getRoundEnd()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||