| 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新年以立春零点起算。流年紫白星起例歌诀:年上吉星论甲子,逐年星逆中宫起;上中下作三元汇,一上四中七下兑。) |