| java.lang.Object com.flexive.shared.value.DateRange
DateRange | public class DateRange implements Serializable(Code) | | 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)
author: Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) |
Method Summary | |
public static DateRange | combine(DateRange range1, DateRange range2) Creates a new range by combining two existing ranges.
Note that:
- either range can be
null , in which case the other range is returned;
- if both ranges are
null the return value is null .
Parameters: range1 - the first range (null permitted). Parameters: range2 - the second range (null permitted). | public Date | constrain(Date value) Returns the value within the range that is closest to the specified value.
Parameters: value - the value. | public boolean | contains(Date value) Returns true if the range contains the specified value and false
otherwise. | public boolean | equals(Object obj) Indicates whether some other object is "equal to" this one.
Parameters: obj - the reference object with which to compare. | public static DateRange | expand(DateRange range, double lowerMargin, double upperMargin) Creates a new range by adding margins to an existing range.
Parameters: range - the range (null not permitted). Parameters: lowerMargin - the lower margin (expressed as a percentage of the range length). Parameters: upperMargin - the upper margin (expressed as a percentage of the range length). | public Date | getCentralValue() Returns the central value for the range. | public long | getDuration() | public Date | getLower() | public Date | getUpper() | public int | hashCode() Returns a hash code value for the object. | public boolean | intersects(DateRange range) | public String | toString() |
combine | public static DateRange combine(DateRange range1, DateRange range2)(Code) | | Creates a new range by combining two existing ranges.
Note that:
- either range can be
null , in which case the other range is returned;
- if both ranges are
null the return value is null .
Parameters: range1 - the first range (null permitted). Parameters: range2 - the second range (null permitted). A new range (possibly null ). |
constrain | public Date constrain(Date value)(Code) | | Returns the value within the range that is closest to the specified value.
Parameters: value - the value. The constrained value. |
contains | public boolean contains(Date value)(Code) | | Returns true if the range contains the specified value and false
otherwise.
Parameters: value - the value to check true if the range contains the specified value. |
equals | public boolean equals(Object obj)(Code) | | Indicates whether some other object is "equal to" this one.
Parameters: obj - the reference object with which to compare. true if this object is the same as the objargument; false otherwise. See Also: DateRange.hashCode() See Also: java.util.Hashtable |
expand | public static DateRange expand(DateRange range, double lowerMargin, double upperMargin)(Code) | | Creates a new range by adding margins to an existing range.
Parameters: range - the range (null not permitted). Parameters: lowerMargin - the lower margin (expressed as a percentage of the range length). Parameters: upperMargin - the upper margin (expressed as a percentage of the range length). The expanded range. |
getCentralValue | public Date getCentralValue()(Code) | | Returns the central value for the range.
The central value. |
getDuration | public long getDuration()(Code) | | |
hashCode | public int hashCode()(Code) | | Returns a hash code value for the object. This method is
supported for the benefit of hashtables such as those provided by
java.util.Hashtable .
a hash code value for this object. See Also: Object.equals(Object) See Also: java.util.Hashtable |
intersects | public boolean intersects(DateRange range)(Code) | | Does range intersect with this DateRange?
Parameters: range - the DateRange to test for intersection if the ranges intersect |
|
|