MCPcopy Create free account
hub / github.com/6tail/lunar-java / getTimeNineStar

Method getTimeNineStar

src/main/java/com/nlf/calendar/Lunar.java:2194–2211  ·  view source on GitHub ↗

获取值时九星(时家紫白星歌诀:三元时白最为佳,冬至阳生顺莫差,孟日七宫仲一白,季日四绿发萌芽,每把时辰起甲子,本时星耀照光华,时星移入中宫去,顺飞八方逐细查。夏至阴生逆回首,孟归三碧季加六,仲在九宫时起甲,依然掌中逆轮跨。) @return 九星

()

Source from the content-addressed store, hash-verified

2192 * @return 九星
2193 */
2194 public NineStar getTimeNineStar() {
2195 String solarYmd = solar.toYmd();
2196 boolean asc = false;
2197 if ((solarYmd.compareTo(jieQi.get("冬至").toYmd()) >= 0 && solarYmd.compareTo(jieQi.get("夏至").toYmd()) < 0)) {
2198 asc = true;
2199 } else if (solarYmd.compareTo(jieQi.get("DONG_ZHI").toYmd()) >= 0) {
2200 asc = true;
2201 }
2202 int start = asc ? 6 : 2;
2203 String dayZhi = getDayZhi();
2204 if ("子午卯酉".contains(dayZhi)) {
2205 start = asc ? 0 : 8;
2206 } else if ("辰戌丑未".contains(dayZhi)) {
2207 start = asc ? 3 : 5;
2208 }
2209 int index = asc ? start + timeZhiIndex : start + 9 - timeZhiIndex;
2210 return new NineStar(index % 9);
2211 }
2212
2213 /**
2214 * 获取节气表(节气名称:阳历),节气交接时刻精确到秒,以冬至开头,按先后顺序排列

Callers 2

test10Method · 0.95
test11Method · 0.95

Calls 3

getDayZhiMethod · 0.95
toYmdMethod · 0.80
containsMethod · 0.80

Tested by 2

test10Method · 0.76
test11Method · 0.76