Class: When::CalendarNote::HinduNote

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

Overview

ヒンドゥー系の暦注

Direct Known Subclasses

HinduNoteDetailed

Defined Under Namespace

Classes: Dates

Constant Summary collapse

Notes =
[When::BasicTypes::M17n, [
  "locale:[=en:, ja=ja:, hi=hi:, alias]",
  "names:[Hindu]",

  # 年の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[note for year=, 年の暦注=, *alias:year]",
    [When::BasicTypes::M17n,
      "names:[samvatsara, 木星年=]",
      "[Prabhava=,      プラバヴァ=,           _IAST_=]", #  1
      "[Vibhava=,       ヴィバヴァ=,           _IAST_=]", #  2
      "[Sukha=,         スカ=,                 _IAST_=]", #  3
      "[Pramoda=,       プラモーダ=,           _IAST_=]", #  4
      "[Prajāpati=,     プラジャーパティ=,     _IAST_=]", #  5
      "[Aṅgiras=,       アンギラス=,           _IAST_=]", #  6
      "[Śrīmukha=,      シュリームカ=,         _IAST_=]", #  7
      "[Bhāva=,         バーヴァ=,             _IAST_=]", #  8
      "[Yuvan=,         ユヴァン=,             _IAST_=]", #  9
      "[Dhātṛ=,         ダートリ=,             _IAST_=]", # 10
      "[Īśvara=,        イーシュヴァラ=,       _IAST_=]", # 11
      "[Bahudhānya=,    バフダーニャ=,         _IAST_=]", # 12
      "[Pramāthin=,     プラマーティン=,       _IAST_=]", # 13
      "[Vikrama=,       ヴィクラマ=,           _IAST_=]", # 14
      "[Vṛṣa=,          ヴリシャ=,             _IAST_=]", # 15
      "[Chitrabhānu=,   チトラバーヌ=,         _IAST_=]", # 16
      "[Subhānu=,       スバーヌ=,             _IAST_=]", # 17
      "[Tāraṇa=,        ターラナ=,             _IAST_=]", # 18
      "[Pārthiva=,      パールティヴァ=,       _IAST_=]", # 19
      "[Vyaya=,         ヴヤヤ=,               _IAST_=]", # 20
      "[Sarvajit=,      サルヴァジト=,         _IAST_=]", # 21
      "[Sarvadhārin=,   サルヴァダーリン=,     _IAST_=]", # 22
      "[Virodhin=,      ヴィローディン=,       _IAST_=]", # 23
      "[Vikṛta=,        ヴィクリタ=,           _IAST_=]", # 24
      "[Khara=,         カラ=,                 _IAST_=]", # 25
      "[Nandana=,       ナンダナ=,             _IAST_=]", # 26
      "[Vijaya=,        ヴィジャヤ=,           _IAST_=]", # 27
      "[Jaya=,          ジャヤ=,               _IAST_=]", # 28
      "[Manmatha=,      マンマタ=,             _IAST_=]", # 29
      "[Durmukha=,      ドゥルムカ=,           _IAST_=]", # 30
      "[Hemalamba=,     ヘマラムバ=,           _IAST_=]", # 31
      "[Vilambin=,      ヴィラムビン=,         _IAST_=]", # 32
      "[Vikārin=,       ヴィカーリン=,         _IAST_=]", # 33
      "[Śārvarin=,      シャールヴァリン=,     _IAST_=]", # 34
      "[Plava=,         プラヴァ=,             _IAST_=]", # 35
      "[Śubhakṛt=,      シュバクリト=,         _IAST_=]", # 36
      "[Śobhana=,       ショバナ=,             _IAST_=]", # 37
      "[Krodhin=,       クロディン=,           _IAST_=]", # 38
      "[Viśvāvasu=,     ヴィシュヴァーヴァス=, _IAST_=]", # 39
      "[Parābhava=,     パラーバヴァ=,         _IAST_=]", # 40
      "[Plavaṅga=,      プラヴァンガ=,         _IAST_=]", # 41
      "[Kīlaka=,        キーラカ=,             _IAST_=]", # 42
      "[Saumya=,        サウムヤ=,             _IAST_=]", # 43
      "[Sādhāraṇa=,     サーダーラナ=,         _IAST_=]", # 44
      "[Virodhakṛt=,    ヴィローダクリト=,     _IAST_=]", # 45
      "[Paridhāvin=,    パリダーヴィン=,       _IAST_=]", # 46
      "[Pramādin=,      プラマーディン=,       _IAST_=]", # 47
      "[Ānanda=,        アーナンダ=,           _IAST_=]", # 48
      "[Rākṣasa=,       ラークシャサ=,         _IAST_=]", # 49
      "[Anala=,         アナラ=,               _IAST_=]", # 50
      "[Piṅgala=,       ピンガラ=,             _IAST_=]", # 51
      "[Kālayukta=,     カーラユクタ=,         _IAST_=]", # 52
      "[Siddhārthin=,   シッダールティン=,     _IAST_=]", # 53
      "[Raudra=,        ラウドラ=,             _IAST_=]", # 54
      "[Durmati=,       ドゥルマティ=,         _IAST_=]", # 55
      "[Dundubhi=,      ドゥンドゥビ=,         _IAST_=]", # 56
      "[Rudhirodgārin=, ルディロードガーリン=, _IAST_=]", # 57
      "[Raktākṣin=,     ラクタークシン=,       _IAST_=]", # 58
      "[Krodhana=,      クローダナ=,           _IAST_=]", # 59
      "[Kṣaya=,         クシャヤ=,             _IAST_=]"  # 60
    ]
  ],

  # 月の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[note for month=, 月の暦注=, *alias:month]",
    [When::BasicTypes::M17n,
      "names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, zh:該月的名稱=, *alias:Month=]"
    ]
  ],

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[note for day=, 日の暦注=, *alias:day]",

    [When::BasicTypes::M17n,
      "names:[tithi=, ティティ=ja:%%<ティティ>, तिथियाँ]",
      "[Amavasya,                   新月,  _IAST_=]", # 新月
      "[Pratipad=en:Prathama_(day), 1日=, _IAST_=]", #  1
      "[Dwitiya,                    2日=, _IAST_=]", #  2
      "[Tritiya,                    3日=, _IAST_=]", #  3
      "[Chaturthi,                  4日=, _IAST_=]", #  4
      "[Panchami,                   5日=, _IAST_=]", #  5
      "[Ṣaṣṭhī=en:Shashti,          6日=, _IAST_=]", #  6
      "[Saptami,                    7日=, _IAST_=]", #  7
      "[Ashtami,                    8日=, _IAST_=]", #  8
      "[Navami,                     9日=, _IAST_=]", #  9
      "[Dashami,                    10日=, _IAST_=]", # 10
      "[Ekadashi,                   11日=, _IAST_=]", # 11
      "[Dwadashi,                   12日=, _IAST_=]", # 12
      "[Thrayodashi,                13日=, _IAST_=]", # 13
      "[Chaturdashi,                14日=, _IAST_=]", # 14
      "[Purnima,                    満月,  _IAST_=]"  # 満月
    ],

    [When::BasicTypes::M17n,
      "names:[vāra=, ヴァーラ=, _IAST_=, *vara=]",
      "[Ravi=en:S%C5%ABrya, 日曜日, _IAST_=]",
      "[Soma,               月曜日, _IAST_=]",
      "[Maṅgala=en:Mangala, 火曜日, _IAST_=]",
      "[Budha,              水曜日, _IAST_=]",
      "[Guru,               木曜日, _IAST_=]",
      "[Śukra=en:Shukra,    金曜日, _IAST_=]",
      "[Śani=en:Shani,      土曜日, _IAST_=]" 
    ],

    [When::BasicTypes::M17n,
      "names:[nakṣatra=, ナクシャトラ=, _IAST_=, *naksatra=]",
      "[Aśvinī=en:Ashvin%C4%AB,                           アシュヴィニー=,     _IAST_=, 婁宿]", #  1
      "[Bharaṇī=en:Bharan%C4%AB,                          バラニー=,           _IAST_=, 胃宿]", #  2
      "[Kṛttikā=en:Krittik%C4%81,                         クリッティカー=,     _IAST_=, 昴宿]", #  3
      "[Rohiṇī=en:Rohini_(nakshatra),                     ローヒニ―=,         _IAST_=, 畢宿]", #  4
      "[Mṛgaśiras=en:Mrigash%C4%ABrsha,                   ムリガシラス=,       _IAST_=, 觜宿]", #  5
      "[Ārdrā=en:Ardra_(nakshatra),                       アールドラー=,       _IAST_=, 參宿]", #  6
      "[Punarvasu=en:Punarvasu,                           プナルヴァス=,       _IAST_=, 井宿]", #  7
      "[Puṣya=en:Pushya,                                  プシュヤ=,           _IAST_=, 鬼宿]", #  8
      "[Aśleṣā=en:%C4%80shlesh%C4%81,                     アーシュレーシャー=, _IAST_=, 柳宿]", #  9
      "[Maghā=en:Magh%C4%81,                              マガー=,             _IAST_=, 星宿]", # 10
      "[Pū. Phalguṇī=en:P%C5%ABrva_Phalgun%C4%AB,         P. パールグニー=,    _IAST_=, 張宿]", # 11
      "[U. Phalguṇī=en:Uttara_Phalgun%C4%AB,              U. パールグニー=,    _IAST_=, 翼宿]", # 12
      "[Hasta=en:Nakshatra#Divisions,                     ハスタ=,             _IAST_=, 軫宿]", # 13
      "[Citrā=en:Nakshatra#Divisions,                     チトラー=,           _IAST_=, 角宿]", # 14
      "[Svāti=en:Sv%C4%81t%C4%AB,                         スヴァーティー=,     _IAST_=, 亢宿]", # 15
      "[Viśākha=en:Vish%C4%81kh%C4%81,                    ヴィシャーカー=,     _IAST_=, 氐宿]", # 16
      "[Anurādhā=en:Anur%C4%81dh%C4%81,                   アヌラーダー=,       _IAST_=, 房宿]", # 17
      "[Jyeṣṭha=en:Jyeshtha,                              ジェーシュター=,     _IAST_=, 心宿]", # 18
      "[Mūla=en:Mula_(astrology),                         ムーラ=,             _IAST_=, 尾宿]", # 19
      "[Pū. āṣāḍha=en:P%C5%ABrva_Ash%C4%81dh%C4%81,       P. アーシャーダー=,  _IAST_=, 箕宿]", # 20
      "[U. āṣāḍha=en:Uttara_Ash%C4%81dh%C4%81,            U. アーシャーダー=,  _IAST_=, 斗宿]", # 21
      "[Śravaṇa=en:Shravana,                              シュラヴァナ=,       _IAST_=, 女宿]", # 22
      "[Śraviṣṭhā=en:Dhanishta,                           ダニシュター=,       _IAST_=, 虛宿]", # 23
      "[Śatabhiṣak=en:Shatabhish%C4%81,                   シャタビシャジュ=,   _IAST_=, 危宿]", # 24
      "[Pū. Bhādrapadā=en:P%C5%ABrva_Bh%C4%81drapad%C4%81,P. バードラパダー=,  _IAST_=, 室宿]", # 25
      "[U. Bhādrapadā=en:Uttara_Bh%C4%81drapad%C4%81,     U. バードラパダー=,  _IAST_=, 壁宿]", # 26
      "[Revatī=en:Revati_(nakshatra),                     レーヴァティー=,     _IAST_=, 奎宿]"  # 27
    ],

    [When::BasicTypes::M17n,
      "names:[yoga=, ヨーガ=, _IAST_=]",
      "[Viṣkambha=, ヴィシュカムバ=,   _IAST_=]", #  1
      "[Prīti=,     プリーティ=,       _IAST_=]", #  2
      "[Āyuśmān=,   アーユシュマー=,   _IAST_=]", #  3
      "[Saubhāgya=, サウバーギャ=,     _IAST_=]", #  4
      "[Śobhana=,   ショーバナ=,       _IAST_=]", #  5
      "[Atigaṇḍa=,  アティガンダ=,     _IAST_=]", #  6
      "[Sukarma=,   スカルマ=,         _IAST_=]", #  7
      "[Dhṛti=,     ドゥリティ=,       _IAST_=]", #  8
      "[Śūla=,      シューラ=,         _IAST_=]", #  9
      "[Gaṇḍa=,     ガンダ=,           _IAST_=]", # 10
      "[Vṛddhi=,    ヴリッディ=,       _IAST_=]", # 11
      "[Dhruva=,    ドルヴァ=,         _IAST_=]", # 12
      "[Vyāghāta=,  ヴヤーガータ=,     _IAST_=]", # 13
      "[Harṣaṇa=,   ハルシャナ=,       _IAST_=]", # 14
      "[Vajra=,     ヴァジュラ=,       _IAST_=]", # 15
      "[Siddhi=,    シッディ=,         _IAST_=]", # 16
      "[Vyatīpāta=, ヴヤティーパータ=, _IAST_=]", # 17
      "[Varīyas=,   ヴァリーヤス=,     _IAST_=]", # 18
      "[Parigha=,   パリガ=,           _IAST_=]", # 19
      "[Śiva=,      シヴァ=,           _IAST_=]", # 20
      "[Siddha=,    シッダ=,           _IAST_=]", # 21
      "[Sādhya=,    サーディヤ=,       _IAST_=]", # 22
      "[Śubha=,     シュバ=,           _IAST_=]", # 23
      "[Śukla=,     シュクラ=,         _IAST_=]", # 24
      "[Brahman=,   ブラフマン=,       _IAST_=]", # 25
      "[Māhendra=,  マーヘンドラ=,     _IAST_=]", # 26
      "[Vaidhṛti=,  ヴァイドリティ=,   _IAST_=]"  # 27
    ],

    [When::BasicTypes::M17n,
      "names:[Karaṇa=, カラナ=, _IAST_=, *karana]",
      "[Bava=,      バヴァ=,           _IAST_=]", # 1
      "[Bālava=,    バーラヴァ=,       _IAST_=]", # 2
      "[Kaulava=,   カウラヴァ=,       _IAST_=]", # 3
      "[Taitila=,   タイティラ=,       _IAST_=]", # 4
      "[Gara=,      ガラ=,             _IAST_=]", # 5
      "[Vaṇija=,    ヴァニジュ=,       _IAST_=]", # 6
      "[Viṣṭi=,     ヴィシュティ=,     _IAST_=]", # 7
      "[Kiṃtughna=, キンストゥグナ=,   _IAST_=]", # A
      "[Śakuni=,    シャクニ=,         _IAST_=]", # B
      "[Catuṣpāda=, チャトシュパダ=,   _IAST_=]", # C
      "[Nāga=,      ナーガ=,           _IAST_=]"  # D
    ]
  ]
]]
NoteConsts =
{
  'tithi' => {
    :formula => 15,
    :range   => (-1..2),
    :index   => [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
                 15,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
  },
  'naksatra' => {
    :formula => '27M',
    :range   => (-1..2),
    :index   => (0...27).to_a
  },
  'yoga' => {
    :formula => '27M+27S',
    :range   => (-1..2),
    :index   => (0...27).to_a
  },
  'karana' => {
    :formula => 30,
    :range   => (-2..3),
    :index   => [7] + (0...7).to_a * 8 + [8,9,10]
  }
}

Constants inherited from When::CalendarNote

Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, Javanese, JulianDay, Mayan, Tibetan, Yis

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

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

#child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from When::CalendarNote

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

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_setup_

Dynamic Method Handling

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

Instance Method Details

#jovianInteger

木星年の計算方式に“South”を適用開始する年

Returns:

  • (Integer)

    年(カリユガ紀元)



1187
1188
1189
1190
# File 'lib/when_exe/region/indian.rb', line 1187

def jovian
  return @jovian if @jovian.kind_of?(Integer)
  @jovian = @jovian ? @jovian.to_i : 4009
end

#karana(dates) ⇒ Array<When::TM::TemporalPosition>

Returns イベント日時.

Parameters:

Returns:



# File 'lib/when_exe/region/indian.rb', line 1224

#naksatra(dates) ⇒ Array<When::TM::TemporalPosition>

Returns イベント日時.

Parameters:

Returns:



# File 'lib/when_exe/region/indian.rb', line 1214

#pancanga(dates, key) ⇒ Array<When::TM::TemporalPosition>

ヴァーラ以外のイベント日時

Parameters:

  • dates (Dates)
  • key (String)

    'tithi', 'naksatra', 'yoga', 'karana' のいずれか

Returns:



1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
# File 'lib/when_exe/region/indian.rb', line 1246

def pancanga(dates, key)
  pattern = NoteConsts[key]
  note    = dates.root[key]
  if pattern[:formula].kind_of?(Numeric)
    factor  = pattern[:formula].to_f
    formula = dates.formula
  else
    factor  = 1.0
    formula = When.Resource(dates.iri.sub(/formula=2L/, "formula=#{pattern[:formula]}"))
  end
  cn      = (formula.time_to_cn(dates.l_date) * factor).floor
  events  = []
  pattern[:range].each do |i|
    event = formula._to_seed_type(formula.cn_to_time((cn+i)/factor), dates.l_date)
    break if +event >= +dates.rises[1]
    next  if +event <  +dates.rises[0]
    event.events = [note[pattern[:index][(cn+i) % pattern[:index].length]]]
    events << event
  end
  events
end

#samvatsara(dates) ⇒ When::BasicTypes::M17n

木星年

see Samvatsara

Parameters:

Returns:



1175
1176
1177
1178
1179
1180
# File 'lib/when_exe/region/indian.rb', line 1175

def samvatsara(dates)
  year_kali = dates.l_date.most_significant_coordinate + dates.l_date.frame.epoch_in_CE + 3101
  year_mod  = year_kali >= jovian ? (year_kali + 12) % 60 :
                                   ((year_kali * 211 - 108).div(18000) + year_kali + 26) % 60
  When.CalendarNote('HinduNote/Notes')['year']['samvatsara'][year_mod]
end

#tithi(dates) ⇒ Array<When::TM::TemporalPosition>

Returns イベント日時.

Parameters:

Returns:



# File 'lib/when_exe/region/indian.rb', line 1209

#vara(dates) ⇒ Array<When::TM::TemporalPosition>

ヴァーラ (七曜)

Parameters:

Returns:



1199
1200
1201
1202
1203
# File 'lib/when_exe/region/indian.rb', line 1199

def vara(dates)
  rise        =  dates.rises[0]
  rise.events = [dates.root['vara'][(rise.to_i+1) % 7]]
  ['V:-', rise]
end

#yoga(dates) ⇒ Array<When::TM::TemporalPosition>

Returns イベント日時.

Parameters:

Returns:



# File 'lib/when_exe/region/indian.rb', line 1219