Package com.winterhavenmc.library.time
Enum Class TimeUnit
- All Implemented Interfaces:
Serializable
,Comparable<TimeUnit>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionfinal long
final long
Get the number of milliseconds for each time unit.final boolean
isGreaterThan
(long millis) final boolean
isGreaterThan
(TimeUnit timeUnit) final boolean
isLessThan
(long millis) final boolean
isLessThan
(TimeUnit timeUnit) final long
justShyOf
(int number) final long
one()
final long
times
(int multiplier) final long
toDays
(long duration) final long
toHours
(long duration) final long
toMillis
(long duration) final long
toMinutes
(long duration) final long
toMonths
(long duration) final long
toSeconds
(long duration) final long
toTicks
(long duration) final long
toWeeks
(long duration) final long
toYears
(long duration) static TimeUnit
Returns 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
-
MILLISECONDS
-
TICKS
-
SECONDS
-
MINUTES
-
HOURS
-
DAYS
-
WEEKS
-
MONTHS
-
YEARS
-
-
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
-
toMillis
public final long toMillis(long duration) -
toTicks
public final long toTicks(long duration) -
toSeconds
public final long toSeconds(long duration) -
toMinutes
public final long toMinutes(long duration) -
toHours
public final long toHours(long duration) -
toDays
public final long toDays(long duration) -
toWeeks
public final long toWeeks(long duration) -
toMonths
public final long toMonths(long duration) -
toYears
public final long toYears(long duration) -
convert
-
getMillis
public final long getMillis()Get the number of milliseconds for each time unit.- Returns:
- the number of milliseconds equal to each time unit
-
isLessThan
public final boolean isLessThan(long millis) -
isLessThan
-
isGreaterThan
public final boolean isGreaterThan(long millis) -
isGreaterThan
-
times
public final long times(int multiplier) -
justShyOf
public final long justShyOf(int number) -
one
public final long one()
-