|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flexive.shared.value.DateRange
public class DateRange
A class to describe an immutable date range
parts of the code are taken from JFreeChart (http://www.jfree.org/jfreechart/index.html) which is released under an LGPL license. Code is taken from org.jfree.data.Range (http://www.koders.com/java/fidBBD43A5DBC05830ABCF1267D7B17BF90BD2B6521.aspx)
| Constructor Summary | |
|---|---|
DateRange(java.util.Date lower,
java.util.Date upper)
|
|
DateRange(java.lang.String dateRange)
|
|
| Method Summary | |
|---|---|
static DateRange |
combine(DateRange range1,
DateRange range2)
Creates a new range by combining two existing ranges. |
java.util.Date |
constrain(java.util.Date value)
Returns the value within the range that is closest to the specified value. |
boolean |
contains(java.util.Date value)
Returns true if the range contains the specified value and false
otherwise. |
DateRange |
copy()
Returns a copy of this DateRange instance. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
static DateRange |
expand(DateRange range,
double lowerMargin,
double upperMargin)
Creates a new range by adding margins to an existing range. |
java.util.Date |
getCentralValue()
Returns the central value for the range. |
long |
getDuration()
|
java.util.Date |
getLower()
|
java.util.Date |
getUpper()
|
int |
hashCode()
Returns a hash code value for the object. |
boolean |
intersects(DateRange range)
Does range intersect with this DateRange? |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DateRange(java.util.Date lower,
java.util.Date upper)
public DateRange(java.lang.String dateRange)
| Method Detail |
|---|
public DateRange copy()
public java.util.Date getLower()
public java.util.Date getUpper()
public long getDuration()
public boolean intersects(DateRange range)
range intersect with this DateRange?
range - the DateRange to test for intersection
public java.util.Date getCentralValue()
public boolean contains(java.util.Date value)
true if the range contains the specified value and false
otherwise.
value - the value to check
true if the range contains the specified value.public java.util.Date constrain(java.util.Date value)
value - the value.
public static DateRange combine(DateRange range1,
DateRange range2)
null, in which case the other range is returned;null the return value is null.
range1 - the first range (null permitted).range2 - the second range (null permitted).
null).
public static DateRange expand(DateRange range,
double lowerMargin,
double upperMargin)
range - the range (null not permitted).lowerMargin - the lower margin (expressed as a percentage of the range length).upperMargin - the upper margin (expressed as a percentage of the range length).
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the reference object with which to compare.
true if this object is the same as the obj
argument; false otherwise.hashCode(),
Hashtablepublic int hashCode()
java.util.Hashtable.
hashCode in class java.lang.ObjectObject.equals(Object),
Hashtablepublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||