shared.formatting
Class DateFormatter.Epoch

java.lang.Object
  extended by shared.formatting.DateFormatter.Epoch
Enclosing class:
DateFormatter

protected class DateFormatter.Epoch
extends java.lang.Object

Convert between two- and four-digit years using a single year as the start of a two-digit epoch.


Field Summary
private  int epochBoundary
          The smallest two-digit year which occurs within the first of two centuries.
private  int firstCentury
          The first of two centuries for date conversions.
private  int secondCentury
          The second of two centuries for date conversions.
 
Constructor Summary
DateFormatter.Epoch()
          Default constructor.
DateFormatter.Epoch(int firstYearInEpoch)
          Create an epoch instance which begins in the year given.
 
Method Summary
protected  int defaultEpoch()
          Construct a default epoch
protected  void init(int firstYearInEpoch)
          Initialize an epoch instance which begins in a particular year
 int placeInEpoch(int twoDigitYear)
          Place a two-digit year within this epoch.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epochBoundary

private int epochBoundary
The smallest two-digit year which occurs within the first of two centuries.


firstCentury

private int firstCentury
The first of two centuries for date conversions.


secondCentury

private int secondCentury
The second of two centuries for date conversions.

Constructor Detail

DateFormatter.Epoch

public DateFormatter.Epoch()
Default constructor.

The epoch assumed is one which starts 49 years before now. The input date separator is assumed to be "/".


DateFormatter.Epoch

public DateFormatter.Epoch(int firstYearInEpoch)
Create an epoch instance which begins in the year given.

The input date separator is assumed to be a "/".

Parameters:
firstYearInEpoch - The first year of the century in which two-digit years begin.
Method Detail

placeInEpoch

public int placeInEpoch(int twoDigitYear)
Place a two-digit year within this epoch.

Parameters:
twoDigitYear - two-digit year within the given epoch
Returns:
four-digit year placed in the proper century

defaultEpoch

protected int defaultEpoch()
Construct a default epoch

Returns:
today's year minus 49 years.

init

protected void init(int firstYearInEpoch)
Initialize an epoch instance which begins in a particular year

Parameters:
firstYearInEpoch - the first year in the two-digit epoch