parent
7ded5ad456
commit
d1cc3a8ea6
@ -0,0 +1,34 @@ |
|||||||
|
package net.pokeranalytics.android.calculus |
||||||
|
|
||||||
|
import net.pokeranalytics.android.util.TextFormat |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
/** |
||||||
|
* ComputedStat contains a [stat] and their associated [value] |
||||||
|
*/ |
||||||
|
class ComputedStat(var stat: Stat, var value: Double, var secondValue: Double? = null, var currency: Currency? = null) { |
||||||
|
|
||||||
|
constructor(stat: Stat, value: Double, previousValue: Double?) : this(stat, value) { |
||||||
|
if (previousValue != null) { |
||||||
|
this.variation = (value - previousValue) / previousValue |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* The value used to get evolution dataset |
||||||
|
*/ |
||||||
|
var progressValue: Double? = null |
||||||
|
|
||||||
|
/** |
||||||
|
* The variation of the stat |
||||||
|
*/ |
||||||
|
var variation: Double? = null |
||||||
|
|
||||||
|
/** |
||||||
|
* Formats the value of the stat to be suitable for display |
||||||
|
*/ |
||||||
|
fun format(): TextFormat { |
||||||
|
return this.stat.format(this.value, this.secondValue, this.currency) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue