public class DateTickUnit extends TickUnit implements java.io.Serializable
DateAxis. Instances of this
class are immutable.| Modifier and Type | Field and Description |
|---|---|
private int |
count
The unit count.
|
static int |
DAY
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
private java.text.DateFormat |
formatter
The date formatter.
|
static int |
HOUR
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
static int |
MILLISECOND
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
static int |
MINUTE
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
static int |
MONTH
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
private int |
rollCount
The roll count.
|
private int |
rollUnit
Deprecated.
As of version 1.0.13, use the rollUnitType field.
|
private DateTickUnitType |
rollUnitType
The roll unit type.
|
static int |
SECOND
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
private static long |
serialVersionUID
For serialization.
|
private int |
unit
Deprecated.
As of version 1.0.13, use the unitType field.
|
private DateTickUnitType |
unitType
The units.
|
static int |
YEAR
Deprecated.
As of version 1.0.13, use
DateTickUnitType instead. |
| Constructor and Description |
|---|
DateTickUnit(DateTickUnitType unitType,
int multiple)
Creates a new date tick unit.
|
DateTickUnit(DateTickUnitType unitType,
int multiple,
java.text.DateFormat formatter)
Creates a new date tick unit.
|
DateTickUnit(DateTickUnitType unitType,
int multiple,
DateTickUnitType rollUnitType,
int rollMultiple,
java.text.DateFormat formatter)
Creates a new unit.
|
DateTickUnit(int unit,
int count)
Deprecated.
As of version 1.0.13, use
DateTickUnit(
DateTickUnitType, int). |
DateTickUnit(int unit,
int count,
java.text.DateFormat formatter)
Deprecated.
As of version 1.0.13, use
DateTickUnit(
DateTickUnitType, int, DateFormat). |
DateTickUnit(int unit,
int count,
int rollUnit,
int rollCount,
java.text.DateFormat formatter)
Deprecated.
As of version 1.0.13, use
DateTickUnit(
DateTickUnitType, int, DateTickUnitType, int, DateFormat). |
| Modifier and Type | Method and Description |
|---|---|
java.util.Date |
addToDate(java.util.Date base)
Deprecated.
As of JFreeChart 1.0.10, this method is deprecated - you
should use
addToDate(Date, TimeZone) instead. |
java.util.Date |
addToDate(java.util.Date base,
java.util.TimeZone zone)
Calculates a new date by adding this unit to the base date.
|
java.lang.String |
dateToString(java.util.Date date)
Formats a date using the tick unit's formatter.
|
boolean |
equals(java.lang.Object obj)
Tests this unit for equality with another object.
|
int |
getCalendarField()
Returns a field code that can be used with the
Calendar
class. |
int |
getCount()
Deprecated.
As of version 1.0.13, use
getMultiple(). |
private static long |
getMillisecondCount(DateTickUnitType unit,
int count)
Returns the (approximate) number of milliseconds for the given unit and
unit count.
|
int |
getMultiple()
Returns the unit multiple.
|
int |
getRollCount()
Deprecated.
As of version 1.0.13, use the
getRollMultiple() |
int |
getRollMultiple()
Returns the roll unit multiple.
|
int |
getRollUnit()
Deprecated.
As of version 1.0.13, use
getRollUnitType(). |
DateTickUnitType |
getRollUnitType()
Returns the roll unit type.
|
int |
getUnit()
Deprecated.
As of 1.0.13, use the getUnitType() method.
|
DateTickUnitType |
getUnitType()
Returns the unit type.
|
int |
hashCode()
Returns a hash code for this object.
|
private static DateTickUnitType |
intToUnitType(int unit)
A utility method that is used internally to convert the old unit
constants into the corresponding enumerated value.
|
private static java.text.DateFormat |
notNull(java.text.DateFormat formatter)
A utility method to put a default in place if a null formatter is
supplied.
|
java.util.Date |
rollDate(java.util.Date base)
Rolls the date forward by the amount specified by the roll unit and
count.
|
java.util.Date |
rollDate(java.util.Date base,
java.util.TimeZone zone)
Rolls the date forward by the amount specified by the roll unit and
count.
|
java.lang.String |
toString()
Returns a string representation of this instance, primarily used for
debugging purposes.
|
private static int |
unitTypeToInt(DateTickUnitType unitType)
Converts a unit type to the corresponding deprecated integer constant.
|
java.lang.String |
valueToString(double milliseconds)
Formats a value.
|
compareTo, getMinorTickCount, getSizeprivate static final long serialVersionUID
private DateTickUnitType unitType
private int count
private DateTickUnitType rollUnitType
private int rollCount
private java.text.DateFormat formatter
public static final int YEAR
DateTickUnitType instead.public static final int MONTH
DateTickUnitType instead.public static final int DAY
DateTickUnitType instead.public static final int HOUR
DateTickUnitType instead.public static final int MINUTE
DateTickUnitType instead.public static final int SECOND
DateTickUnitType instead.public static final int MILLISECOND
DateTickUnitType instead.private int unit
private int rollUnit
public DateTickUnit(DateTickUnitType unitType, int multiple)
unitType - the unit type (null not permitted).multiple - the multiple (of the unit type, must be > 0).public DateTickUnit(DateTickUnitType unitType, int multiple, java.text.DateFormat formatter)
unitType - the unit type (null not permitted).multiple - the multiple (of the unit type, must be > 0).formatter - the date formatter (null not permitted).public DateTickUnit(DateTickUnitType unitType, int multiple, DateTickUnitType rollUnitType, int rollMultiple, java.text.DateFormat formatter)
unitType - the unit.multiple - the multiple.rollUnitType - the roll unit.rollMultiple - the roll multiple.formatter - the date formatter (null not permitted).public DateTickUnit(int unit,
int count,
java.text.DateFormat formatter)
DateTickUnit(
DateTickUnitType, int, DateFormat).unit - the unit.count - the unit count.formatter - the date formatter (defaults to DateFormat.SHORT).public DateTickUnit(int unit,
int count)
DateTickUnit(
DateTickUnitType, int).unit - the unit.count - the unit count.public DateTickUnit(int unit,
int count,
int rollUnit,
int rollCount,
java.text.DateFormat formatter)
DateTickUnit(
DateTickUnitType, int, DateTickUnitType, int, DateFormat).unit - the unit.count - the count.rollUnit - the roll unit.rollCount - the roll count.formatter - the date formatter (defaults to DateFormat.SHORT).public DateTickUnitType getUnitType()
null).public int getMultiple()
public DateTickUnitType getRollUnitType()
null).public int getRollMultiple()
public java.lang.String valueToString(double milliseconds)
valueToString in class TickUnitmilliseconds - date in milliseconds since 01-01-1970.public java.lang.String dateToString(java.util.Date date)
date - the date.public java.util.Date addToDate(java.util.Date base,
java.util.TimeZone zone)
base - the base date.zone - the time zone for the date calculation.public java.util.Date rollDate(java.util.Date base)
base - the base date.rollDate(Date, TimeZone)public java.util.Date rollDate(java.util.Date base,
java.util.TimeZone zone)
base - the base date.zone - the time zone.public int getCalendarField()
Calendar
class.private static long getMillisecondCount(DateTickUnitType unit, int count)
This value is an approximation some of the time (e.g. months are assumed to have 31 days) but this shouldn't matter.
unit - the unit.count - the unit count.private static DateTickUnitType intToUnitType(int unit)
unit - the unit specified using the deprecated integer codes.private static int unitTypeToInt(DateTickUnitType unitType)
unitType - the unit type (null not permitted).private static java.text.DateFormat notNull(java.text.DateFormat formatter)
formatter - the formatter (null permitted).public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getUnit()
YEAR, MONTH, DAY,
HOUR, MINUTE, SECOND or
MILLISECOND, defined by this class. Note that these
constants do NOT correspond to those defined in Java's
Calendar class.public int getCount()
getMultiple().public int getRollUnit()
getRollUnitType().public int getRollCount()
getRollMultiple()public java.util.Date addToDate(java.util.Date base)
addToDate(Date, TimeZone) instead.base - the base date.addToDate(Date, TimeZone)