Package org.jfree.data.time
Class DateRange
- java.lang.Object
-
- org.jfree.data.Range
-
- org.jfree.data.time.DateRange
-
- All Implemented Interfaces:
java.io.Serializable
public class DateRange extends Range implements java.io.Serializable
A range specified in terms of twojava.util.Dateobjects. Instances of this class are immutable.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private longlowerDateThe lower bound for the range.private static longserialVersionUIDFor serialization.private longupperDateThe upper bound for the range.
-
Constructor Summary
Constructors Constructor Description DateRange()Default constructor.DateRange(double lower, double upper)Constructs a new range using two values that will be interpreted as "milliseconds since midnight GMT, 1-Jan-1970".DateRange(java.util.Date lower, java.util.Date upper)Constructs a new range.DateRange(Range other)Constructs a new range that is based on anotherRange.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.DategetLowerDate()Returns the lower (earlier) date for the range.longgetLowerMillis()Returns the lower bound of the range in milliseconds.java.util.DategetUpperDate()Returns the upper (later) date for the range.longgetUpperMillis()Returns the upper bound of the range in milliseconds.java.lang.StringtoString()Returns a string representing the date range (useful for debugging).-
Methods inherited from class org.jfree.data.Range
combine, combineIgnoringNaN, constrain, contains, equals, expand, expandToInclude, getCentralValue, getLength, getLowerBound, getUpperBound, hashCode, intersects, intersects, isNaNRange, scale, shift, shift
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
lowerDate
private final long lowerDate
The lower bound for the range.
-
upperDate
private final long upperDate
The upper bound for the range.
-
-
Constructor Detail
-
DateRange
public DateRange()
Default constructor.
-
DateRange
public DateRange(java.util.Date lower, java.util.Date upper)Constructs a new range.- Parameters:
lower- the lower bound (nullnot permitted).upper- the upper bound (nullnot permitted).
-
DateRange
public DateRange(double lower, double upper)Constructs a new range using two values that will be interpreted as "milliseconds since midnight GMT, 1-Jan-1970".- Parameters:
lower- the lower (oldest) date.upper- the upper (most recent) date.
-
DateRange
public DateRange(Range other)
Constructs a new range that is based on anotherRange. The other range does not have to be aDateRange. If it is not, the upper and lower bounds are evaluated as milliseconds since midnight GMT, 1-Jan-1970.- Parameters:
other- the other range (nullnot permitted).
-
-
Method Detail
-
getLowerDate
public java.util.Date getLowerDate()
Returns the lower (earlier) date for the range.- Returns:
- The lower date for the range.
- See Also:
getLowerMillis()
-
getLowerMillis
public long getLowerMillis()
Returns the lower bound of the range in milliseconds.- Returns:
- The lower bound.
- See Also:
getLowerDate()
-
getUpperDate
public java.util.Date getUpperDate()
Returns the upper (later) date for the range.- Returns:
- The upper date for the range.
- See Also:
getUpperMillis()
-
getUpperMillis
public long getUpperMillis()
Returns the upper bound of the range in milliseconds.- Returns:
- The upper bound.
- See Also:
getUpperDate()
-
-