Package org.orekit.time
Enum Month
- java.lang.Object
-
- java.lang.Enum<Month>
-
- org.orekit.time.Month
-
- All Implemented Interfaces:
Serializable
,Comparable<Month>
public enum Month extends Enum<Month>
Enumerate representing a calendar month.This enum is mainly useful to parse data files that use month names like Jan or JAN or January or numbers like 1 or 01. It handles month numbers as well as three letters abbreviation and full names, independently of capitalization.
- Author:
- Luc Maisonobe
- See Also:
DateComponents
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCapitalizedAbbreviation()
Get the capitalized three letters abbreviation.String
getCapitalizedName()
Get the capitalized full name.String
getLowerCaseAbbreviation()
Get the lower case three letters abbreviation.String
getLowerCaseName()
Get the lower case full name.static Month
getMonth(int number)
Get the month corresponding to a number.int
getNumber()
Get the month number.String
getUpperCaseAbbreviation()
Get the upper case three letters abbreviation.String
getUpperCaseName()
Get the upper case full name.static Month
parseMonth(String s)
Parse the string to get the month.static Month
valueOf(String name)
Returns the enum constant of this type with the specified name.static Month[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JANUARY
public static final Month JANUARY
January.
-
FEBRUARY
public static final Month FEBRUARY
February.
-
MARCH
public static final Month MARCH
March.
-
APRIL
public static final Month APRIL
April.
-
MAY
public static final Month MAY
May.
-
JUNE
public static final Month JUNE
June.
-
JULY
public static final Month JULY
July.
-
AUGUST
public static final Month AUGUST
August.
-
SEPTEMBER
public static final Month SEPTEMBER
September.
-
OCTOBER
public static final Month OCTOBER
October.
-
NOVEMBER
public static final Month NOVEMBER
November.
-
DECEMBER
public static final Month DECEMBER
December.
-
-
Method Detail
-
values
public static Month[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Month c : Month.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Month valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getNumber
public int getNumber()
Get the month number.- Returns:
- month number between 1 and 12
-
getUpperCaseName
public String getUpperCaseName()
Get the upper case full name.- Returns:
- upper case full name
-
getLowerCaseName
public String getLowerCaseName()
Get the lower case full name.- Returns:
- lower case full name
-
getCapitalizedName
public String getCapitalizedName()
Get the capitalized full name.- Returns:
- capitalized full name
-
getUpperCaseAbbreviation
public String getUpperCaseAbbreviation()
Get the upper case three letters abbreviation.- Returns:
- upper case three letters abbreviation
-
getLowerCaseAbbreviation
public String getLowerCaseAbbreviation()
Get the lower case three letters abbreviation.- Returns:
- lower case three letters abbreviation
-
getCapitalizedAbbreviation
public String getCapitalizedAbbreviation()
Get the capitalized three letters abbreviation.- Returns:
- capitalized three letters abbreviation
-
parseMonth
public static Month parseMonth(String s)
Parse the string to get the month.The string can be either the month number, the full name or the three letter abbreviation. The parsing ignore the case of the specified string and trims surrounding blanks.
- Parameters:
s
- string to parse- Returns:
- the month corresponding to the string
- Throws:
IllegalArgumentException
- if the string does not correspond to a month
-
getMonth
public static Month getMonth(int number)
Get the month corresponding to a number.- Parameters:
number
- month number- Returns:
- the month corresponding to the string
- Throws:
IllegalArgumentException
- if the string does not correspond to a month
-
-