|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tridas.io.util.YearRange
public class YearRange
A range of years. Ranges are immutable; all otherwise-destructive operations on a Range return a new Range.
SafeIntYear
,
TreeRingData
Constructor Summary | |
---|---|
YearRange()
Construct a new empty range, starting at Year.DEFAULT . |
|
YearRange(AstronomicalYear y1,
AstronomicalYear y2)
Construct a new range using Astronomical years |
|
YearRange(org.tridas.interfaces.ITridasSeries series)
Create a range from a Tridas series. |
|
YearRange(SafeIntYear y,
int span)
Construct a range, given a starting year and span. |
|
YearRange(SafeIntYear y1,
SafeIntYear y2)
Construct a new range, from y1 to y2. |
|
YearRange(String s)
Construct a range from a String. |
Method Summary | |
---|---|
int |
compareTo(Object o)
Compares this and o, for placing in fallback order. |
boolean |
contains(SafeIntYear y)
Return true if (and only if) the given year is inside the range, inclusive. |
boolean |
contains(YearRange r)
Return true if (and only if) the given range is completely inside the range, inclusive. |
boolean |
endOfRow(SafeIntYear y)
Return true, iff this year is the end of a row. |
boolean |
equals(Object o)
Compare two ranges for equality. |
SafeIntYear |
getEnd()
Get the ending year of this range. |
SafeIntYear |
getStart()
Get the starting year of this range. |
int |
hashCode()
A hash code for the Range. |
YearRange |
intersection(YearRange r)
The intersection of this range with r. |
int |
overlap(YearRange r)
Return the number of years overlap between this range and the given range. |
YearRange |
redateBy(int dy)
Redate a range by a certain number of years. |
YearRange |
redateEndTo(SafeIntYear y)
Set the ending year of the range, and adjust the start year to maintain the same length. |
YearRange |
redateStartTo(SafeIntYear y)
Set the starting year of the range, and adjust the ending year to maintain the same length. |
int |
rows()
Compute the number of rows this Range will take to display, assuming rows are marked off as the row() method does. |
int |
span()
Return the number of years spanned by this range. |
boolean |
startOfRow(SafeIntYear y)
Return true, iff this year is the start of a row. |
String |
toString()
Return a simple string representation of the range, like "1001 - 1036". |
String |
toStringWithSpan()
Return a string representation of the range, including the span, like "(1001 - 1036, n=36)". |
YearRange |
union(YearRange r)
The union of this range with r. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public YearRange()
Year.DEFAULT
.
SafeIntYear
public YearRange(SafeIntYear y1, SafeIntYear y2)
null
.) If y2 < y1, it is an
empty interval.
y1
- starting yeary2
- ending yearpublic YearRange(SafeIntYear y, int span)
y
- the starting yearspan
- the number of yearspublic YearRange(String s)
s
- the Stringpublic YearRange(org.tridas.interfaces.ITridasSeries series)
series
- public YearRange(AstronomicalYear y1, AstronomicalYear y2)
y1
- starting yeary2
- ending yearMethod Detail |
---|
public SafeIntYear getStart()
public SafeIntYear getEnd()
public YearRange redateStartTo(SafeIntYear y)
y
- new starting year for the rangeredateEndTo(org.tridas.io.util.SafeIntYear)
public YearRange redateBy(int dy)
dy
- the number of years to shift this range bypublic YearRange redateEndTo(SafeIntYear y)
y
- new ending year for the rangeredateStartTo(org.tridas.io.util.SafeIntYear)
public int span()
public int rows()
public String toString()
toString
in class Object
public String toStringWithSpan()
public boolean contains(SafeIntYear y)
y
- year to check
y
is in the range, else falsepublic boolean contains(YearRange r)
r
- range to check
r
is entirely in the range, else falsepublic boolean startOfRow(SafeIntYear y)
public boolean endOfRow(SafeIntYear y)
public int overlap(YearRange r)
r
- range to compare
public YearRange intersection(YearRange r)
r
- the range to intersect with this range
union(org.tridas.io.util.YearRange)
public YearRange union(YearRange r)
r
- the range to union with this range
intersection(org.tridas.io.util.YearRange)
public boolean equals(Object o)
equals
in class Object
r
- range to compare with this
public int hashCode()
hashCode
in class Object
public int compareTo(Object o)
compareTo
in interface Comparable
o
- Object to compare
ClassCastException
- if o is not a Range
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |