use of seperate trait Bounded

This commit is contained in:
Ramon Boss 2019-07-10 08:40:12 +02:00
parent df4507edef
commit 512f3ab2f3
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
package org.bitcoins.core.currency
import org.bitcoins.core.consensus.Consensus
import org.bitcoins.core.number.{BaseNumbers, BasicArithmetic, Int64}
import org.bitcoins.core.number.{BaseNumbers, BasicArithmetic, Bounded, Int64}
import org.bitcoins.core.protocol.NetworkElement
import org.bitcoins.core.serializers.RawSatoshisSerializer
import org.bitcoins.core.util.Factory
@ -70,7 +70,7 @@ sealed abstract class Satoshis extends CurrencyUnit {
def ==(satoshis: Satoshis): Boolean = underlying == satoshis.underlying
}
object Satoshis extends Factory[Satoshis] with BaseNumbers[Satoshis] {
object Satoshis extends Factory[Satoshis] with BaseNumbers[Satoshis] with Bounded[Satoshis] {
val min = Satoshis(Int64.min)
val max = Satoshis(Int64.max)
@ -99,7 +99,7 @@ sealed abstract class Bitcoins extends CurrencyUnit {
}
}
object Bitcoins extends BaseNumbers[Bitcoins] {
object Bitcoins extends BaseNumbers[Bitcoins] with Bounded[Bitcoins] {
val min = Bitcoins((-Consensus.maxMoney).satoshis)
val max = Bitcoins(Consensus.maxMoney.satoshis)
val zero = Bitcoins(Satoshis.zero)

View File

@ -1,7 +1,7 @@
package org.bitcoins.core.protocol.ln.currency
import org.bitcoins.core.currency.Satoshis
import org.bitcoins.core.number.{BaseNumbers, BasicArithmetic, Int64, UInt5}
import org.bitcoins.core.number.{BaseNumbers, BasicArithmetic, Bounded, Int64, UInt5}
import org.bitcoins.core.protocol.NetworkElement
import org.bitcoins.core.protocol.ln._
import org.bitcoins.core.util.Bech32
@ -99,7 +99,7 @@ sealed abstract class MilliBitcoins extends LnCurrencyUnit {
}
object MilliBitcoins extends BaseNumbers[MilliBitcoins] {
object MilliBitcoins extends BaseNumbers[MilliBitcoins] with Bounded[MilliBitcoins] {
val min = MilliBitcoins(LnPolicy.minMilliBitcoins)
val max = MilliBitcoins(LnPolicy.maxMilliBitcoins)
val zero = MilliBitcoins(0)
@ -129,7 +129,7 @@ sealed abstract class MicroBitcoins extends LnCurrencyUnit {
}
object MicroBitcoins extends BaseNumbers[MicroBitcoins] {
object MicroBitcoins extends BaseNumbers[MicroBitcoins]with Bounded[MicroBitcoins] {
val min = MicroBitcoins(LnPolicy.minMicroBitcoins)
val max = MicroBitcoins(LnPolicy.maxMicroBitcoins)
val zero = MicroBitcoins(0)
@ -159,7 +159,7 @@ sealed abstract class NanoBitcoins extends LnCurrencyUnit {
}
object NanoBitcoins extends BaseNumbers[NanoBitcoins] {
object NanoBitcoins extends BaseNumbers[NanoBitcoins] with Bounded[NanoBitcoins] {
val min = NanoBitcoins(LnPolicy.minNanoBitcoins)
val max = NanoBitcoins(LnPolicy.maxNanoBitcoins)
val zero = NanoBitcoins(0)
@ -187,7 +187,7 @@ sealed abstract class PicoBitcoins extends LnCurrencyUnit {
override def toBigInt: BigInt = underlying
}
object PicoBitcoins extends BaseNumbers[PicoBitcoins] {
object PicoBitcoins extends BaseNumbers[PicoBitcoins] with Bounded[PicoBitcoins] {
val min = PicoBitcoins(LnPolicy.minPicoBitcoins)
val max = PicoBitcoins(LnPolicy.maxPicoBitcoins)
val zero = PicoBitcoins(0)