|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.time.calendar.PeriodUnit javax.time.calendar.ISOPeriodUnit
public final class ISOPeriodUnit
The units of time used by the ISO calendar system, such as 'Days' or 'Minutes'.
ISOPeriodUnit
consists of immutable definitions of units of human-scale time.
For example, humans typically measure periods of time in units of years, months,
days, hours, minutes and seconds. These concepts are defined by instances of
this class defined in the chronology classes.
Units are either basic or derived. A derived unit can be converted accurately to another smaller unit. A basic unit is fundamental, and has no smaller representation. For example years are a derived unit consisting of 12 months, where a month is a basic unit.
Other calendar systems should re-use units from here where appropriate. For example, the definition of a day is usually the same in other calendar systems. To be able to re-use a unit, the definition in the other calendar system must match the definition of a unit and all its dependent units.
This class is final, immutable and thread-safe.
Field Summary | |
---|---|
static PeriodUnit |
_12_HOURS
The period unit for twelve hours, as used by AM/PM. |
static PeriodUnit |
_24_HOURS
The period unit for twenty-four hours, that is often treated as a day. |
static PeriodUnit |
CENTURIES
The period unit for centuries. |
static PeriodUnit |
DAYS
The period unit for days. |
static PeriodUnit |
DECADES
The period unit for decades. |
static PeriodUnit |
ERAS
The period unit for eras. |
static PeriodUnit |
HOURS
The period unit for hours. |
static PeriodUnit |
MICROS
The period unit for microseconds. |
static PeriodUnit |
MILLENNIA
The period unit for millennia. |
static PeriodUnit |
MILLIS
The period unit for milliseconds. |
static PeriodUnit |
MINUTES
The period unit for minutes. |
static PeriodUnit |
MONTHS
The period unit for months. |
static PeriodUnit |
NANOS
The period unit for nanoseconds. |
static PeriodUnit |
QUARTERS
The period unit for quarters of years. |
static PeriodUnit |
SECONDS
The period unit for seconds. |
static PeriodUnit |
WEEK_BASED_YEARS
The period unit for week-based-years as defined by ISO-8601. |
static PeriodUnit |
WEEKS
The period unit for weeks. |
static PeriodUnit |
YEARS
The period unit for years. |
Method Summary | |
---|---|
int |
compareTo(PeriodUnit other)
Compares this unit to another. |
boolean |
equals(java.lang.Object obj)
Checks if this unit is equal to another unit. |
int |
hashCode()
A hash code for this unit. |
Methods inherited from class javax.time.calendar.PeriodUnit |
---|
convertEquivalent, convertEquivalent, field, getBaseEquivalent, getBaseEquivalentAmount, getBaseUnit, getDurationEstimate, getName, toEquivalent, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PeriodUnit NANOS
This is a basic unit and has no equivalent period. The estimated duration is 1 nanosecond. This unit does not depends on any other unit.
public static final PeriodUnit MICROS
The equivalent period and estimated duration is based on 1000 nanoseconds. This unit depends on the Nanos unit and all units that depends on.
public static final PeriodUnit MILLIS
The equivalent period and estimated duration is based on 1,000,000 nanoseconds. This unit depends on the Micros unit and all units that depends on.
public static final PeriodUnit SECONDS
The equivalent period and estimated duration is based on 1,000,000,000 nanoseconds. This unit depends on the Millis unit and all units that depends on.
public static final PeriodUnit MINUTES
The equivalent period and estimated duration is based on 60 seconds. This unit depends on the Seconds unit and all units that depends on.
public static final PeriodUnit HOURS
The equivalent period and estimated duration is based on 60 minutes. This unit depends on the Minutes unit and all units that depends on.
public static final PeriodUnit _12_HOURS
The equivalent period and estimated duration is based on 12 hours. This unit depends on the Hours unit and all units that depends on.
public static final PeriodUnit _24_HOURS
The period unit defines the concept of a period of exactly 24 hours that
is often treated as a day. The unit name of "24Hours" is intended to convey
the fact that this is primarily a 24 hour unit that happens to be used as
a day unit on occasion. In most scenarios, the standard Days
unit is more applicable and accurate.
This class defines two units that could represent a day.
This unit, 24Hours
, represents a fixed length of exactly 24 hours,
allowing it to be converted to seconds, nanoseconds and Duration
.
By contrast, the Days
unit varies in length based on time-zone (daylight
savings time) changes and cannot be converted to seconds, nanoseconds or Duration
.
The equivalent period and estimated duration is based on 24 hours. This unit depends on the 12Hours unit and all units that depends on.
public static final PeriodUnit DAYS
The period unit defines the concept of a period of a day. This is typically equal to 24 hours, but may vary due to time-zone changes.
This class defines two units that could represent a day.
This unit, Days
, represents a day that varies in length based on
time-zone (daylight savings time) changes. It is a basic unit that cannot
be converted to seconds, nanoseconds or Duration
.
By contrast, the 24Hours
unit has a fixed length of
exactly 24 hours allowing it to be converted to seconds, nanoseconds and Duration
.
This is a basic unit and has no equivalent period. The estimated duration is equal to 24 hours. This unit does not depends on any other unit.
public static final PeriodUnit WEEKS
The equivalent period and estimated duration is based on 7 days. This unit depends on the Days unit and all units that depends on.
public static final PeriodUnit MONTHS
This is a basic unit and has no equivalent period. The estimated duration is equal to one-twelfth of a year based on 365.2425 days. This unit does not depend on any other unit.
public static final PeriodUnit QUARTERS
The equivalent period and estimated duration is based on 3 months. This unit depends on the Months unit and all units that depends on.
public static final PeriodUnit WEEK_BASED_YEARS
This is a basic unit and has no equivalent period. The estimated duration is equal to 364.5 days, which is just over 52 weeks. This unit does not depend on any other unit.
public static final PeriodUnit YEARS
The equivalent period and estimated duration is based on 12 months based on 365.2425 days. This unit depends on the Quarters unit and all units that depends on.
public static final PeriodUnit DECADES
The equivalent period and estimated duration is based on 10 years. This unit depends on the Years unit and all units that depends on.
public static final PeriodUnit CENTURIES
The equivalent period and estimated duration is based on 100 years. This unit depends on the Decades unit and all units that depends on.
public static final PeriodUnit MILLENNIA
The equivalent period and estimated duration is based on 1000 years. This unit depends on the Centuries unit and all units that depends on.
public static final PeriodUnit ERAS
This represents an era based on a simple before/after point on the time-line. Such an era is infinite in length. For this rule, an era has an estimated duration of 2,000,000,000 years.
This is a basic unit and has no equivalent period. The estimated duration is equal to 2,000,000,000 years. This unit does not depend on any other unit.
Method Detail |
---|
public int compareTo(PeriodUnit other)
PeriodUnit
The comparison is based primarily on the estimated duration
.
If that is equal, the name is compared using standard string comparison.
Then the base units are compared, followed by the base equivalent period.
compareTo
in interface java.lang.Comparable<PeriodUnit>
compareTo
in class PeriodUnit
other
- the other type to compare to, not null
public boolean equals(java.lang.Object obj)
PeriodUnit
The comparison is based on the name, estimated duration, base unit and base equivalent period.
equals
in class PeriodUnit
obj
- the object to check, null returns false
public int hashCode()
PeriodUnit
hashCode
in class PeriodUnit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |