final class Decimal extends Ordered[Decimal] with Serializable
A mutable implementation of BigDecimal that can hold a Long if values are small enough.
The semantics of the fields are as follows: - _precision and _scale represent the SQL precision and scale we are looking for - If decimalVal is set, it represents the whole decimal value - Otherwise, the decimal value is longVal / (10 ** _scale)
Note, for values between -1.0 and 1.0, precision digits are only counted after dot.
- Annotations
- @Unstable()
- Source
- Decimal.scala
- Alphabetic
- By Inheritance
- Decimal
- Serializable
- Serializable
- Ordered
- Comparable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Decimal()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def %(that: Decimal): Decimal
- def *(that: Decimal): Decimal
- def +(that: Decimal): Decimal
- def -(that: Decimal): Decimal
- def /(that: Decimal): Decimal
-
def
<(that: Decimal): Boolean
- Definition Classes
- Ordered
-
def
<=(that: Decimal): Boolean
- Definition Classes
- Ordered
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
>(that: Decimal): Boolean
- Definition Classes
- Ordered
-
def
>=(that: Decimal): Boolean
- Definition Classes
- Ordered
- def abs: Decimal
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def ceil: Decimal
-
def
changePrecision(precision: Int, scale: Int): Boolean
Update precision and scale while keeping our value the same, and return true if successful.
Update precision and scale while keeping our value the same, and return true if successful.
- returns
true if successful, false if overflow would occur
-
def
clone(): Decimal
- Definition Classes
- Decimal → AnyRef
-
def
compare(other: Decimal): Int
- Definition Classes
- Decimal → Ordered
-
def
compareTo(that: Decimal): Int
- Definition Classes
- Ordered → Comparable
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(other: Any): Boolean
- Definition Classes
- Decimal → AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def floor: Decimal
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- Decimal → AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isZero: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def precision: Int
- def quot(that: Decimal): Decimal
- def remainder(that: Decimal): Decimal
- def scale: Int
-
def
set(decimal: Decimal): Decimal
Set this Decimal to the given Decimal value.
-
def
set(bigintval: BigInteger): Decimal
If the value is not in the range of long, convert it to BigDecimal and the precision and scale are based on the converted value.
If the value is not in the range of long, convert it to BigDecimal and the precision and scale are based on the converted value.
This code avoids BigDecimal object allocation as possible to improve runtime efficiency
-
def
set(decimal: BigDecimal): Decimal
Set this Decimal to the given BigDecimal value, inheriting its precision and scale.
-
def
set(decimal: BigDecimal, precision: Int, scale: Int): Decimal
Set this Decimal to the given BigDecimal value, with a given precision and scale.
-
def
set(unscaled: Long, precision: Int, scale: Int): Decimal
Set this Decimal to the given unscaled Long, with a given precision and scale.
-
def
set(intVal: Int): Decimal
Set this Decimal to the given Int.
Set this Decimal to the given Int. Will have precision 10 and scale 0.
-
def
set(longVal: Long): Decimal
Set this Decimal to the given Long.
Set this Decimal to the given Long. Will have precision 20 and scale 0.
-
def
setOrNull(unscaled: Long, precision: Int, scale: Int): Decimal
Set this Decimal to the given unscaled Long, with a given precision and scale, and return it, or return null if it cannot be set due to overflow.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toBigDecimal: BigDecimal
- def toByte: Byte
- def toDebugString: String
- def toDouble: Double
- def toFloat: Float
- def toInt: Int
- def toJavaBigDecimal: BigDecimal
- def toJavaBigInteger: BigInteger
- def toLong: Long
- def toPlainString: String
- def toScalaBigInt: BigInt
- def toShort: Short
-
def
toString(): String
- Definition Classes
- Decimal → AnyRef → Any
- def toUnscaledLong: Long
- def unary_-: Decimal
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()