Class: When::CalendarNote::LuniSolarPositions
- Inherits:
-
When::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarNote
- When::CalendarNote::LuniSolarPositions
- Defined in:
- lib/when_exe/ephemeris/notes.rb
Overview
太陽と月の位置によるイベント
Direct Known Subclasses
Constant Summary
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
Class Attribute Summary collapse
-
.table_off ⇒ Boolean
高精度テーブル使用の指定状態.
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::CalendarNote
Attributes inherited from TM::ReferenceSystem
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#child, #keys, #locale, #namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#event_eval(date, parameter = @event, precision = nil) ⇒ When::TM::CalDate
イベントの日時.
-
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標.
Methods inherited from When::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
Methods inherited from TM::ReferenceSystem
Methods included from Parts::Resource
#[], #^, _instance, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir
Methods included from Parts::Resource::Pool
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Class Attribute Details
.table_off ⇒ Boolean
高精度テーブル使用の指定状態
23 24 25 |
# File 'lib/when_exe/ephemeris/notes.rb', line 23 def table_off @table_off end |
Instance Attribute Details
#delta ⇒ Numeric (readonly)
enumerator の周期
65 66 67 |
# File 'lib/when_exe/ephemeris/notes.rb', line 65 def delta @delta end |
#den ⇒ Numeric (readonly)
座標の分母
53 54 55 |
# File 'lib/when_exe/ephemeris/notes.rb', line 53 def den @den end |
#formula ⇒ When::Ephemeris::Formula (readonly)
計算アルゴリズム
59 60 61 |
# File 'lib/when_exe/ephemeris/notes.rb', line 59 def formula @formula end |
#margin ⇒ Numeric (readonly)
没滅計算用の補正
71 72 73 |
# File 'lib/when_exe/ephemeris/notes.rb', line 71 def margin @margin end |
#num ⇒ Numeric (readonly)
座標の分子
47 48 49 |
# File 'lib/when_exe/ephemeris/notes.rb', line 47 def num @num end |
Class Method Details
._setup_(table_off = nil) ⇒ void
This method returns an undefined value.
30 31 32 |
# File 'lib/when_exe/ephemeris/notes.rb', line 30 def _setup_(table_off=nil) @table_off = table_off end |
._setup_info ⇒ Hash
設定情報を取得する
38 39 40 |
# File 'lib/when_exe/ephemeris/notes.rb', line 38 def _setup_info {:table_off => @table_off} end |
Instance Method Details
#event_eval(date, parameter = @event, precision = nil) ⇒ When::TM::CalDate
イベントの日時
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/when_exe/ephemeris/notes.rb', line 87 def event_eval(date, parameter=@event, precision=nil) date = When.when?(date) unless date.kind_of?(When::TimeValue) precision ||= date.precision num, den = parameter.kind_of?(String) ? (parameter[/\d.*\z/]||'').split(/\//, 2) : parameter num = (num || @num).to_f den = (den || @den).to_f date = date.floor(precision) if precision < date.precision = date._attr is_date_and_time = .key?(:clock) || precision > When::DAY [:precision] = precision [:clock] ||= date.frame.time_basis || When::TM::Clock.local_time sdn = _the_date(date, num, den) time = When::TM::JulianDate._d_to_t(sdn) if @formula.is_dynamical time = date.time_standard.from_dynamical_time(time) time += [:clock].universal_time(sdn.round) if [:clock].kind_of?(When::CalendarTypes::LocalTime) end event = date.frame.jul_trans(When::TM::JulianDate.universal_time(time), ) is_date_and_time ? event : event.to_cal_date end |
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標
128 129 130 131 132 |
# File 'lib/when_exe/ephemeris/notes.rb', line 128 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 |