Class: When::CalendarNote::Japanese::SolarTermsRevised

Inherits:
SolarTerms show all
Defined in:
lib/when_exe/region/japanese/notes.rb

Overview

太陽黄経による暦注

Constant Summary collapse

DoyoShift =

土用策

When::TM::PeriodDuration.new([0,0,12.1747411317])

Constants inherited from SolarTerms

When::CalendarNote::Japanese::SolarTerms::Notes10, When::CalendarNote::Japanese::SolarTerms::Notes12, When::CalendarNote::Japanese::SolarTerms::Notes60_A, When::CalendarNote::Japanese::SolarTerms::Notes60_B, When::CalendarNote::Japanese::SolarTerms::Notes72, When::CalendarNote::Japanese::SolarTerms::Patch

Constants inherited from When::CalendarNote

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

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from LuniSolarPositions

#delta, #den, #formula, #margin, #num

Attributes inherited from When::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from SolarTerms

_day_notes

Methods inherited from LuniSolarPositions

#event_delta, #event_eval

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

#[], #^, _abbreviation_to_iri, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

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

Instance Method Details

#event_time(date, event_name, event) ⇒ Object

イベント日付(時刻付)



1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
# File 'lib/when_exe/region/japanese/notes.rb', line 1480

def event_time(date, event_name, event)
  return super if date.most_significant_coordinate >= 1869
  etime = term(date + When.Duration('P3D'), [-15,30], When::SYSTEM) + DoyoShift
  if formula.respond_to?(:year_length) && formula.denominator && formula.denominator < 100000
    fraction  =  etime.clk_time.local_time
    fraction +=  When::TM::Duration::DAY * (etime.to_i - date.to_i)
    fraction  = (fraction  / When::TM::Duration::DAY * formula.denominator * 1000 + 0.5).floor / 1000.0
    fraction  =  fraction.to_i if fraction == fraction.to_i
    event_name + "(#{fraction}/#{formula.denominator})"
  else
    etime.events = [event_name]
    etime
  end
end

#position(date, delta = 0) ⇒ Array<Integer>

日付に対応する座標

Parameters:

Returns:

  • (Array<Integer>)

    Array< Integer, 0 or 1 or 2 >

    Integer

    対応する座標

    0 or 1 or 2

    座標の進み(0 なら 没, 2 なら滅)



1469
1470
1471
1472
1473
1474
# File 'lib/when_exe/region/japanese/notes.rb', line 1469

def position(date, delta=0)
  return super if date.most_significant_coordinate >= 1869
  date   = date.floor
  p0, p1 = [date, date.succ].map {|d| (30.0 * @formula.time_to_cn(d-DoyoShift) - @margin + 12).floor}
  [p1 % @den, p1 - p0]
end