Class: When::CalendarNote::JapaneseNote

Inherits:
When::CalendarNote show all
Defined in:
lib/when_exe/region/japanese_notes.rb

Overview

日本暦注

Defined Under Namespace

Classes: Cal4Note, Dates, LunarPhases, Note, SolarTerms

Constant Summary collapse

NoteObjects =

日本暦注の要素

[When::BasicTypes::M17n, [
  "namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
  "locale:[=ja:, en=en:]",
  "names:[日本暦注]",

  # 年の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[年]",
    [Note, 0xFFFF, "label:[干支]",       'position:共通'],                               #  0: 干支
  # [Note, 0xFFFF, "label:[干=ja:%%<十干>]",
  #                                   'position:共通'],                                  #     干
  # [Note, 0xFFFF, "label:[支=ja:%%<十二支>]",
  #                                   'position:共通'],                                  #     支
    [Note, 0x3800, "label:[廿八宿=ja:%%<二十八宿>]",
                                         'position:共通'],                               #  1: 廿八宿
    [Note, 0x3FFC, "label:[大歳壇=]",    'position:暦序'],                               #  2: 干支
    [Note, 0xC000, "label:[九星]",       'position:民間'],                               #  3: 九星
    [Note, 0xFFFC, "label:[納音]",       'position:暦序',   'suffix:是'],                #  4: 干支
    [Note, 0xFFFF, "label:[大歳=ja:%%<太歳神>]",
                                         'position:暦序',   'suffix:在'],                #  5: 干支
    [Note, 0xFFFF, "label:[大將軍=ja:%%<大将軍_(方位神)>]",
                                         'position:暦序',   'suffix:在'],                #  6: 支
    [Note, 0xFFFF, "label:[大陰=ja:%%<太陰神>]",
                                         'position:暦序',   'suffix:在'],                #  7: 支
    [Note, 0xFFFF, "label:[歳徳=ja:%%<歳徳神>]",
                                         'position:暦序',   'suffix:在'],                #  8: 干
    [Note, 0xFFFF, "label:[歳刑=ja:%%<歳刑神>]",
                                         'position:暦序',   'suffix:在'],                #  9: 支
    [Note, 0xFFFF, "label:[歳破=ja:%%<歳破神>]",
                                         'position:暦序',   'suffix:在'],                # 10: 支
    [Note, 0xFFFF, "label:[歳煞=ja:%%<歳煞神>]",
                                         'position:暦序',   'suffix:在'],                # 11: 支
    [Note, 0xFFFF, "label:[黄幡=ja:%%<黄幡神>]",
                                         'position:暦序',   'suffix:在'],                # 12: 支
    [Note, 0xFFFF, "label:[豹尾=ja:%%<豹尾神>]",
                                         'position:暦序',   'suffix:在'],                # 13: 支
    [Note, 0x0003, "label:[天道=]",      'position:暦序',   'suffix:-'],                 # 14: 支
    [Note, 0x0003, "label:[人道=]",      'position:暦序',   'suffix:-'],                 # 15: 支
    [Note, 0x3FFC, "label:[歳次=]",      'position:暦序',   'suffix:-'],                 # 16: 支
    [Note, 0xF800, "label:[金神]",       'position:仮名暦', 'suffix:在'],                # 17: 干
    [Note, 0xFFFF, "label:[大小]",       'position:暦序']                                # 18: 朔閏表
  ],

  # 月の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[月]",
    [Note, 0xFFFF, "label:[月名=ja:%%<月_(暦)>#%.<日本の和風月名>, Month]",
                                         'position:月建'],                               #  0: 月の和名
  # [Note, 0xFFFF, "label:[干支]",       'position:共通'],                               #     干支
  # [Note, 0xFFFF, "label:[干=ja:%%<十干>]",
  #                                           'position:共通'],                          #     干
  # [Note, 0xFFFF, "label:[支=ja:%%<十二支>]",
  #                                           'position:共通'],                          #     支
    [Note, 0xF800, "label:[廿八宿=ja:%%<二十八宿>]",
                                         'position:共通'],                               #  1: 廿八宿
    [Note, 0xFFFC, "label:[月建=]",      'position:月建',   'suffix:-' ],                #  2: 年の十干と暦月
    [Note, 0xC000, "label:[九星]",       'position:民間'],                               #  3: 九星
    [Note, 0x0003, "label:[天氣=]",      'position:月建',   'suffix:-' ],                #  4: 暦月
    [Note, 0x3FFF, "label:[天道=]",      'position:月建',   'suffix:-' ],                #  5: 暦月
    [Note, 0x0003, "label:[人道=]",      'position:月建',   'suffix:-' ],                #  6: 暦月
    [Note, 0x0003, "label:[月破=]",      'position:月建',   'suffix:在'],                #  7: 暦月
    [Note, 0x3FFC, "label:[天徳=]",      'position:月建',   'suffix:在'],                #  8: 暦月
    [Note, 0x3FFF, "label:[月煞=]",      'position:月建',   'suffix:在'],                #  9: 暦月
    [Note, 0x3FFF, "label:[用時=]",      'position:月建',   'suffix:-' ],                # 10: 暦月
    [Note, 0x3FFF, "label:[月徳=]",      'position:月建',   'suffix:在'],                # 11: 暦月
    [Note, 0x3FFC, "label:[月徳合=]",    'position:月建',   'suffix:在'],                # 12: 暦月
    [Note, 0x3FFC, "label:[月空=]",      'position:月建',   'suffix:在'],                # 13: 暦月
    [Note, 0x3FFF, "label:[三鏡=]",      'position:月建',   'suffix:-' ],                # 14: 暦月
    [Note, 0x3FFF, "label:[土府=]",      'position:月建',   'suffix:在'],                # 15: 暦月
    [Note, 0x3FFC, "label:[土公=ja:%%<土公神>]",
                                         'position:月建',   'suffix:在'],                # 16: 暦月
    [Note, 0xFFFF, "label:[大小]",       'position:月建']                                # 17: 朔閏表
  ],

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[日]",
    [Note, 0xFFFF, "label:[干支]",       'position:共通'],                               #  0: 干支
  # [Note, 0x, "label:[干=ja:%%<十干>]",
  #                                           'position:共通'],                          #     干
  # [Note, 0x, "label:[支=ja:%%<十二支>]",
  #                                           'position:共通'],                          #     支
    [Note, 0x3FFF, "label:[納音]",       'position:共通',   'suffix:是'],                #  1: 干支
    [Note, 0xFFFF, "label:[十二直]",     'position:共通'],                               #  2: 支 節月
    [Note, 0xFFFF, "label:[七曜]",       'position:共通'],                               #  3: 七曜
    [Note, 0xF800, "label:[廿八宿=ja:%%<二十八宿>]",
                                         'position:共通'],                               #  4: 廿八宿
    [Note, 0x07F8, "label:[廿七宿=ja:%%<二十八宿>]",
                                         'position:共通'],                               #  5: 暦月 暦日
    [Note, 0xC000, "label:[九星]",       'position:民間'],                               #  6: 九星
    [Note, 0x8000, "label:[六曜]",       'position:民間'],                               #  7: 暦月 暦日
    [Note, 0xE000, "label:[祝祭日]",     'position:祝祭日'],                             #  8: 暦月 暦日 (七曜)
    [Note, 0xFFFF, "label:[廿四節気=ja:%%<二十四節気>]",
                                         'position:時候'],                               #  9: 太陽黄経
    [Note, 0xFFFF, "label:[節中=]",      'position:時候'],                               # 10: 太陽黄経
    [Note, 0xFFFC, "label:[七十二候]",   'position:時候'],                               # 11: 太陽黄経
    [Note, 0x3FFC, "label:[六十卦=]",    'position:時候'],                               # 12: 太陽黄経
    [Note, 0xF800, "label:[節分]",       'position:雑節'],                               # 13: 立春からの日数
    [Note, 0xF800, "label:[初午]",       'position:雑節'],                               # 14: 支 節月 or 暦月
    [Note, 0xF800, "label:[八十八夜]",   'position:雑節'],                               # 15: 立春からの日数
    [Note, 0xF800, "label:[入梅]",       'position:雑節'],                               # 16: 干 太陽黄経
    [Note, 0xF800, "label:[二百十日]",   'position:雑節'],                               # 17: 立春からの日数
    [Note, 0xF800, "label:[二百廿日]",   'position:雑節'],                               # 18: 立春からの日数

    [Note, 0x3FFC, "label:[大禍=ja:%%<暦注下段>#%.<大禍日>]",
                                         'position:上段 上段 欄外 欄外', 'suffix:日'],   # 19: 支 節月
    [Note, 0x3FFC, "label:[滅門=ja:%%<暦注下段>#%.<滅門日>]",
                                         'position:上段 上段 欄外 欄外', 'suffix:日'],   # 20: 支 節月
    [Note, 0x3FFC, "label:[狼藉=ja:%%<暦注下段>#%.<狼藉日>]",
                                         'position:上段 上段 欄外 欄外', 'suffix:日'],   # 21: 支 節月

    [Note, 0x07F8, "label:[甘露=]",      'position:上段 上段 上段 上段', 'suffix:日'],   # 22: 七曜 廿七宿
    [Note, 0x07F8, "label:[金剛峯=]",    'position:上段 上段 上段 上段'],                # 23: 七曜 廿七宿
    [Note, 0x07F8, "label:[羅刹=]",      'position:上段 上段 上段 上段'],                # 24: 七曜 廿七宿

    [Note, 0x3FFC, "label:[大將軍=ja:%%<大将軍_(方位神)>]",
                                         'position:上段 上段 上段 上段',   'suffix:-'],  # 25: 干支 節年
    [Note, 0xFFFC, "label:[天一=ja:%%<天一神>]",
                                         'position:上段 上段 上段 上段',   'suffix:-'],  # 26: 干支
    [Note, 0x3FFC, "label:[土公=ja:%%<土公神>]",
                                         'position:上段 上段 上段 上段',   'suffix:-'],  # 27: 干支
    [Note, 0x3FFC, "label:[歳下食=ja:%%<暦注下段>#%.<歳下食>]",
                                         'position:上段 上段 上段 上段'],                # 28: 干支 節年
    [Note, 0x3FFC, "label:[忌遠行=]",    'position:上段 上段 上段 上段'],                # 29: 支 節月
    [Note, 0x3FFC, "label:[忌夜行=]",    'position:上段 上段 上段 上段'],                # 30: 支 節月
    [Note, 0x3FFC, "label:[下食時=ja:%%<暦注下段>#%.<時下食>]",
                                         'position:上段 上段 上段 上段',   'suffix:-'],  # 31: 支 節月 貞享暦で一部廃止
    [Note, 0x3FFC, "label:[天間=]",      'position:上段 上段 上段 中段上'],              # 32: 干支 節月
    [Note, 0x3FFC, "label:[不視病=]",    'position:上段 上段 上段 上段'],                # 33: 干
    [Note, 0x3FFC, "label:[不問疾=]",    'position:上段 上段 上段 上段'],                # 34: 干
    [Note, 0x3FFC, "label:[不弔人=]",    'position:上段 上段 上段 上段'],                # 35: 支
    [Note, 0xFFFC, "label:[彼岸]",       'position:仮名暦'],                             # 36: 太陽黄経
    [Note, 0xFFFF, "label:[社=ja:%%<社日>]",
                                         'position:中段 中段 中段 中段', 'suffix:日'],   # 37: 干 太陽黄経
    [Note, 0xFFFF, "label:[三伏]",       'position:中段 中段 中段 中段'],                # 38: 干 太陽黄経
    [Note, 0x3FFC, "label:[除手足甲=]",  'position:中段 中段 中段 中段'],                # 39: 晦(除手足甲)、支(片方のみ), 没滅凶会日×
    [Note, 0x3FFC, "label:[沐浴=]",      'position:中段 中段 中段 中段'],                # 40: 支 没滅凶会日×
    [Note, 0x3FFD, "label:[臘=ja:%%<臘日>]",
                                         'position:中段 中段 中段 中段', 'suffix:日'],   # 41: 支 太陽黄経
    [Note, 0x3FFC, "label:[伐=]",        'position:中段 中段 中段 中段上', 'suffix:日'], # 42: 干支
    [Note, 0x3FFC, "label:[五墓=ja:%%<暦注下段>#%.<五墓日>]",
                                         'position:中段 中段 中段 中段下', 'suffix:日'], # 43: 干支
    [Note, 0x3FFC, "label:[六蛇=]",      'position:中段 中段 中段 中段上'],              # 44: 干支 節月
    [Note, 0x3FFC, "label:[七鳥=]",      'position:中段 中段 中段 中段上'],              # 45: 干支 節月
    [Note, 0x3FFC, "label:[八龍=]",      'position:中段 中段 中段 中段上'],              # 46: 干支 節月
    [Note, 0x3FFC, "label:[九虎=]",      'position:中段 中段 中段 中段上'],              # 47: 干支 節月
    [Note, 0x07FF, "label:[没=ja:%%<没日>]",
                                         'position:中段 中段 中段 中段', 'suffix:日'],   # 48: 太陽黄経
    [Note, 0xFFF8, "label:[日食]",       'position:中段 中段 中段 中段'],                # 49: 日食表
    [Note, 0x07FC, "label:[滅=ja:%%<滅日]",
                                         'position:中段 中段 中段 中段', 'suffix:日'],   # 50: 月の位相
    [Note, 0xFFF8, "label:[月食]",       'position:中段 中段 中段 中段'],                # 51: 月食表
    [Note, 0xC7FD, "label:[月相]",       'position:中段 中段 中段 中段'],                # 52: 月の位相
    [Note, 0xFFFF, "label:[土用事=ja:%%<土用>]",
                                         'position:中段 中段 中段 中段'],                # 53: 太陽黄経
    [Note, 0x3FF0, "label:[伏龍=]",      'position:上段 上段 下段 下段', 'suffix:在'],   # 54: 太陽黄経

    [Note, 0x3FFF, "label:[凶会=ja:%%<暦注下段>#%.<凶会日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 55: 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Note, 0x3FFF, "label:[大小歳=]",    'position:下段 下段 下段 下段'],                # 56: 干支 節月
    [Note, 0x3FFC, "label:[歳徳=ja:%%<歳徳神>]",
                                         'position:下段 下段 下段 下段'],                # 57: 干 節年 凶会日× ~合も
    [Note, 0x0003, "label:[天倉=]",      'position:古注'],                               # 58: 干支 節月
  # [Note, 0x0003, "label:[天李=]",      'position:古注'],                               #     干支 節月?
    [Note, 0x37FF, "label:[天恩=ja:%%<暦注下段>#%.<天恩日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 59: 干支 節月 凶会日×
    [Note, 0xFFFF, "label:[天赦=ja:%%<暦注下段>#%.<天赦日>]",
                                         'position:下段 下段 下段 下段'],                # 60: 干支 節月
    [Note, 0x37FF, "label:[母倉=ja:%%<暦注下段>#%.<母倉日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 61: 支 節月 凶会日×
    [Note, 0x37FC, "label:[月徳=]",      'position:下段 下段 下段 下段'],                # 62: 干 節月 凶会日× ~合も
    [Note, 0x3FFF, "label:[九坎=]",      'position:下段 下段 下段 下段'],                # 63: 支 節月
    [Note, 0x3FFF, "label:[歸忌=ja:%%<暦注下段>#%.<帰忌日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 64: 支 節月
    [Note, 0x3FFF, "label:[血忌=ja:%%<暦注下段>#%.<血忌日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 65: 支 節月
    [Note, 0x3FFC, "label:[無翹=]",      'position:下段 下段 下段 下段'],                # 66: 支 節月
    [Note, 0x3FFF, "label:[厭=]",        'position:下段 下段 下段 下段'],                # 67: 支 節月
    [Note, 0x3FFC, "label:[重=ja:%%<暦注下段>#%.<重日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 68: 支
    [Note, 0x3FFD, "label:[復=ja:%%<暦注下段>#%.<復日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 69: 干 節月
    [Note, 0x3FFC, "label:[月煞=]",      'position:下段 下段 下段 下段'],                # 70: 支 節月
    [Note, 0x3FFF, "label:[往亡=ja:%%<暦注下段>#%.<往亡日>]",
                                         'position:下段 下段 下段 下段', 'suffix:日'],   # 71: 太陽黄経
    [Note, 0x3FFF, "label:[日遊=ja:%%<日遊神>]",
                                         'position:最下段', 'suffix:在'],                # 72: 干支
    [Note, 0x07FF, "label:[人神配当=]",  'position:最下段孟月', 'suffix:-'],             # 73: 暦日

    [Note, 0x3E00, "label:[受死=ja:%%<暦注下段>#%.<受死日>]",
                                         'position:仮名暦', 'suffix:日'],                # 74: 支 節月
    [Note, 0xFFF0, "label:[八專]",       'position:仮名暦'],                             # 75: 干支
    [Note, 0x3E00, "label:[八專間日=ja:%%<八専>]",
                                         'position:仮名暦'],                             # 76: 干支
    [Note, 0xC000, "label:[金神間日=ja:%%<金神>#%.<金神の遊行・間日>]",
                                         'position:仮名暦'],                             # 77: 支 節月
    [Note, 0xC000, "label:[金神遊行=ja:%%<金神>#%.<金神の遊行・間日>]",
                                         'position:仮名暦'],                             # 78: 支 節月
    [Note, 0x3FF0, "label:[天火=ja:%%<暦注下段>#%.<天火日>]",
                                         'position:仮名暦', 'suffix:日'],                # 79: 支 節月
    [Note, 0x3FF0, "label:[地火=ja:%%<暦注下段>#%.<地火日>]",
                                         'position:仮名暦', 'suffix:日'],                # 80: 支 節月
    [Note, 0x3800, "label:[人火=]",      'position:仮名暦'],                             # 81: 支 節月
    [Note, 0x3800, "label:[雷火=]",      'position:仮名暦'],                             # 82: 支 節月
    [Note, 0x3FF0, "label:[赤舌=ja:%%<赤舌日>]",
                                         'position:仮名暦', 'suffix:日'],                # 83: 暦月 暦日
    [Note, 0x3E00, "label:[十死=ja:%%<暦注下段>#%.<十死日>]",
                                         'position:仮名暦', 'suffix:日'],                # 84: 支 節月
    [Note, 0x3E00, "label:[道虚=]",      'position:仮名暦', 'suffix:日'],                # 85: 暦日
    [Note, 0x3E00, "label:[大明=ja:%%<暦注下段>#%.<大明日>]",
                                         'position:仮名暦', 'suffix:日'],                # 86: 干支
    [Note, 0x0600, "label:[大赤=ja:%%<赤口日>]",
                                         'position:仮名暦', 'suffix:日'],                # 87: 暦月 暦日
    [Note, 0xF800, "label:[甲子待=ja:%%<甲子>]",
                                         'position:仮名暦'],                             # 88: 干支
    [Note, 0xC000, "label:[己巳]",       'position:仮名暦'],                             # 89: 干支
    [Note, 0xF800, "label:[庚申待]",     'position:仮名暦'],                             # 90: 干支
    [Note, 0x3800, "label:[犯土]",       'position:仮名暦'],                             # 91: 干支
    [Note, 0xF800, "label:[十方暮]",     'position:仮名暦'],                             # 92: 干支
    [Note, 0xF800, "label:[一粒万倍=ja:%%<一粒万倍日>]",
                                         'position:仮名暦', 'suffix:日'],                # 93: 支 節月
    [Note, 0x3800, "label:[天福=]",      'position:仮名暦'],                             # 94: 支 節月
    [Note, 0x3800, "label:[地福=]",      'position:仮名暦'],                             # 95: 支 節月
    [Note, 0x3800, "label:[地五福=]",    'position:仮名暦'],                             # 96: 支 節月
    [Note, 0xB800, "label:[三隣亡]",     'position:仮名暦'],                             # 97: 支 節月
    [Note, 0xF800, "label:[不成就=ja:%%<不成就日>]",
                                         'position:仮名暦', 'suffix:日'],                # 98: 暦月 暦日/晦日
    [Note, 0x3FFF, "label:[三寶吉=ja:%%<三宝吉>]",
                                         'position:上段 上段 上段 上段'],                # 99: 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Note, 0x3FFF, "label:[神吉=ja:%%<暦注下段>#%.<神日>]",
                                         'position:上段 上段 中段 中段上', 'suffix:日'], #100: 干支 節月
    [Note, 0x3FFF, "label:[雑事吉=]",    'position:雑事吉'],                             #101: 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Note, 0x07FF, "label:[小字注=]",    'position:下段小字 下段小字 下段小字 下段小字'],#102: 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Note, 0x3800, "label:[鬼宿]",       'position:仮名暦'],                             #103: 廿八宿
  ]
]]
NoteTypes =

日本暦注の時代変遷

(3...When::TM::CalendarEra::JapaneseSolarSeries[1].size).to_a.map {|i|
  calendars =
    [When::TM::CalendarEra::JapaneseLuniSolarSeries[1][i][2],
     When::TM::CalendarEra::JapaneseSolarSeries[1][i][2]].map {|epoch|
      epoch =~ /^(-?\d+)-(\d+)-(\d+)\^(.+)$/
      $4
    }
  [$2 == '01' ? $1.to_i : $1.to_i+1, Cal4Note.new(*calendars)]
}.reverse
NoteRange =
[
  # 開始 具注暦 七十二候        index mask
  [-660,    0,      0], # ~ 696  0 : 0001
  [ 697,    0,      0], # ~ 763  1 : 0002
  [ 764,    0,      2], # ~ 800  2 : 0004
  [ 801,    0,      2], # ~ 900  3 : 0008
  [ 901,    0,      2], # ~1003  4 : 0010
  [1004,    1,      2], # ~1047  5 : 0020
  [1048,    1,      2], # ~1100  6 : 0040
  [1101,    1,      2], # ~1184  7 : 0080
  [1185,    2,      2], # ~1300  8 : 0100
  [1301,    2,      2], # ~1337  9 : 0200
  [1338,    3,      2], # ~1684 10 : 0400
  [1685,    3,      3], # ~1754 11 : 0800
  [1755,    3,      4], # ~1867 12 : 1000
  [1868,    3,      4], # ~1872 13 : 2000
  [1873,    3,      4], # ~1873 14 : 4000
  [1874,    3,      5]  # ~     15 : 8000
]
NoteFocused =
(0...NoteRange.size).to_a.map {|range|
  (3..5).to_a.map {|cord|
    notes = NoteObjects[1][cord]
    (2...notes.size).to_a.inject([]) {|focused,note|
      focused << notes[note][2][/\[.+?[=\]]/][1..-2] if notes[note][1][range] == 1
      focused
    }
  }
}
MonthPattern =

月の大小

{
   29 => '',
   30 => '',
  -28 => '',
  -29 => '',
  -30 => '',
  -31 => ''
}
NoteMethods =
[:year_notes, :month_notes, :day_notes]

Constants inherited from When::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from When::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from When::CalendarNote

#copy, #day, #duration, #enum_for, #include?, #month, #note?, #year

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#notes(date, options = {}) ⇒ Hash, ...

Note:

return 値の [Hash] の要素は下記の通り :note => 暦注要素 (When::CalendarTypes::JapaneseNote::Note) :value => 暦注の値 (String or When::BasicTypes::M17n または、その Array) :position => 具注暦でのその暦注の配置場所(String)

暦注の計算

Parameters:

  • date (When::TM::TemporalPosition)

    暦注を計算する日時 (date が When::TM::TemporalPosition でない場合、When::TM::TemporalPosition に変換して使用する)

  • options (Hash) (defaults to: {})

    :indices, :notes およびその他のキー => When::CalendarNote#notes を参照

Returns:

  • (Hash)

    :notes が String の場合

  • (Array<Hash>)

    上記に該当せず、:indices が Integer の場合

  • (Array<Array<Hash>>)

    上記のいずれにも該当しない場合



460
461
462
463
464
465
466
# File 'lib/when_exe/region/japanese_notes.rb', line 460

def notes(date, options={})
  dates, indices, notes, persistence, conditions, options = _parse_note(date, options)
  Notes.register(indices.map {|i|
    next [] unless i <= dates.precision
    send(NoteMethods[i-1], dates, notes[i-1], conditions)
  }, persistence, date.to_i)
end

#phase(date, parameter = nil, precision = date.precision, frame = nil) ⇒ When::TM::CalDate

月の位相 => 日時

Parameters:

  • date (When::TM::TemporalPosition)

    探す基準とする日時

  • parameter (Array<Numeric>) (defaults to: nil)

    月の位相の分子と分母( num, den)

    num 分子 (デフォルト 0 : 基準日時直後の朔)

    den 分母 (デフォルト 30 : 検索範囲の長さ)

  • parameter (String) (defaults to: nil)

    月の位相の分子と分母(“#{ num }/#{ den }” の形式)

  • precision (Integer) (defaults to: date.precision)

    取得したい時間位置の分解能(デフォルト date の分解能)

  • frame (When::TM::Calendar) (defaults to: nil)

    暦法(ダミー)

Returns:

  • (When::TM::CalDate)

    date またはその直後に月の位相が指定の値になる日時



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/when_exe/region/japanese_notes.rb', line 514

def phase(date, parameter=nil, precision=date.precision, frame=nil)
  dates  = _to_date_for_note(date)
  note   = dates.cal4note.l_phases
  result = note.phase(date, parameter)
  return result if dates.o_date.frame.kind_of?(When::CalendarTypes::Christian)
  num, den  = parameter.kind_of?(String) ? parameter.split(/\//, 2) : parameter
  num  = (num ||  0).to_f
  den  = (den || 30).to_f
  return result unless den == 30
  case num % 30
  when 0     # 朔
    return result if result.cal_date[-1] == 1
    diff = result.cal_date[-1] < 15 ? -1 : +1
  when 5..25 # 弦、望
    return result unless note.formula.kind_of?(When::Ephemeris::ChineseTrueLunation)
    time = result.kind_of?(When::TM::DateAndTime) ? result : note.phase(date, [num,den], When::SYSTEM)
    return result if time.clk_time.universal_time >= When::TM::Duration::DAY/4 # 午前6時以降
    diff = -1
  else       # その他
    return result
  end
  patched = result + When::DurationP1D * diff
  result.cal_date[0..-2] = patched.cal_date[0..-2]
  result.cal_date[-1]    = When::Coordinates::Pair.new(patched.cal_date[-1], -diff)
  result
end

#term(date, parameter = nil, precision = date.precision, frame = nil) ⇒ When::TM::CalDate

太陽の位置 => 日時

Parameters:

  • date (When::TM::TemporalPosition)

    探す基準とする日時

  • parameter (Array<Numeric>) (defaults to: nil)

    太陽の位置の分子と分母( num, den)

    num 分子 (デフォルト 0 : 基準日時直後の春分)

    den 分母 (デフォルト 360 : 検索範囲の長さ)

  • parameter (String) (defaults to: nil)

    太陽の位置の分子と分母(“#{ num }/#{ den }” の形式)

  • precision (Integer) (defaults to: date.precision)

    取得したい時間位置の分解能(デフォルト date の分解能)

  • frame (When::TM::Calendar) (defaults to: nil)

    暦法(ダミー)

Returns:

  • (When::TM::CalDate)

    date またはその直後に太陽の位置が指定の値になる日時



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/when_exe/region/japanese_notes.rb', line 483

def term(date, parameter=nil, precision=date.precision, frame=nil)
  dates  = _to_date_for_note(date)
  result = dates.cal4note.s_terms.term(date, parameter)
  patch  = SolarTerms::Patch[result.to_i]
  return result unless patch
  num, den  = parameter.kind_of?(String) ? parameter.split(/\//, 2) : parameter
  num  = (num ||   0).to_f
  den  = (den || 360).to_f
  diff = (num - patch[0] + 1) % den - 1
  return result if diff == 0
  patched = result + When::DurationP1D * diff
  result.cal_date[0..-2] = patched.cal_date[0..-2]
  result.cal_date[-1]    = When::Coordinates::Pair.new(patched.cal_date[-1], -diff)
  result
end