Class Index [+]

Quicksearch

When::Coordinates::LeapSeconds

暦座標値

  閏秒のある暦座標の値を表現する

Attributes

second[R]

閏秒の単位 / When::TM::IntervalLength::SYSTEM

int[R]

trunk の整数部

frac[R]

trunk の小数部

Public Class Methods

new(trunk, branch, second) click to toggle source

オブジェクトの生成

    trunk  : Numeric
      幹
    branch : Numeric
      枝
    second : Numeric
      閏秒の単位
     # File when/coordinates.rb, line 967
967:     def initialize(trunk, branch, second)
968:       @second     = second
969:       @int, @frac = trunk.divmod(second)
970:       super(trunk, branch)
971:     end

Public Instance Methods

+(other) click to toggle source

加算

  other   : Numeric

  returns : When::Coordinates::LeapSeconds
    other が When::Coordinates::LeapSeconds でない場合、trunk に対する加算となる
     # File when/coordinates.rb, line 899
899:     def +(other)
900:       return self.class.new(@trunk + +other, @branch, @second) unless other.kind_of?(self.class)
901:       return self.class.new(@trunk + other.trunk, @branch + other.branch, @second)
902:     end
-(other) click to toggle source

減算

  other   : Numeric

  returns : When::Coordinates::LeapSeconds
    other が When::Coordinates::LeapSeconds でない場合、trunk に対する減算となる
     # File when/coordinates.rb, line 911
911:     def -(other)
912:       return self.class.new(@trunk - +other, @branch, @second) unless other.kind_of?(self.class)
913:       return self.class.new(@trunk - other.trunk, @branch - other.branch, @second)
914:     end
<=>(other) click to toggle source

比較

  other   : Numeric

  returns : Integer(負,0,正)
    trunk の整数部, branch, trunk の小数部の順に比較する
     # File when/coordinates.rb, line 935
935:     def <=>(other)
936:       other = self.class.new(+other, 0, @second) unless other.kind_of?(self.class)
937:       raise ArgumentError, "length of unit 'second' mismatch" unless @second == other.second
938:       (@int <=> other.int).nonzero? || (@branch <=> other.branch).nonzero? || (@frac <=> other.frac)
939:     end
divmod(other) click to toggle source

商と剰余

  other   : Numeric

  returns : When::Coordinates::LeapSeconds
    trunk に対する divmod となる
     # File when/coordinates.rb, line 923
923:     def divmod(other)
924:       div, mod = @trunk.divmod(other)
925:       return div, self.class.new(mod, @branch, @second)
926:     end
to_s(zero='') click to toggle source

文字列化

  zero : String

  returns : String
     # File when/coordinates.rb, line 947
947:     def to_s(zero='')
948:       return @trunk.to_s + (@branch==0 ? zero : DL2[(@branch/@second).floor])
949:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.