com.jrefinery.chart
Class DateUnit

java.lang.Object
  extended by com.jrefinery.chart.DateUnit

public class DateUnit
extends java.lang.Object

Represents a fixed period of time, used to represent the tick units on a DateAxis.


Field Summary
protected  int count
          The number of units.
protected  int field
          The field (see java.util.Calendar) used to define the DateUnit.
 
Constructor Summary
DateUnit(int field, int count)
          Constructs a DateUnit.
 
Method Summary
 java.util.Date addToDate(java.util.Date base)
          Calculates a new date by adding this DateUnit to the base date.
 int getCount()
          Returns the number of units.
 int getField()
          Returns the field used to define the DateUnit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

protected int field
The field (see java.util.Calendar) used to define the DateUnit.


count

protected int count
The number of units.

Constructor Detail

DateUnit

public DateUnit(int field,
                int count)
Constructs a DateUnit.

The DateUnit is specified using one of the following fields from the java.util.Calendar class: YEAR, MONTH, DATE or DAY_OF_MONTH, HOUR_OF_DAY (not HOUR!), MINUTE, SECOND or MILLISECOND.

You also specify the number of units (for example, you might specify 3 months if you have quarterly data, or 7 days, or 1 hour).

Parameters:
field - The date field.
count - The number of units.
Method Detail

getField

public int getField()
Returns the field used to define the DateUnit. This should be one of the following constants defined in the java.util.Calendar class: YEAR, MONTH, DATE or DAY_OF_MONTH, HOUR_OF_DAY (not HOUR!), MINUTE, SECOND or MILLISECOND.

Returns:
The field used to define the DateUnit.

getCount

public int getCount()
Returns the number of units.

Returns:
The number of units.

addToDate

public java.util.Date addToDate(java.util.Date base)
Calculates a new date by adding this DateUnit to the base date.

Parameters:
The - base date.
Returns:
A new date one DateUnit after the base date.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.