diff --git a/app/src/main/java/net/pokeranalytics/android/calculus/ComputedStat.kt b/app/src/main/java/net/pokeranalytics/android/calculus/ComputedStat.kt new file mode 100644 index 00000000..7058e349 --- /dev/null +++ b/app/src/main/java/net/pokeranalytics/android/calculus/ComputedStat.kt @@ -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) + } + +} diff --git a/app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt b/app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt index 19cb1111..dc15a84b 100644 --- a/app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt +++ b/app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt @@ -302,33 +302,3 @@ enum class Stat(override var uniqueIdentifier: Int) : IntIdentifiable, RowRepres override val viewType: Int = RowViewType.TITLE_VALUE.ordinal } - -/** - * 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) - } - -}