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

Method getYearNineStar

src/main/java/com/nlf/calendar/Lunar.java:2051–2066  ·  view source on GitHub ↗
(String yearInGanZhi)

Source from the content-addressed store, hash-verified

2049 }
2050
2051 protected NineStar getYearNineStar(String yearInGanZhi) {
2052 int indexExact = LunarUtil.getJiaZiIndex(yearInGanZhi) + 1;
2053 int index = LunarUtil.getJiaZiIndex(this.getYearInGanZhi()) + 1;
2054 int yearOffset = indexExact - index;
2055 if (yearOffset > 1) {
2056 yearOffset -= 60;
2057 } else if (yearOffset < -1) {
2058 yearOffset += 60;
2059 }
2060 int yuan = ((this.year + yearOffset + 2696) / 60) % 3;
2061 int offset = (62 + yuan * 3 - indexExact) % 9;
2062 if (0 == offset) {
2063 offset = 9;
2064 }
2065 return NineStar.fromIndex(offset - 1);
2066 }
2067
2068 /**
2069 * 获取值年九星(默认流派2新年以立春零点起算。流年紫白星起例歌诀:年上吉星论甲子,逐年星逆中宫起;上中下作三元汇,一上四中七下兑。)

Callers 3

test1Method · 0.95
test2Method · 0.95
test3Method · 0.95

Calls 5

getJiaZiIndexMethod · 0.95
getYearInGanZhiMethod · 0.95
fromIndexMethod · 0.95
getYearInGanZhiExactMethod · 0.95

Tested by 3

test1Method · 0.76
test2Method · 0.76
test3Method · 0.76