時刻を伴った日付
see gml schema
オブジェクトの生成
date : [Numeric] 日付表現 time : [Numeric] 時刻表現 options : Hash :frame => When::TM::Calendar :clock => When::TM::Clock :era_name => When::TM::CalendarEra, When::BasicTypes::M17n or [When::BasicTypes::M17n, Integer] Integer は 当該年号の 0 年に相当する通年 :precision => Integer (Enumerated in the When::Coordinates Module) the others => see When::TM::TemporalPosition._instance
# File when/tmposition.rb, line 1738 1738: def initialize(date, time, options={}) 1739: options[:time] = time 1740: super(date, options) 1741: end
ユリウス日または通年が指定の剰余となる日
other : When::Coordinates::Residue returns : When::TM::DateAndTime
# File when/tmposition.rb, line 1599 1599: def &(other) 1600: raise TypeError,"The right operand should be When::Coordinates::Residue" unless Residue === other 1601: case other.unit 1602: when 'DAY' 1603: # 指定の剰余となる日 1604: return self.dup._copy({:events=>nil, :query=>@query, :validate=>:done, 1605: :date=>@frame.to_cal_date(other & to_i), :time=>@clk_time.clk_time.dup}) 1606: 1607: when 'YEAR' 1608: # 指定の剰余となる年 1609: date = @cal_date.dup 1610: date[0] = other & date[0] 1611: return self.dup._copy({:events=>nil, :query=>@query, :date=>date, :time=>@clk_time.clk_time.dup}) 1612: 1613: else 1614: raise ArgumentError,"The right operand should have a unit 'D' or 'Y'" 1615: end 1616: end
下位桁の切り上げ
digit : Integer これより下の桁を切り上げる(省略すると When::Coordinates::DAY) precision : Integer (Enumerated in the When::Coordinates Module) 切り上げ結果の分解能(省略すると切り上げずに残した最下位の桁) returns : When::TM::DateAndTime
# File when/tmposition.rb, line 1655 1655: def ceil(digit=DAY, precision=digit) 1656: length = clock.indices.length 1657: count = digit - length 1658: period = PeriodDuration.new((count<=0) ? 1 : 0.1**count, digit, (-@frame.indices.length)..length) 1659: result = floor(digit, precision) + period 1660: result += clock._tz_difference if (result.universal_time <= self.universal_time) 1661: return result 1662: end
時法の取得 - ダミー
# File when/tmposition.rb, line 1547 1547: def clock 1548: @clk_time.frame 1549: end
下位桁の切り捨て
digit : Integer これより下の桁を切り捨てる(省略すると When::Coordinates::DAY) precision : Integer (Enumerated in the When::Coordinates Module) 切り捨て結果の分解能(省略すると切り捨てずに残した最下位の桁) returns : When::TM::DateAndTime
# File when/tmposition.rb, line 1628 1628: def floor(digit=DAY, precision=digit) 1629: count = digit - clock.indices.length 1630: date = (digit>=DAY) ? @cal_date.dup : @frame._validate(@cal_date[0..(digit-1)]) 1631: time = clock._validate(@clk_time.clk_time[0..((digit<=DAY) ? 0 : ((count>=0) ? 1 : digit))]) 1632: 1633: if (count >= 0) 1634: factor = 10**count 1635: time[1] = (time[1] * factor).floor.to_f / factor 1636: end 1637: 1638: # オブジェクトの生成 1639: options = {:date=>date, :validate=>:done, :events=>nil, :query=>nil, 1640: :time=>(digit<=DAY) ? time : @clk_time.dup._copy({:time=>time})} 1641: options[:precision] = precision if precision 1642: return self.dup._copy(options) 1643: end
要素の多言語対応文字列化
index : Integer or String of When::Coordinates::PRECISION 多言語対応文字列化する要素の指定 format : When::BasicTypes::M17n 多言語対応文字列化の書式 returns : When::BasicTypes::M17n
# File when/tmposition.rb, line 1588 1588: def name(index, format=nil) 1589: digit = _digit(index) 1590: (digit <= DAY) ? super : @clk_time.name(digit, format) 1591: end
多言語対応文字列化
precision : Integer (Enumerated in the When::Coordinates Module) どの桁まで多言語対応文字列化するか、分解能で指定する(デフォルト : @precision) returns : When::BasicTypes::M17n When Standard Representation により多言語対応文字列化する
# File when/tmposition.rb, line 1673 1673: def to_m17n(precision=@precision) 1674: super + @clk_time.to_m17n(precision) 1675: end
文字列化
precision : Integer (Enumerated in the When::Coordinates Module) どの桁まで文字列化するか、分解能で指定する(デフォルト : @precision) returns : String When Standard Representation により文字列化する
# File when/tmposition.rb, line 1686 1686: def to_s(precision=@precision) 1687: super + @clk_time.to_s(precision) 1688: end
内部時間
returns : Numeric 1970-01-01T00:00:00Z からの Universal Coordinated Time の経過時間 / 128秒 暦法によっては、異なる意味を持つことがある
# File when/tmposition.rb, line 1559 1559: def universal_time 1560: return super if [Now, Max, Min].include?(@indeterminated_position) 1561: raise NameError, "Temporal Reference System is not defined" unless (@frame && clock) 1562: @universal_time ||= (to_i + +@clk_time.clk_time[0] - JulianDate::JD19700101) * IntervalLength::DAY + 1563: @clk_time.universal_time 1564: end
要素の参照
index : Integer or String of When::Coordinates::PRECISION 参照する要素の指定 returns : Numeric
# File when/tmposition.rb, line 1573 1573: def value(index) 1574: digit = _digit(index) 1575: return (digit <= DAY) ? @cal_date[digit-1] : @clk_time.clk_time[digit] 1576: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.