StemBranch.day constructor

StemBranch.day(
  1. int julianDay
)

Creates a StemBranch instance based on the given the Julian day: julianDay.

Implementation

factory StemBranch.day(int julianDay) {
  final stemsOrdered = [
    Stem.yangWood,
    Stem.yinWood,
    Stem.yangFire,
    Stem.yinFire,
    Stem.yangEarth,
    Stem.yinEarth,
    Stem.yangMetal,
    Stem.yinMetal,
    Stem.yangWater,
    Stem.yinWater,
  ];
  final branchesOrdered = [
    Branch.rat,
    Branch.ox,
    Branch.tiger,
    Branch.rabbit,
    Branch.dragon,
    Branch.snake,
    Branch.horse,
    Branch.goat,
    Branch.monkey,
    Branch.rooster,
    Branch.dog,
    Branch.pig,
  ];
  return StemBranch(
      stem: stemsOrdered[(julianDay + 9) % 10],
      branch: branchesOrdered[(julianDay + 1) % 12]);
}