このオブジェクトのdenominator
フィールド(分母をあらわす数)を返す。
このオブジェクトのdenominator
フィールド(分母をあらわす数)を返す。
CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。
分母をあらわず数
このオブジェクトのnumerator
フィールド(分子をあらわす数)を返す。
このオブジェクトのnumerator
フィールド(分子をあらわす数)を返す。
CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。
分子をあらわす数
比率をscala.math.BigDecimal型で取得する。
比率をscala.math.BigDecimal型で取得する。
小数点以下の有効数字
丸めモード
この比率の scala.math.BigDecimal 型の表現
このオブジェクトと、与えたオブジェクトの同一性を検証する。
このオブジェクトと、与えたオブジェクトの同一性を検証する。
与えたオブジェクトorg.sisioh.baseunits.scala.util.Ratio型や
そのサブクラスではない場合、false
を返す。
与えたオブジェクトの、分母と分子が共に一致する場合、true
を返す。
2/3
と 4/6
は、評価結果としては同一であるが、分母同士、分子同士が
異なるため、このメソッドでは true
と判断されず、 false
となる。
比較対象オブジェクト
同一の場合はtrue
、そうでない場合はfalse
java.lang.Object#equals(java.lang.Object)
通分したorg.sisioh.baseunits.scala.util.Ratioを返す。
この比率と multiplier
の積からなる比率。
この比率と multiplier
の積からなる比率。
計算結果は、分子同士・分母同士の積からなる比率となる。
乗数比率
積
この比率と multiplier
の積からなる比率。
この比率と multiplier
の積からなる比率。
計算結果は、分母は変化せず、分子は分子と multiplyer
の積からなる比率となる。
乗数
積
この比率の文字列表現を取得する。
この比率の文字列表現を取得する。
"分子/分母"という表記となる。
java.lang.Object#toString()
org.sisioh.baseunits.scala.util.Ratioは、2つ同じ単位を持つの量の商(比率)であり、単位のない値である。
このクラスの利点は、比率の計算を遅延評価できることにある。
Ratio represents the unitless division of two quantities of the same type. The key to its usefulness is that it defers the calculation of a decimal value for the ratio. An object which has responsibility for the two values in the ratio and understands their quantities can create the ratio, which can then be used by any client in a unitless form, so that the client is not required to understand the units of the quantity. At the same time, this gives control of the precision and rounding rules to the client, when the time comes to compute a decimal value for the ratio. The client typically has the responsibilities that enable an appropriate choice of these parameters.