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 */ val textFormat: TextFormat get() { return this.stat.textFormat(this.value, this.secondValue, this.currency) } }