money-module/src/main/kotlin/com/cubetiqs/money/StdMoney.kt
Sambo Chea 31760ee901 Add and updated for whole the money modules with new style and some operators and computation
But money object not full implementation yet, because we need the exchange and filter the object states for money
2021-02-08 12:39:52 +07:00

49 lines
1.0 KiB
Kotlin

package com.cubetiqs.money
/**
* Default standard money style
* We have only value and currency of money
*
* @author sombochea
* @since 1.0
*/
interface StdMoney {
/**
* Get money's value from current state.
*
* @return Double
*/
fun getMoneyValue(): Double
/**
* Get money's currency from current state.
*
* @return String
*/
fun getMoneyCurrency(): Currency
/**
* Allow for money currency called and implemented
*/
interface Currency {
fun getCurrency(): String
}
interface ExchangeOperator {
fun StdMoney.getExchangedTo(currency: Currency): Double
}
interface Operator<T : StdMoney> {
fun plus(other: StdMoney): T
fun divide(other: StdMoney): T
fun inc(): T
fun dec(): T
fun multiply(other: StdMoney): T
// assign operators
fun plusAssign(other: StdMoney)
fun divideAssign(other: StdMoney)
fun multiplyAssign(other: StdMoney)
}
}