Enum Class MoonPhase
- All Implemented Interfaces:
Serializable
,Comparable<MoonPhase>
,java.lang.constant.Constable
Enumeration of the four most important moon phases.
- Since:
- 3.36/4.31
- Author:
- Meno Hochschild
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionMarks the first quarter moon.Marks the full moon.Marks the last quarter moon.Phase of new moon. -
Method Summary
Modifier and TypeMethodDescriptionObtains the first moon phase which is after given moment.atLunation(int n)
Obtains the time of n-th lunation based on this type of phase.Obtains the first moon phase which is at or after given moment.Obtains the last moon phase which is still before given moment.static double
getIllumination(Moment moment)
Determines the degree of illumination of the moon at given moment.static double
getIllumination(Moment moment, int precision)
Determines the degree of illumination of the moon at given moment.static int
Obtains the maximum supported lunation.static int
Obtains the minimum supported lunation.static MoonPhase
Returns the enum constant of this class with the specified name.static MoonPhase[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
NEW_MOON
Phase of new moon.
-
FIRST_QUARTER
Marks the first quarter moon.
-
FULL_MOON
Marks the full moon.
-
LAST_QUARTER
Marks the last quarter moon.
-
-
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
-
after
Obtains the first moon phase which is after given moment.
- Parameters:
moment
- the moment to be compared with- Returns:
- first time of this phase after given moment
- Throws:
IllegalArgumentException
- if the associated year is not in the range-2000 <= year <= 3000
-
atOrAfter
Obtains the first moon phase which is at or after given moment.
- Parameters:
moment
- the moment to be compared with- Returns:
- first time of this phase at or after given moment
- Throws:
IllegalArgumentException
- if the associated year is not in the range-2000 <= year <= 3000
- Since:
- 3.39/4.34
-
before
Obtains the last moon phase which is still before given moment.
- Parameters:
moment
- the moment to be compared with- Returns:
- last time of this phase before given moment
- Throws:
IllegalArgumentException
- if the associated year is not in the range-2000 <= year <= 3000
-
minLunation
public static int minLunation()Obtains the minimum supported lunation.
- Returns:
- int
- Since:
- 3.38/4.33
- See Also:
atLunation(int)
-
maxLunation
public static int maxLunation()Obtains the maximum supported lunation.
- Returns:
- int
- Since:
- 3.38/4.33
- See Also:
atLunation(int)
-
atLunation
Obtains the time of n-th lunation based on this type of phase.
The parameter value
n = 0
will determine the first phase after the calendar date 2000-01-01. For example, the expressionNEW_MOON.atLunation(0)
calculates the first new moon in year 2000 which is on the date 2000-01-06 (UTC). The lunation parameter should be chosen within the rangeminLunation() <= n <= maxLunation()
.- Parameters:
n
- count of lunations (distance between two consecutive moon phases of same type)- Returns:
- moment of this phase after given lunations
- Throws:
IllegalArgumentException
- if the associated year is not in the range-2000 <= year <= 3000
- See Also:
minLunation()
,maxLunation()
-
getIllumination
Determines the degree of illumination of the moon at given moment.
The precision is limited to percent values (two digits after decimal point).
- Parameters:
moment
- universal time- Returns:
- degree of illumination in range
0.00 <= i <= 1.00
-
getIllumination
Determines the degree of illumination of the moon at given moment.
The accuracy is limited to percent values (two digits after decimal point) if specified as
0
. For promille values, specify1
etc. However, an increased precision does not imply more accuracy but is only suitable to show some vague tendencies. Percent precision is usually the best choice.- Parameters:
moment
- universal timeprecision
- desired count of fractional digits of percent values (in range0-3
)- Returns:
- degree of illumination in range
0.00 <= i <= 1.00
- Throws:
IndexOutOfBoundsException
- if the precision is out of range- Since:
- 3.40/4.35
-