aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-23 16:23:32 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-23 16:23:32 +0100
commitaa0e27f12d7a2063e82611872cfd3b7dea26b462 (patch)
treee46698b0a9cae7b1eccae3825ad5bbdccbae84eb /src/main/java/at/hannibal2
parent8f3aaa9b5a118ab0f07af966e135cd824ec7c8dc (diff)
downloadskyhanni-aa0e27f12d7a2063e82611872cfd3b7dea26b462.tar.gz
skyhanni-aa0e27f12d7a2063e82611872cfd3b7dea26b462.tar.bz2
skyhanni-aa0e27f12d7a2063e82611872cfd3b7dea26b462.zip
marked more number formatting code as deprecated.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index cd71efe65..fe4725b86 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign
import at.hannibal2.skyhanni.test.TestBingo
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.capAtMinecraftLength
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.toDashlessUUID
@@ -34,7 +35,6 @@ import java.lang.reflect.Constructor
import java.lang.reflect.Field
import java.lang.reflect.Modifier
import java.text.DecimalFormat
-import java.text.NumberFormat
import java.text.SimpleDateFormat
import java.util.Collections
import java.util.LinkedList
@@ -227,14 +227,15 @@ object LorenzUtils {
fun formatPercentage(percentage: Double, format: String?): String =
DecimalFormat(format).format(percentage * 100).replace(',', '.') + "%"
- fun formatInteger(i: Int): String = formatInteger(i.toLong())
+ @Deprecated("old code", ReplaceWith("addSeparator()"))
+ fun formatInteger(i: Int): String = i.addSeparators()
- fun formatInteger(l: Long): String = NumberFormat.getIntegerInstance().format(l)
+ @Deprecated("old code", ReplaceWith("addSeparator()"))
+ fun formatInteger(l: Long): String = l.addSeparators()
+ @Deprecated("old code", ReplaceWith("round() and addSeparator()"))
fun formatDouble(d: Double, round: Int = 1): String {
- val numberInstance = NumberFormat.getNumberInstance()
- numberInstance.maximumFractionDigits = round
- return numberInstance.format(d.round(round))
+ return d.round(round).addSeparators()
}
fun consoleLog(text: String) {
@@ -706,7 +707,7 @@ object LorenzUtils {
while (true)
list.add(this.poll() ?: break)
}
-
+
// Let garbage collector handle the removal of entries in this list
fun <T> weakReferenceList(): MutableSet<T> = Collections.newSetFromMap(WeakHashMap<T, Boolean>())