org.sisioh.baseunits.scala.util

Ratio

class Ratio extends AnyRef

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Ratio
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Ratio(numerator: BigDecimal, denominator: BigDecimal)

    numerator

    分子をあらわす数

    denominator

    分母をあらわす数

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. val breachEncapsulationOfDenominator: BigDecimal

    このオブジェクトのdenominatorフィールド(分母をあらわす数)を返す。

    このオブジェクトのdenominatorフィールド(分母をあらわす数)を返す。

    CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。

    returns

    分母をあらわず数

  8. val breachEncapsulationOfNumerator: BigDecimal

    このオブジェクトのnumeratorフィールド(分子をあらわす数)を返す。

    このオブジェクトのnumeratorフィールド(分子をあらわす数)を返す。

    CAUTION: このメソッドは、このオブジェクトがカプセル化する要素を外部に暴露する。取り扱いには充分注意のこと。

    returns

    分子をあらわす数

  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def decimalValue(scale: Int, roundingMode: scala.math.BigDecimal.RoundingMode.Value): BigDecimal

    比率をscala.math.BigDecimal型で取得する。

    比率をscala.math.BigDecimal型で取得する。

    scale

    小数点以下の有効数字

    roundingMode

    丸めモード

    returns

    この比率の scala.math.BigDecimal 型の表現

  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(obj: Any): Boolean

    このオブジェクトと、与えたオブジェクトの同一性を検証する。

    このオブジェクトと、与えたオブジェクトの同一性を検証する。

    与えたオブジェクトorg.sisioh.baseunits.scala.util.Ratio型や そのサブクラスではない場合、falseを返す。 与えたオブジェクトの、分母と分子が共に一致する場合、trueを返す。

    2/34/6 は、評価結果としては同一であるが、分母同士、分子同士が 異なるため、このメソッドでは true と判断されず、 false となる。

    obj

    比較対象オブジェクト

    returns

    同一の場合はtrue、そうでない場合はfalse

    Definition Classes
    Ratio → AnyRef → Any
    See also

    java.lang.Object#equals(java.lang.Object)

  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    Ratio → AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. lazy val reduce: Ratio

    通分したorg.sisioh.baseunits.scala.util.Ratioを返す。

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def times(multiplier: Ratio): Ratio

    この比率と multiplier の積からなる比率。

    この比率と multiplier の積からなる比率。

    計算結果は、分子同士・分母同士の積からなる比率となる。

    multiplier

    乗数比率

    returns

  23. def times(multiplier: BigDecimal): Ratio

    この比率と multiplier の積からなる比率。

    この比率と multiplier の積からなる比率。

    計算結果は、分母は変化せず、分子は分子と multiplyer の積からなる比率となる。

    multiplier

    乗数

    returns

  24. def toString(): String

    この比率の文字列表現を取得する。

    この比率の文字列表現を取得する。

    "分子/分母"という表記となる。

    Definition Classes
    Ratio → AnyRef → Any
    See also

    java.lang.Object#toString()

  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped