com.facetmap.simple
Class CalendarUnit

java.lang.Object
  extended by com.facetmap.simple.CalendarUnit

public class CalendarUnit
extends java.lang.Object

Provides a quick zoom-in/zoom-out utility for dates. Zoom levels are day, month, year, and all-time. This utility converts all dates to UTC, and discards any information about the time of day, so is only suitable for dates with day precision.


Field Summary
static int DAY
           
static Period DAY_PERIOD
           
static int INSTANT
           
protected  ReadableInterval interval
           
protected  int intervalScope
           
static int MONTH
           
static Period MONTH_PERIOD
           
static int MULTI_DAY
           
static int MULTI_MONTH
           
static int MULTI_YEAR
           
static int SUB_DAY
           
static int YEAR
           
static Period YEAR_PERIOD
           
 
Constructor Summary
CalendarUnit(java.util.Date start, java.util.Date end)
           
 
Method Summary
 boolean contains(CalendarUnit calendarUnit)
           
 int createIntervalScope(ReadableInterval interval)
           
 CalendarUnit getBackwardUnit(CalendarUnit maximum)
           
static CalendarUnit getDay(int year, int month, int dayOfMonth)
           
 java.util.Date getEndInstant()
           
 java.util.List getForwardUnits()
           
 int getIntervalScope()
           
static CalendarUnit getMonth(int year, int month)
           
 java.util.Date getStartInstant()
           
static CalendarUnit getYear(int year)
           
 boolean matches(CalendarUnit resourceCalendarUnit)
          Matches if this date interval contains the resource's date interval, and the two intervals have similar scope (day, month, year, or multi-year).
 void setIntervalScope(int intervalScope)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MULTI_YEAR

public static final int MULTI_YEAR
See Also:
Constant Field Values

YEAR

public static final int YEAR
See Also:
Constant Field Values

MULTI_MONTH

public static final int MULTI_MONTH
See Also:
Constant Field Values

MONTH

public static final int MONTH
See Also:
Constant Field Values

MULTI_DAY

public static final int MULTI_DAY
See Also:
Constant Field Values

DAY

public static final int DAY
See Also:
Constant Field Values

SUB_DAY

public static final int SUB_DAY
See Also:
Constant Field Values

INSTANT

public static final int INSTANT
See Also:
Constant Field Values

YEAR_PERIOD

public static final Period YEAR_PERIOD

MONTH_PERIOD

public static final Period MONTH_PERIOD

DAY_PERIOD

public static final Period DAY_PERIOD

interval

protected ReadableInterval interval

intervalScope

protected int intervalScope
Constructor Detail

CalendarUnit

public CalendarUnit(java.util.Date start,
                    java.util.Date end)
Method Detail

createIntervalScope

public int createIntervalScope(ReadableInterval interval)

getYear

public static CalendarUnit getYear(int year)

getMonth

public static CalendarUnit getMonth(int year,
                                    int month)
Parameters:
month - - 1=January, 12=December

getDay

public static CalendarUnit getDay(int year,
                                  int month,
                                  int dayOfMonth)
Parameters:
month - - 1=January, 12=December
day - - 1 is the first day of the month

getBackwardUnit

public CalendarUnit getBackwardUnit(CalendarUnit maximum)

getForwardUnits

public java.util.List getForwardUnits()

matches

public boolean matches(CalendarUnit resourceCalendarUnit)
Matches if this date interval contains the resource's date interval, and the two intervals have similar scope (day, month, year, or multi-year).


contains

public boolean contains(CalendarUnit calendarUnit)

getEndInstant

public java.util.Date getEndInstant()

getStartInstant

public java.util.Date getStartInstant()

getIntervalScope

public int getIntervalScope()

setIntervalScope

public void setIntervalScope(int intervalScope)