기간합산
2026년 3월 18일 12:15분
package com.jesusbornd.leviticus;
import java.util.EnumMap;
import java.util.Map;
public class Leviticus_12_Chapter_Lv2 {
enum BirthCase {
BOY, GIRL
}
static class Period {
final int uncleanDays;
final int purifyDays;
Period(int uncleanDays, int purifyDays) {
if (uncleanDays < 0 || purifyDays < 0) throw new IllegalArgumentException("days<0");
this.uncleanDays = uncleanDays;
this.purifyDays = purifyDays;
}
int total() {
return uncleanDays + purifyDays;
}
}
static Map<BirthCase, Period> scheduleFromText() {
Map<BirthCase, Period> m = new EnumMap<BirthCase, Period>(BirthCase.class);
m.put(BirthCase.BOY, new Period(7, 33));
m.put(BirthCase.GIRL, new Period(14, 66));
return m;
from dataclasses import dataclass
@dataclass(frozen=True)
class Period:
unclean_days: int
purify_days: int
def total(self) -> int:
if self.unclean_days < 0 or self.purify_days < 0:
raise ValueError("days<0")
return self.unclean_days + self.purify_days
def schedule_from_text():
return {
"BOY": Period(7, 33),
"GIRL": Period(14, 66),
}
def assert_total(key: str, p: Period, expected_total: int):
got = p.total()
if got != expected_total:
raise RuntimeError(f"{key} total mismatch: {got}")
schedule = schedule_from_text()
boy = schedule["BOY"]
girl = schedule["GIRL"]
assert_total("BOY", boy, 40)
assert_total("GIRL", girl, 80)
print("BOY", "unclean=", boy.unclean_days, "purify=", boy.purify_days, "total=", boy.total())
print("GIRL", "unclean=", girl.unclean_days, "purify=", girl.purify_days, "total=", girl.total())
Search
Categories
← 목록으로
Comments
이런 규례들을 보면서 결국 우리를 온전히 깨끗하게 하시는 분은 예수님이라는 사실도 떠오릅니다. 사람은 기간을 지나야 했지만, 주님은 우리를 더 근본적으로 새롭게 하신다는 점에서 복음의 은혜가 더 크게 느껴집니다.