Package javax.time.calendar
Class ISOChronology.Unit
- java.lang.Object
-
- javax.time.calendar.PeriodUnit
-
- javax.time.calendar.ISOChronology.Unit
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PeriodUnit>
- Enclosing class:
- ISOChronology
static final class ISOChronology.Unit extends PeriodUnit
Single unit subclass, which means fewer classes to load at startup.
-
-
Field Summary
Fields Modifier and Type Field Description private int
ordinal
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
Unit(int ordinal, java.lang.String name, PeriodField equivalentPeriod, Duration estimatedDuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PeriodUnit other)
Compares this unit to another.boolean
equals(java.lang.Object obj)
Compares two units based on the name, estimated duration and equivalent period.int
hashCode()
Returns a hash code based on the name, estimated duration and equivalent period.private java.lang.Object
readResolve()
-
Methods inherited from class javax.time.calendar.PeriodUnit
getBaseUnit, getEquivalentPeriod, getEquivalentPeriods, getEstimatedDuration, getName, isConvertibleTo, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ordinal
private final int ordinal
-
-
Constructor Detail
-
Unit
private Unit(int ordinal, java.lang.String name, PeriodField equivalentPeriod, Duration estimatedDuration)
-
-
Method Detail
-
readResolve
private java.lang.Object readResolve()
-
compareTo
public int compareTo(PeriodUnit other)
Description copied from class:PeriodUnit
Compares this unit to another.The comparison is based primarily on the
estimated duration
. If that is equal, the name is compared using standard string comparison. Finally, the first equivalent period is checked, with basic units before derived ones.- Specified by:
compareTo
in interfacejava.lang.Comparable<PeriodUnit>
- Overrides:
compareTo
in classPeriodUnit
- Parameters:
other
- the other type to compare to, not null- Returns:
- the comparator result, negative if less, positive if greater, zero if equal
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:PeriodUnit
Compares two units based on the name, estimated duration and equivalent period.- Overrides:
equals
in classPeriodUnit
- Parameters:
obj
- the object to compare to, null returns false- Returns:
- true if the units are the same
-
hashCode
public int hashCode()
Description copied from class:PeriodUnit
Returns a hash code based on the name, estimated duration and equivalent period.- Overrides:
hashCode
in classPeriodUnit
- Returns:
- a suitable hash code
-
-