Class: When::TM::JulianDate
- Inherits:
-
Coordinate
- Object
- TemporalPosition
- Coordinate
- When::TM::JulianDate
- Defined in:
- lib/when_exe/tmposition.rb,
lib/when_exe/inspect.rb
Overview
ユリウス日
see gml schema
Constant Summary collapse
- JD19700101 =
Julian Day Number
19700101T120000Z
2440588
- JD19700100_5 =
JD19700101 - 0.5
Constants inherited from TemporalPosition
TemporalPosition::AMPM, TemporalPosition::Format, TemporalPosition::HashProperty
Constants included from Coordinates
Coordinates::Bahai, Coordinates::CommonResidue, Coordinates::DefaultDateIndex, Coordinates::DefaultTimeIndex, Coordinates::IndianCities, Coordinates::Javanese, Coordinates::MATCH, Coordinates::Mayan, Coordinates::PERIOD, Coordinates::PERIOD_NAME, Coordinates::PRECISION, Coordinates::PRECISION_NAME, Coordinates::VALUE, Coordinates::Yi
Constants included from When
CENTURY, DAY, DECADE, DurationP1D, DurationP1M, DurationP1W, DurationP1Y, EUCJP, HOUR, MINUTE, MONTH, SECOND, STRING, SYSTEM, SourceURI, When::TimeValue, UTF8, VERSION, W31J, WEEK, YEAR
Constants included from Parts::Resource
Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues
Constants included from IndeterminateValue
IndeterminateValue::After, IndeterminateValue::Before, IndeterminateValue::I, IndeterminateValue::Max, IndeterminateValue::Min, IndeterminateValue::Now, IndeterminateValue::S, IndeterminateValue::Unknown
Instance Attribute Summary
Attributes inherited from Coordinate
Attributes inherited from TemporalPosition
#events, #frame, #indeterminated_position, #location, #options, #precision, #query, #trans
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Class Method Summary collapse
-
._d_to_t(d) ⇒ Numeric
ユリウス日をに日時の内部表現変換.
-
._t_to_d(t) ⇒ Numeric
日時の内部表現をユリウス日に変換.
Instance Method Summary collapse
-
#%(other) ⇒ Numeric
ユリウス日の剰余.
-
#&(other) ⇒ When::TM::TemporalPosition
ユリウス日が指定の剰余となる日.
-
#+(other) ⇒ When::TM::TemporalPosition
加算.
-
#to_m17n(precision = @precision) ⇒ When::BasicTypes::M17n
多言語対応文字列化 - ユリウス日を多言語対応文字列化する.
-
#to_s(precision = @precision) ⇒ String
文字列化 - ユリウス日を文字列化する.
Methods inherited from Coordinate
#-, dynamical_time, new, universal_time
Methods inherited from TemporalPosition
#+@, #-, #<=>, #[], #^, #_attr, _instance, #_notes, _options, _setup_, #_to_hash, #_to_s, #calendar_name, #clock_name, #copy, #dynamical_time, #floor, #has_next?, #has_time?, #include?, #is?, #month_included, #note?, #notes, #period, #prev, #rate_of_clock, #reference_label, #scan, #strftime, #succ, #term, #time_standard, #to_clock_time, #to_date, #to_date_time, #to_date_uri, #to_f, #to_i, #to_residue, #to_time, #to_uri, #universal_time, #week_included, #year_included
Methods included from Coordinates
Methods included from When
Calendar, CalendarEra, CalendarNote, Clock, Duration, M17n, MonthName, Pair, Residue, Resource, TemporalPosition, _free_conv, _parse, _setup_, at, client, config, era, free_conv, m17n, now, server, today, utc, when?
Methods included from TemporalPosition::Conversion
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::TM::TemporalPosition
Class Method Details
._d_to_t(d) ⇒ Numeric
ユリウス日をに日時の内部表現変換
1121 1122 1123 |
# File 'lib/when_exe/tmposition.rb', line 1121 def _d_to_t(d) (d - JD19700100_5) * Duration::DAY end |
._t_to_d(t) ⇒ Numeric
日時の内部表現をユリウス日に変換
1110 1111 1112 |
# File 'lib/when_exe/tmposition.rb', line 1110 def _t_to_d(t) t / Duration::DAY + JD19700100_5 end |
Instance Method Details
#%(other) ⇒ Numeric
ユリウス日の剰余
1161 1162 1163 1164 1165 |
# File 'lib/when_exe/tmposition.rb', line 1161 def %(other) raise TypeError,"The right operand should be When::Coordinates::Residue" unless other.kind_of?(Residue) raise ArgumentError,"The right operand should have a unit 'day'" unless other.event == 'day' other % to_i end |
#&(other) ⇒ When::TM::TemporalPosition
ユリウス日が指定の剰余となる日
1146 1147 1148 1149 1150 1151 1152 1153 |
# File 'lib/when_exe/tmposition.rb', line 1146 def &(other) raise TypeError,"The right operand should be When::Coordinates::Residue" unless other.kind_of?(Residue) raise ArgumentError,"The right operand should have a unit 'day'" unless other.event == 'day' jdn = to_i new_date = self.dup new_date.universal_time += ((other & jdn) - jdn) * Duration::DAY return new_date end |
#+(other) ⇒ When::TM::TemporalPosition
加算
1132 1133 1134 1135 1136 1137 1138 |
# File 'lib/when_exe/tmposition.rb', line 1132 def +(other) new_date = super if new_date.frame && new_date.frame._need_validate new_date.frame = new_date.frame._daylight(self.class.dynamical_time(new_date.dynamical_time, {:frame=>When.utc})) end return new_date end |
#to_m17n(precision = @precision) ⇒ When::BasicTypes::M17n
多言語対応文字列化 - ユリウス日を多言語対応文字列化する
717 718 719 |
# File 'lib/when_exe/inspect.rb', line 717 def to_m17n(precision=@precision) return m17n(to_s(precision)) end |