public class SexagesimalName extends Object implements Comparable<SexagesimalName>, Serializable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
SexagesimalName.Branch
Defines the twelvth terrestrial branches with their animal signs (zodiacs).
|
static class |
SexagesimalName.Stem
Defines the ten celestial stems.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SexagesimalName other) |
boolean |
equals(Object obj) |
SexagesimalName.Branch |
getBranch()
Obtains the terrestrial branch of this cyclic sexagesimal name.
|
String |
getDisplayName(Locale locale)
Obtains the localized name of this cyclic sexagesimal name.
|
int |
getNumber()
Obtains the associated cyclic number in the range 1-60.
|
SexagesimalName.Stem |
getStem()
Obtains the celestial stem of this cyclic sexagesimal name.
|
String |
getZodiac(Locale locale)
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 |
parse(String text,
Locale locale)
Parses the given localized name as a combination of stem and branch to a cyclic sexagesimal name.
|
SexagesimalName |
roll(int amount)
Rolls this cyclic sexagesimal name by given amount.
|
String |
toString() |
public static SexagesimalName of(int numberOfCycle)
Obtains an instance of cyclic sexagesimal name.
numberOfCycle - cyclic number in the range 1-60IllegalArgumentException - if the parameter is out of rangepublic static SexagesimalName of(SexagesimalName.Stem stem, SexagesimalName.Branch branch)
Obtains an instance of cyclic sexagesimal name.
stem - celestial stembranch - terrestrial branchIllegalArgumentException - if the combination of stem and branch is invalidpublic int getNumber()
Obtains the associated cyclic number in the range 1-60.
public SexagesimalName.Stem getStem()
Obtains the celestial stem of this cyclic sexagesimal name.
public SexagesimalName.Branch getBranch()
Obtains the terrestrial branch of this cyclic sexagesimal name.
public static SexagesimalName parse(String text, Locale locale) throws ParseException
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.
text - the text to be parsedlocale - languageParseException - if the text cannot be parsedgetDisplayName(Locale)public String getDisplayName(Locale locale)
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.
locale - languageparse(String, Locale)public String getZodiac(Locale locale)
Obtains the animal describing this cyclic sexagesimal name.
Convenient short form for getBranch().getZodiac(locale).
locale - languagepublic SexagesimalName roll(int amount)
Rolls this cyclic sexagesimal name by given amount.
amount - determines by how many units this instance should be rolledpublic int compareTo(SexagesimalName other)
compareTo in interface Comparable<SexagesimalName>Copyright © 2014–2021. All rights reserved.