LunarYear constructor

LunarYear(
  1. int lunarYear
)

Implementation

LunarYear(int lunarYear) {
  _year = lunarYear;
  int offset = lunarYear - 4;
  int yearGanIndex = offset % 10;
  int yearZhiIndex = offset % 12;
  if (yearGanIndex < 0) {
    yearGanIndex += 10;
  }
  if (yearZhiIndex < 0) {
    yearZhiIndex += 12;
  }
  _ganIndex = yearGanIndex;
  _zhiIndex = yearZhiIndex;
  _compute();
}