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/calendartypes.rb
Overview
太陽と月の位置によるイベント
Direct Known Subclasses
Constant Summary
Constants inherited from When::CalendarTypes::CalendarNote
BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, YiNotes
Constants included from Parts::Resource
Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues
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 inherited from BasicTypes::Object
Methods included from Parts::Resource
#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #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 の周期
1586 1587 1588 |
# File 'lib/when_exe/calendartypes.rb', line 1586 def delta @delta end |
#den ⇒ Numeric (readonly)
座標の分母
1574 1575 1576 |
# File 'lib/when_exe/calendartypes.rb', line 1574 def den @den end |
#formula ⇒ When::Ephemeris::Formula (readonly)
計算アルゴリズム
1580 1581 1582 |
# File 'lib/when_exe/calendartypes.rb', line 1580 def formula @formula end |
#margin ⇒ Numeric (readonly)
没滅計算用の補正
1592 1593 1594 |
# File 'lib/when_exe/calendartypes.rb', line 1592 def margin @margin end |
#num ⇒ Numeric (readonly)
座標の分子
1568 1569 1570 |
# File 'lib/when_exe/calendartypes.rb', line 1568 def num @num end |
Instance Method Details
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標
1635 1636 1637 1638 1639 |
# File 'lib/when_exe/calendartypes.rb', line 1635 def position(date, delta=0) date = date.floor p0, p1 = [date, date.succ].map {|d| (@formula.time_to_cn(d)*30.0-@margin+delta).floor} [p1 % @den, p1-p0] end |
#term(date, parameter = nil, precision = date.precision) ⇒ When::TM::CalDate
イベントの日時
1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 |
# File 'lib/when_exe/calendartypes.rb', line 1608 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 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
イベントの標準的な間隔を返す
1647 1648 1649 1650 1651 |
# File 'lib/when_exe/calendartypes.rb', line 1647 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 |