|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.Ostermiller.util.YearExtensionAround
public class YearExtensionAround
Extend years like '99 to 1999 based on dates around the current date.
Field Summary | |
---|---|
static YearExtensionAround |
CENTURY_1900
Extend a two digit year to a year in the 1900s 00 to 1900 01 to 1901 49 to 1949 50 to 1950 99 to 1999 |
static YearExtensionAround |
CENTURY_2000
Extend a two digit year to a year in the 2000s 00 to 2000 01 to 2001 49 to 2049 50 to 2050 99 to 2099 |
static YearExtensionAround |
LATEST
Extend a two digit year to the nearest year that ends in those two digits. |
static YearExtensionAround |
NEAREST
Extend a two digit year to the nearest year that ends in those two digits. |
Constructor Summary | |
---|---|
YearExtensionAround(int allowedYearsInPast)
Create a year extension nearest policy with the current year taken from the system time. |
|
YearExtensionAround(int allowedYearsInPast,
int currentYear)
Create a year extension nearest policy with the given current year |
Method Summary | |
---|---|
int |
extendYear(int twoDigitYear)
Extend a two digit year to the nearest year that ends in those two digits. |
static YearExtensionAround |
getLatest(int currentYear)
Extend a two digit year to the nearest year that ends in those two digits. |
static YearExtensionAround |
getNearest(int currentYear)
Extend a two digit year to the nearest year that ends in those two digits. |
void |
setAllowedYearsInPast(int allowedYearsInPast)
Number of years in the past to allow dates |
void |
setCurrentYear(int currentYear)
Set the current year. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final YearExtensionAround NEAREST
When it is the year 2000:
public static final YearExtensionAround LATEST
When it is the year 2000:
public static final YearExtensionAround CENTURY_1900
public static final YearExtensionAround CENTURY_2000
Constructor Detail |
---|
public YearExtensionAround(int allowedYearsInPast)
public YearExtensionAround(int allowedYearsInPast, int currentYear)
currentYear
- full year eg 2000Method Detail |
---|
public static final YearExtensionAround getNearest(int currentYear)
When it is the year 2000:
currentYear
- the current yearpublic static final YearExtensionAround getLatest(int currentYear)
When it is the year 2000:
currentYear
- the current yearpublic void setAllowedYearsInPast(int allowedYearsInPast)
allowedYearsInPast
- number between 0 and 99public void setCurrentYear(int currentYear)
currentYear
- full year eg 2000public int extendYear(int twoDigitYear)
Will choose a year within 100 years of the current year. Whether the year is in the past or future is determined by how many years are allowed in the past.
extendYear
in interface YearExtensionPolicy
twoDigitYear
- year from 0 to 99
|
com.Ostermiller.util Java Utilities |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2001-2012 by Stephen Ostermiller