org.archive.wayback.util.partition
Interface PartitionSize

All Known Implementing Classes:
DayPartitionSize, HourPartitionSize, MonthPartitionSize, TwoMonthPartitionSize, TwoYearPartitionSize, WeekPartitionSize, YearPartitionSize

public interface PartitionSize

A class which simplifies partitioning Dates based on human logical time intervals: Day, Week, TwoYear. Implementing classes provide methods to align Calendars at the start of the nearest Day, Month, Week, etc. In addition, implementors provide methods to create new Calendars based on their specific alignment size.

Author:
brad

Field Summary
static long DAY_IN_MONTH
          approximate days in one month, that is, 30 days
static long DAY_IN_WEEK
          days in a 7 day week...
static long DAY_IN_YEAR
          days in one year, assuming a non-leap year
static String DAY_NAME
           
static long HOUR_IN_DAY
          hours in a day: 24
static String HOUR_NAME
           
static String MONTH_NAME
           
static long MS_IN_DAY
          milliseconds in 1 day (approximate: no leap second accounted for)
static long MS_IN_HOUR
          milliseconds in 1 hour (approximate: no leap second accounted for)
static long MS_IN_MONTH
          milliseconds in one month (approximate: no leap day/sec accounted for, and assumes 30 days in a month)
static long MS_IN_SEC
          number of milliseconds in a second..
static long MS_IN_TWO_MONTH
          milliseconds in two months (approximate: no leap day/sec accounted for, and assumes 30 day months)
static long MS_IN_TWO_YEAR
          milliseconds in two years (approximate: no leap day/sec accounted for)
static long MS_IN_WEEK
          milliseconds in 7 days (approximate: no leap second accounted for)
static long MS_IN_YEAR
          milliseconds in one year (approximate: no leap day/sec accounted for)
static long SEC_IN_HOUR
          seconds in a non-leap-second hour
static String TWO_MONTH_NAME
           
static String TWO_YEAR_NAME
           
static String WEEK_NAME
           
static String YEAR_NAME
           
 
Method Summary
 void alignStart(Calendar in)
          Align the calendar argument to the start of the interval covered by this size.
 Calendar increment(Calendar start, int offset)
          Create a new Calendar object, aligned relative to the Calendar argument, either forward or backward some number of partitions.
 long intervalMS()
           
 String name()
           
 

Field Detail

MS_IN_SEC

static final long MS_IN_SEC
number of milliseconds in a second..

See Also:
Constant Field Values

SEC_IN_HOUR

static final long SEC_IN_HOUR
seconds in a non-leap-second hour

See Also:
Constant Field Values

HOUR_IN_DAY

static final long HOUR_IN_DAY
hours in a day: 24

See Also:
Constant Field Values

DAY_IN_WEEK

static final long DAY_IN_WEEK
days in a 7 day week... what color was his white horse?

See Also:
Constant Field Values

DAY_IN_MONTH

static final long DAY_IN_MONTH
approximate days in one month, that is, 30 days

See Also:
Constant Field Values

DAY_IN_YEAR

static final long DAY_IN_YEAR
days in one year, assuming a non-leap year

See Also:
Constant Field Values

MS_IN_HOUR

static final long MS_IN_HOUR
milliseconds in 1 hour (approximate: no leap second accounted for)

See Also:
Constant Field Values

MS_IN_DAY

static final long MS_IN_DAY
milliseconds in 1 day (approximate: no leap second accounted for)

See Also:
Constant Field Values

MS_IN_WEEK

static final long MS_IN_WEEK
milliseconds in 7 days (approximate: no leap second accounted for)

See Also:
Constant Field Values

MS_IN_MONTH

static final long MS_IN_MONTH
milliseconds in one month (approximate: no leap day/sec accounted for, and assumes 30 days in a month)

See Also:
Constant Field Values

MS_IN_TWO_MONTH

static final long MS_IN_TWO_MONTH
milliseconds in two months (approximate: no leap day/sec accounted for, and assumes 30 day months)

See Also:
Constant Field Values

MS_IN_YEAR

static final long MS_IN_YEAR
milliseconds in one year (approximate: no leap day/sec accounted for)

See Also:
Constant Field Values

MS_IN_TWO_YEAR

static final long MS_IN_TWO_YEAR
milliseconds in two years (approximate: no leap day/sec accounted for)

See Also:
Constant Field Values

HOUR_NAME

static final String HOUR_NAME
See Also:
Constant Field Values

DAY_NAME

static final String DAY_NAME
See Also:
Constant Field Values

WEEK_NAME

static final String WEEK_NAME
See Also:
Constant Field Values

MONTH_NAME

static final String MONTH_NAME
See Also:
Constant Field Values

TWO_MONTH_NAME

static final String TWO_MONTH_NAME
See Also:
Constant Field Values

YEAR_NAME

static final String YEAR_NAME
See Also:
Constant Field Values

TWO_YEAR_NAME

static final String TWO_YEAR_NAME
See Also:
Constant Field Values
Method Detail

alignStart

void alignStart(Calendar in)
Align the calendar argument to the start of the interval covered by this size. Calling this method on a DayPartitionSize will align the Calendar to the beginning of the Day in which the Calendar's Date object falls within.

Parameters:
in - Calendar object which has internal Date set

increment

Calendar increment(Calendar start,
                   int offset)
Create a new Calendar object, aligned relative to the Calendar argument, either forward or backward some number of partitions.

Parameters:
start - the returned Calendar will be aligned one day, week, month, etc. ahead or behind of this Calendar argument.
offset - the relative distance to move the returned calendar relative to the argument Calendar.
Returns:
a new Calendar aligned relative to the start Calendar.

intervalMS

long intervalMS()
Returns:
the estimated number of milliseconds covered by this PartitionSize. Note that this is estimated because of different number of days in a month, leap days, leap seconds, etc.

name

String name()
Returns:
the name of this PartitionSize. Likely useful for localized lookup of human readable text from a properties file.


Copyright © 2005-2011 Internet Archive. All Rights Reserved.