Class SexagesimalName
- All Implemented Interfaces:
Serializable
,Comparable<SexagesimalName>
- Direct Known Subclasses:
CyclicYear
Represents the cyclic sexagesimal names used in East Asian calendars following a 60 unit cycle.
It is mainly used for cyclic years. The Chinese calendar also knows cyclic months and days.
- Since:
- 5.7
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Defines the twelvth terrestrial branches with their animal signs (zodiacs).static class
Defines the ten celestial stems. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo(SexagesimalName other)
boolean
Obtains the terrestrial branch of this cyclic sexagesimal name.getDisplayName(Locale locale)
Obtains the localized name of this cyclic sexagesimal name.int
Obtains the associated cyclic number in the range 1-60.getStem()
Obtains the celestial stem of this cyclic sexagesimal name.Obtains the animal describing this cyclic sexagesimal name.int
hashCode()
static SexagesimalName
of(int numberOfCycle)
Obtains an instance of cyclic sexagesimal name.static SexagesimalName
of(SexagesimalName.Stem stem, SexagesimalName.Branch branch)
Obtains an instance of cyclic sexagesimal name.static SexagesimalName
Parses the given localized name as a combination of stem and branch to a cyclic sexagesimal name.roll(int amount)
Rolls this cyclic sexagesimal name by given amount.toString()
-
Method Details
-
of
Obtains an instance of cyclic sexagesimal name.
- Parameters:
numberOfCycle
- cyclic number in the range 1-60- Returns:
- SexagesimalName
- Throws:
IllegalArgumentException
- if the parameter is out of range
-
of
Obtains an instance of cyclic sexagesimal name.
- Parameters:
stem
- celestial stembranch
- terrestrial branch- Returns:
- SexagesimalName
- Throws:
IllegalArgumentException
- if the combination of stem and branch is invalid
-
getNumber
public int getNumber()Obtains the associated cyclic number in the range 1-60.
- Returns:
- int
-
getStem
Obtains the celestial stem of this cyclic sexagesimal name.
- Returns:
- Stem
-
getBranch
Obtains the terrestrial branch of this cyclic sexagesimal name.
- Returns:
- Branch
-
parse
Parses the given localized name as a combination of stem and branch to a cyclic sexagesimal name.
The original Chinese names are usually not translatable. A few languages like Korean, Vietnamese and Russian use their own transcriptions. The pinyin-transcription (official Chinese romanization) serves as fallback for other languages. And the root locale will use a simplified version of pinyin without diacritic accents. This method will always expect a minus sign as separator between stem and branch unless the language is Chinese, Korean or Japanese.
- Parameters:
text
- the text to be parsedlocale
- language- Returns:
- parsed cyclic sexagesimal name
- Throws:
ParseException
- if the text cannot be parsed- See Also:
getDisplayName(Locale)
-
getDisplayName
Obtains the localized name of this cyclic sexagesimal name.
The original Chinese names are usually not translatable. A few languages like Korean, Vietnamese and Russian use their own transcriptions. The pinyin-transcription (official Chinese romanization) serves as fallback for other languages.
- Parameters:
locale
- language- Returns:
- display name
- See Also:
parse(String, Locale)
-
getZodiac
Obtains the animal describing this cyclic sexagesimal name.
Convenient short form for
getBranch().getZodiac(locale)
.- Parameters:
locale
- language- Returns:
- name of associated zodiac animal
-
roll
Rolls this cyclic sexagesimal name by given amount.
- Parameters:
amount
- determines by how many units this instance should be rolled- Returns:
- changed copy of this instance
-
compareTo
- Specified by:
compareTo
in interfaceComparable<SexagesimalName>
-
equals
-
hashCode
public int hashCode() -
toString
-