star method

  1. @override
IFunctionalStar? star(
  1. StarName starName
)
override

通过星耀名称获取到当前星耀的对象实例 starName 星耀名称 return 星耀实例

Implementation

@override
IFunctionalStar? star(StarName starName) {
  // TODO: implement star
  IFunctionalStar? target;
  for (int i = 0; i < palaces.length; i++) {
    final palace = palaces[i];
    final stars =
        [
          ...palace.majorStars,
          ...palace.minorStars,
          ...palace.adjectiveStars,
        ].toList();
    for (int j = 0; j < stars.length; j++) {
      if (stars[j].name.starKey == starName.starKey) {
        target = stars[j];
        target.setPalace(palace);
        target.setAstrolabe(this);
        break;
      }
    }
  }
  if (target == null) {
    Exception('星耀名称错误,请检查星耀名称是否正确');
  }
  return target;
}