막벨라굴

2025년 11월 19일 11:41분

package com.jesusbornd.genesis;

/*
 * Genesis_23_Chapter_Lv1_V2.java
 * Variation:
 * 1) sealed interface Section + switch rendering
 * 2) record Verse + highlight function
 * 3) 약속의 땅 ‘최초의 실제 소유’가 되는 막벨라 굴 강조
 */

import java.util.List;
import java.util.stream.Stream;

public class Genesis_23_Chapter_Lv1_V2 {

    // ---- Domain Model ----
    public sealed interface Section permits Title, Verses, Summary, Practice {}
    public static final class Title implements Section {}
    public static final class Verses implements Section {}
    public static final class Summary implements Section {}
    public static final class Practice implements Section {}

    public record Verse(String ref, String krv, String esv) {
        Stream<String> lines() {
            return Stream.of(
                ref,
                "KRV: " + hi(krv),
                "ESV: " + hi(esv),
                ""
            );
        }
    }

    private static final List<Verse> VERSES = List.of(
        new Verse(
            "창세기 23:2 / Genesis 23:2",
            "사라가 죽으매… 아브라함이 들어가서 사라를 위하여 울며 애통하더니",
            "Sarah died… and Abraham went in to mourn and weep for her."
        ),
        new Verse(
            "창세기 23:4 / Genesis 23:4",
            "나는 나그네요 거류민이니… 너희의 묘실을 팔아 사라를 [장사하게] 하라",
            "I am a sojourner… give me property among you for a burying place, that I may [bury] my dead."
        ),
        new Verse(
            "창세기 23:9 / Genesis 23:9",
            "막벨라 굴을 내게 주되… 충분한 값을 받고 주어 내가 [장사]하게 하기를 원하노라",
            "Give me the cave of [Machpelah]… for the full price, as a property for me to [bury] my dead."
        ),
        new Verse(
            "창세기 23:20 / Genesis 23:20",
            "그 밭과 그 속의 굴이 아브라함의 [소유]로 확정되니",
            "The field and the cave were made sure as Abraham’s [possession] for a burying place."
        )
    );

    // ---- Highlight ----
    private static String hi(String s) {
        return s.replace("장사", "[장사]")
                .replace("bury", "[bury]")
                .replace("Machpelah", "[Machpelah]")
                .replace("막벨라", "[막벨라]")
                .replace("소유", "[소유]")
                .replace("possession", "[possession]");
    }

    // ---- Summary / Practice ----
    private static final String SUMMARY_KO =
        "아브라함은 사라의 죽음을 애통하며(23:2), ‘나그네’라 고백하면서도(23:4) 막벨라 굴을 값을 주고 사서 "
        + "약속의 땅에서 최초의 실제 [소유]를 얻는다(23:20).";

    private static final String SUMMARY_EN =
        "Abraham mourns Sarah (23:2), confesses he is a foreigner (23:4), yet purchases the cave of Machpelah as the "
        + "first actual [possession] in the promised land (23:20).";

    private static final String PRACTICE_KO =
        "오늘 ‘나그네 의식’을 기억하며… 값주고 순종해야 할 일 1가지 점검하기.";
    private static final String PRACTICE_EN =
        "Remember your pilgrim identity… choose one obedience that costs something today.";

    public static void main(String[] args) {
        final String nl = System.lineSeparator();
        StringBuilder out = new StringBuilder();

        List<Section> flow = List.of(new Title(), new Verses(), new Summary(), new Practice());

        for (Section sec : flow) {
            switch (sec) {
                case Title t -> {
                    out.append("[창세기 23장 | KRV & ESV]").append(nl);
                    out.append("[Genesis 23 | KRV & ESV]").append(nl);
                    out.append("Lv1: Sarah’s Death — Burial — Cave of Machpelah — First Possession").append(nl).append(nl);
                }
                case Verses v -> VERSES.stream()
                                       .flatMap(Verse::lines)
                                       .forEach(line -> out.append(line).append(nl));
                case Summary sm -> {
                    out.append("[요약 / Summary]").append(nl);
                    out.append("KO: ").append(SUMMARY_KO).append(nl);
                    out.append("EN: ").append(SUMMARY_EN).append(nl).append(nl);
                }
                case Practice pc -> {
                    out.append("[적용 / Practice]").append(nl);
                    out.append("KO: ").append(PRACTICE_KO).append(nl);
                    out.append("EN: ").append(PRACTICE_EN);
                }
            }
        }

        System.out.print(out.toString());
    }
}

#### Genesis_23_Chapter_Lv1_V2.py
#### Variation: match-case dispatcher + highlight + generator composition

from dataclasses import dataclass
from typing import Iterable, List

def hi(s: str) -> str:
    return (s.replace("장사", "[장사]")
             .replace("bury", "[bury]")
             .replace("막벨라", "[막벨라]")
             .replace("Machpelah", "[Machpelah]")
             .replace("소유", "[소유]")
             .replace("possession", "[possession]"))

@dataclass(frozen=True)
class Verse:
    ref: str
    krv: str
    esv: str

VERSES: List[Verse] = [
    Verse("창세기 23:2 / Genesis 23:2",
          "사라가 죽으매… 아브라함이 울며 애통하더니",
          "Sarah died… and Abraham went in to weep and mourn for her."),
    Verse("창세기 23:4 / Genesis 23:4",
          "나는 나그네라… 나로 사라를 [장사]하게 하라",
          "I am a sojourner… give me property for a [burying] place."),
    Verse("창세기 23:9 / Genesis 23:9",
          "막벨라 굴을 값을 받고 내게 주라 — 사라를 [장사]하게 하리라",
          "Give me the cave of [Machpelah]… that I may [bury] my dead."),
    Verse("창세기 23:20 / Genesis 23:20",
          "그 밭과 굴이 아브라함의 [소유]로 확정되니",
          "The field and the cave were made sure as his [possession].")
]

SUMMARY_KO = (
    "아브라함은 사라를 애통해 장사하며(23:2,4), 막벨라 굴을 값주고 사서(23:9) 약속의 땅에서 첫 실제 [소유]를 얻는다(23:20)."
)
SUMMARY_EN = (
    "Abraham mourns Sarah (23:2), buys the cave of Machpelah (23:9), and gains his first actual [possession] in the promised land (23:20)."
)

PRACTICE_KO = "나그네 의식을 기억하되 약속을 붙드는 순종 1가지 선택하기."
PRACTICE_EN = "Remember the pilgrim identity; choose one obedience that clings to the promise."

def sec_title() -> Iterable[str]:
    yield "[창세기 23장 | KRV & ESV]"
    yield "[Genesis 23 | KRV & ESV]"
    yield "Lv1: Sarah’s Death — Burial — Machpelah — First Possession"
    yield ""

def sec_verses() -> Iterable[str]:
    for v in VERSES:
        yield v.ref
        yield "KRV: " + hi(v.krv)
        yield "ESV: " + hi(v.esv)
        yield ""

def sec_summary() -> Iterable[str]:
    yield "[요약 / Summary]"
    yield "KO: " + SUMMARY_KO
    yield "EN: " + SUMMARY_EN
    yield ""

def sec_practice() -> Iterable[str]:
    yield "[적용 / Practice]"
    yield "KO: " + PRACTICE_KO
    yield "EN: " + PRACTICE_EN

SECTIONS = [sec_title, sec_verses, sec_summary, sec_practice]

def main():
    for sec in SECTIONS:
        for line in sec():
            print(line)

if __name__ == "__main__":
    main()

Comments

아직 댓글이 없습니다!


Search

← 목록으로