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
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, _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 の周期
1589 1590 1591 |
# File 'lib/when_exe/calendartypes.rb', line 1589 def delta @delta end |
#den ⇒ Numeric (readonly)
座標の分母
1577 1578 1579 |
# File 'lib/when_exe/calendartypes.rb', line 1577 def den @den end |
#formula ⇒ When::Ephemeris::Formula (readonly)
計算アルゴリズム
1583 1584 1585 |
# File 'lib/when_exe/calendartypes.rb', line 1583 def formula @formula end |
#margin ⇒ Numeric (readonly)
没滅計算用の補正
1595 1596 1597 |
# File 'lib/when_exe/calendartypes.rb', line 1595 def margin @margin end |
#num ⇒ Numeric (readonly)
座標の分子
1571 1572 1573 |
# File 'lib/when_exe/calendartypes.rb', line 1571 def num @num end |
Instance Method Details
#position(date, delta = 0) ⇒ Array<Integer>
日付に対応する座標
1638 1639 1640 1641 1642 |
# File 'lib/when_exe/calendartypes.rb', line 1638 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
イベントの日時
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 |
# File 'lib/when_exe/calendartypes.rb', line 1611 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
イベントの標準的な間隔を返す
1650 1651 1652 1653 1654 |
# File 'lib/when_exe/calendartypes.rb', line 1650 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 |