|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tridas.io.util.AstronomicalYear
public final class AstronomicalYear
This is a year format using the astronomical conventions rather than BC/AD calendar. The value 0 is valid in the astronomical convention. 1 = 1AD 0 = 1BC -1 = 2BC Like Numbers and Strings, are immutable, so they are not Cloneable (there's no reason for them to be).
| Field Summary | |
|---|---|
static AstronomicalYear |
DEFAULT
The default year: 1001. |
| Constructor Summary | |
|---|---|
AstronomicalYear()
Default constructor. |
|
AstronomicalYear(int x)
Constructor for ints. |
|
AstronomicalYear(int row,
int col)
Constructor from (row,col) pair. |
|
AstronomicalYear(SafeIntYear x)
Construct a AstronomicalYear from a SafeIntYear. |
|
AstronomicalYear(String s)
Constructor from String. |
|
AstronomicalYear(org.tridas.schema.Year x)
Construct a AstronomicalYear from a native TridasYear. |
|
| Method Summary | |
|---|---|
AstronomicalYear |
add(int dy)
Adds (or subtracts, for negative values) some number of years, and generates a new Year object. |
int |
column()
Determines what column this year would be, if years were in a grid 10 wide, with the left column years ending in zero. |
int |
compareTo(Object o)
Compares this and o. |
int |
diff(AstronomicalYear y2)
Calculate the number of years difference between two years. |
boolean |
equals(Object y2)
Returns true if and only if this is equal to
y2. |
int |
hashCode()
|
int |
intValue()
This method always throws UnsupportedOperationException. |
boolean |
isYearOne()
Return true, iff this is year 1. |
static AstronomicalYear |
max(AstronomicalYear y1,
AstronomicalYear y2)
The maximum (later) of two years. |
static AstronomicalYear |
min(AstronomicalYear y1,
AstronomicalYear y2)
The minimum (earlier) of two years. |
int |
mod(int m)
Computes this modulo m. |
int |
row()
Determines what row this year would be, if years were in a grid 10 wide, with the left column years ending in zero. |
SafeIntYear |
toSafeIntYear()
|
String |
toString()
Convert to a String |
org.tridas.schema.Year |
toTridasYear(org.tridas.schema.DatingSuffix suffix)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final AstronomicalYear DEFAULT
| Constructor Detail |
|---|
public AstronomicalYear()
DEFAULT as the year.
DEFAULTpublic AstronomicalYear(int x)
ints.
x - the year value, as an intDEFAULTpublic AstronomicalYear(org.tridas.schema.Year x)
x - public AstronomicalYear(SafeIntYear x)
x -
public AstronomicalYear(int row,
int col)
row - the row; row 0 is the decade ending in year 9col - the column; in row 0, year is the column
public AstronomicalYear(String s)
throws NumberFormatException
NumberFormatException - if the String cannot be parsedString| Method Detail |
|---|
public String toString()
toString in class ObjectStringpublic int intValue()
Integer.parseInt(y.toString()). That way you know you're
doing it to get the int, and not for imagined performance or convenience
reasons.
UnsupportedOperationException - always!public org.tridas.schema.Year toTridasYear(org.tridas.schema.DatingSuffix suffix)
public SafeIntYear toSafeIntYear()
public boolean isYearOne()
public static AstronomicalYear max(AstronomicalYear y1,
AstronomicalYear y2)
public static AstronomicalYear min(AstronomicalYear y1,
AstronomicalYear y2)
public AstronomicalYear add(int dy)
dy - the number of years to add (subtract)diff(org.tridas.io.util.AstronomicalYear)public int diff(AstronomicalYear y2)
this and y2;
if they are equal, this number is zero.
y2 - the year to subtract
this and
y2add(int)public int mod(int m)
this modulo m. Always gives a positive
result, even for negative numbers, so it is suitable for computing a grid
position for a span of years.
m - base for modulo
mpublic int row()
column()public int column()
| column() | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| Year | -10 | -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ||
| 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
row()public int compareTo(Object o)
o.
compareTo in interface Comparableo - Object to compare
ClassCastException - if o is not a YearComparablepublic boolean equals(Object y2)
true if and only if this is equal to
y2.
equals in class Objecty2 - the year to compare this to
true if this is equal to y2, else
falsepublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||