Package com.irurueta.units
Enum Class TimeUnit
- All Implemented Interfaces:
Serializable,Comparable<TimeUnit>,Constable
Enumerator containing recognized typical time units.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCentury time unit (considered as 100 years).Day time unit.Hour time unit.Microsecond time unit.Millisecond time unit.Minute time unit.Month time unit (considered as 30 days).Nanosecond time unit.Second time unit.Week time unit.Year time unit (considered as 365 days). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeUnit[]Gets all supported metric time units.static TimeUnit[]Gets all supported units not belonging to the International System of Units.static UnitSystemgetUnitSystem(TimeUnit unit) Returns unit system for provided time unit.static booleanIndicates whether provided unit belongs to the metric unit system.static booleanIndicates whether provided unit belongs to the International System of units.static TimeUnitReturns the enum constant of this class with the specified name.static TimeUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NANOSECOND
Nanosecond time unit. This belongs to the International System of units. -
MICROSECOND
Microsecond time unit. This belongs to the International System of units. -
MILLISECOND
Millisecond time unit. This belongs to the International System of units. -
SECOND
Second time unit. This belongs to the International System of units. -
MINUTE
Minute time unit. -
HOUR
Hour time unit. -
DAY
Day time unit. -
WEEK
Week time unit. -
MONTH
Month time unit (considered as 30 days). -
YEAR
Year time unit (considered as 365 days). -
CENTURY
Century time unit (considered as 100 years).
-
-
Constructor Details
-
TimeUnit
private TimeUnit()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getUnitSystem
Returns unit system for provided time unit.- Parameters:
unit- time unit to be checked.- Returns:
- returns metric system only for units belonging to the International System of units.
- Throws:
IllegalArgumentException- if unit is null or does not belong to the international system of units.
-
getMetricUnits
Gets all supported metric time units.- Returns:
- all supported metric time units.
-
getNonInternationalSystemUnits
Gets all supported units not belonging to the International System of Units.- Returns:
- all units not belonging to the International System of Units.
-
isMetric
Indicates whether provided unit belongs to the metric unit system.- Parameters:
unit- time unit to be checked.- Returns:
- true if unit belongs to metric unit system.
- Throws:
IllegalArgumentException- if unit is null or not supported.
-
isNonInternationalSystem
Indicates whether provided unit belongs to the International System of units.- Parameters:
unit- time unit to be checked.- Returns:
- true if unit does not belong to the International System of units, false otherwise.
- Throws:
IllegalArgumentException- if unit is null or not supported.
-