Class: When::CalendarTypes::CalendarNote::LuniSolarPositions
- Inherits:
-
When::CalendarTypes::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarTypes::CalendarNote
- When::CalendarTypes::CalendarNote::LuniSolarPositions
- Defined in:
- lib/when_exe/region/ephemeric_notes.rb
Overview
太陽と月の位置によるイベント
Direct Known Subclasses
Constant Summary
Constants inherited from When::CalendarTypes::CalendarNote
BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes
Constants included from Parts::Resource
Parts::Resource::LabelProperty
Instance Attribute Summary collapse
-
#delta ⇒ Numeric
readonly
enumerator の周期.
-
#den ⇒ Numeric
readonly
座標の分母.
-
#formula ⇒ When::Ephemeris::Formula
readonly
計算アルゴリズム.
-
#margin ⇒ Numeric
readonly
没滅計算用の補正.
-
#num ⇒ Numeric
readonly
座標の分子.
Attributes inherited from When::CalendarTypes::CalendarNote
Attributes inherited from TM::ReferenceSystem
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標.
-
#term(date, parameter = nil, precision = date.precision) ⇒ When::TM::CalDate
イベントの日時.
-
#term_delta(parameter = nil) ⇒ When::TM::IntervalLength
イベントの標準的な間隔を返す.
Methods inherited from When::CalendarTypes::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
Methods inherited from TM::ReferenceSystem
Methods included from Parts::Resource
#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?
Methods included from Parts::Resource::Pool
#[], #[]=, #_pool, #_setup_, #pool_keys
Methods included from Parts::Resource::Synchronize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Attribute Details
#delta ⇒ Numeric (readonly)
enumerator の周期
41 42 43 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 41 def delta @delta end |
#den ⇒ Numeric (readonly)
座標の分母
29 30 31 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 29 def den @den end |
#formula ⇒ When::Ephemeris::Formula (readonly)
計算アルゴリズム
35 36 37 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 35 def formula @formula end |
#margin ⇒ Numeric (readonly)
没滅計算用の補正
47 48 49 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 47 def margin @margin end |
#num ⇒ Numeric (readonly)
座標の分子
23 24 25 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 23 def num @num end |
Instance Method Details
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標
90 91 92 93 94 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 90 def position(date, delta=0) date = date.floor p0, p1 = [date, date.succ].map {|d| (30.0 * @formula.time_to_cn(d) - @margin + delta).floor} [p1 % @den, p1 - p0] end |
#term(date, parameter = nil, precision = date.precision) ⇒ When::TM::CalDate
イベントの日時
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 63 def term(date, parameter=nil, precision=date.precision) precision = nil if precision == When::SYSTEM num, den = parameter.kind_of?(String) ? parameter.split(/\//, 2) : parameter num = (num || @num).to_f den = (den || @den).to_f date = date.floor(precision) if precision = date._attr quot, mod = (@formula.time_to_cn(date)*30.0).divmod(den) cycle = quot * den + num cycle += den if mod > (num % den) time = When::TM::JulianDate._d_to_t(@formula.cn_to_time(cycle/30.0)) time = date.time_standard.from_dynamical_time(time) if @formula.is_dynamical date = date.frame.jul_trans(When::TM::JulianDate.universal_time(time), ) precision ? date.floor(precision) : date end |
#term_delta(parameter = nil) ⇒ When::TM::IntervalLength
イベントの標準的な間隔を返す
102 103 104 105 106 |
# File 'lib/when_exe/region/ephemeric_notes.rb', line 102 def term_delta(parameter=nil) return @delta unless parameter num, den = parameter.split(/\//, 2) When::TM::IntervalLength.new([(den || @den).to_f-1,1].max, 'day') end |