Class DateTickUnit
java.lang.Object
org.jfree.chart.axis.TickUnit
org.jfree.chart.axis.DateTickUnit
- All Implemented Interfaces:
Serializable, Comparable
A tick unit for use by subclasses of
DateAxis. Instances of this
class are immutable.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe unit count.private DateFormatThe date formatter.private intThe roll count.private DateTickUnitTypeThe roll unit type.private static final longFor serialization.private DateTickUnitTypeThe units. -
Constructor Summary
ConstructorsConstructorDescriptionDateTickUnit(DateTickUnitType unitType, int multiple) Creates a new date tick unit.DateTickUnit(DateTickUnitType unitType, int multiple, DateFormat formatter) Creates a new date tick unit.DateTickUnit(DateTickUnitType unitType, int multiple, DateTickUnitType rollUnitType, int rollMultiple, DateFormat formatter) Creates a new unit. -
Method Summary
Modifier and TypeMethodDescriptionCalculates a new date by adding this unit to the base date.dateToString(Date date) Formats a date using the tick unit's formatter.booleanTests this unit for equality with another object.intReturns a field code that can be used with theCalendarclass.private static longgetMillisecondCount(DateTickUnitType unit, int count) Returns the (approximate) number of milliseconds for the given unit and unit count.intReturns the unit multiple.intReturns the roll unit multiple.Returns the roll unit type.Returns the unit type.inthashCode()Returns a hash code for this object.Rolls the date forward by the amount specified by the roll unit and count.Rolls the date forward by the amount specified by the roll unit and count.toString()Returns a string representation of this instance, primarily used for debugging purposes.valueToString(double milliseconds) Formats a value.Methods inherited from class TickUnit
compareTo, getMinorTickCount, getSize
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
unitType
The units. -
count
private int countThe unit count. -
rollUnitType
The roll unit type. -
rollCount
private int rollCountThe roll count. -
formatter
The date formatter.
-
-
Constructor Details
-
DateTickUnit
Creates a new date tick unit.- Parameters:
unitType- the unit type (nullnot permitted).multiple- the multiple (of the unit type, must be > 0).
-
DateTickUnit
Creates a new date tick unit.- Parameters:
unitType- the unit type (nullnot permitted).multiple- the multiple (of the unit type, must be > 0).formatter- the date formatter (nullnot permitted).
-
DateTickUnit
public DateTickUnit(DateTickUnitType unitType, int multiple, DateTickUnitType rollUnitType, int rollMultiple, DateFormat formatter) Creates a new unit.- Parameters:
unitType- the unit.multiple- the multiple.rollUnitType- the roll unit.rollMultiple- the roll multiple.formatter- the date formatter (nullnot permitted).
-
-
Method Details
-
getUnitType
-
getMultiple
public int getMultiple()Returns the unit multiple.- Returns:
- The unit multiple (always > 0).
-
getRollUnitType
Returns the roll unit type.- Returns:
- The roll unit type (never
null).
-
getRollMultiple
public int getRollMultiple()Returns the roll unit multiple.- Returns:
- The roll unit multiple.
-
valueToString
Formats a value.- Overrides:
valueToStringin classTickUnit- Parameters:
milliseconds- date in milliseconds since 01-01-1970.- Returns:
- The formatted date.
-
dateToString
-
addToDate
-
rollDate
-
rollDate
-
getCalendarField
public int getCalendarField()Returns a field code that can be used with theCalendarclass.- Returns:
- The field code.
-
getMillisecondCount
Returns the (approximate) number of milliseconds for the given unit and unit count.This value is an approximation some of the time (e.g. months are assumed to have 31 days) but this shouldn't matter.
- Parameters:
unit- the unit.count- the unit count.- Returns:
- The number of milliseconds.
-
equals
-
hashCode
-
toString
-