From aa32dea6829ec8586f79446e5dd0b904bbe2fc37 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 24 Nov 2022 21:44:45 +0700 Subject: [PATCH] ImpreciseFraction -> Decimal because it truly is. --- .../dbotthepony/mc/otm/datagen/MatterData.kt | 5 +- .../mc/otm/OverdriveThatMatters.java | 4 +- .../ru/dbotthepony/mc/otm/ServerConfig.kt | 89 +- .../android/feature/NanobotsArmorFeature.kt | 6 +- .../feature/NanobotsRegenerationFeature.kt | 1 - .../block/entity/AndroidStationBlockEntity.kt | 30 +- .../block/entity/BatteryBankBlockEntity.kt | 38 +- .../entity/ChemicalGeneratorBlockEntity.kt | 14 +- .../block/entity/EnergyCounterBlockEntity.kt | 74 +- .../block/entity/EnergyServoBlockEntity.kt | 24 +- .../block/entity/MatteryPoweredBlockEntity.kt | 8 +- .../block/entity/MatteryWorkerBlockEntity.kt | 18 +- .../otm/block/entity/PlatePressBlockEntity.kt | 4 +- .../entity/blackhole/BlackHoleBlockEntity.kt | 10 +- .../entity/matter/MatterBottlerBlockEntity.kt | 30 +- .../matter/MatterCapacitorBankBlockEntity.kt | 29 +- .../matter/MatterDecomposerBlockEntity.kt | 22 +- .../matter/MatterRecyclerBlockEntity.kt | 28 +- .../matter/MatterReplicatorBlockEntity.kt | 28 +- .../entity/matter/MatterScannerBlockEntity.kt | 12 +- .../entity/storage/DriveRackBlockEntity.kt | 4 +- .../block/entity/storage/StorageInterfaces.kt | 2 +- .../StoragePowerSupplierBlockEntity.kt | 10 +- .../mc/otm/capability/AndroidPowerSource.kt | 30 +- .../mc/otm/capability/EnergyStorageImpl.kt | 188 +-- .../ru/dbotthepony/mc/otm/capability/Ext.kt | 30 +- .../otm/capability/IMatteryEnergyStorage.kt | 97 +- .../otm/capability/MatteryPlayerCapability.kt | 3 +- .../mc/otm/capability/drive/API.kt | 2 - .../otm/capability/matter/IMatterHandler.kt | 17 +- .../capability/matter/MatterHandlerImpl.kt | 41 +- .../mc/otm/compat/mekanism/Conversions.kt | 10 +- .../mc/otm/compat/mekanism/Power.kt | 24 +- .../ru/dbotthepony/mc/otm/core/DataStreams.kt | 2 +- .../core/{ImpreciseFraction.kt => Decimal.kt} | 242 ++-- .../kotlin/ru/dbotthepony/mc/otm/core/Ext.kt | 42 +- .../ru/dbotthepony/mc/otm/core/Formatting.kt | 20 +- .../ru/dbotthepony/mc/otm/core/Fraction.kt | 10 +- .../mc/otm/graph/matter/MatterNetworkGraph.kt | 40 +- .../ru/dbotthepony/mc/otm/item/BatteryItem.kt | 53 +- .../mc/otm/item/EnergySwordItem.kt | 26 +- .../mc/otm/item/MatterCapacitorItem.kt | 34 +- .../dbotthepony/mc/otm/item/MatterDustItem.kt | 16 +- .../mc/otm/item/QuantumBatteryItem.kt | 88 +- .../mc/otm/item/SingleUseBatteryItem.kt | 10 +- .../mc/otm/item/weapon/PlasmaRifleItem.kt | 14 +- .../mc/otm/item/weapon/PlasmaWeaponItem.kt | 36 +- .../mc/otm/matter/AbstractRegistryAction.kt | 10 +- .../mc/otm/matter/BoundMatterFunction.kt | 4 +- .../mc/otm/matter/ComputeAction.kt | 8 +- .../dbotthepony/mc/otm/matter/IMatterValue.kt | 18 +- .../dbotthepony/mc/otm/matter/InsertAction.kt | 6 +- .../mc/otm/matter/MatterDataProvider.kt | 1018 ++++++++--------- .../mc/otm/matter/MatterFunction.kt | 28 +- .../mc/otm/matter/MatterManager.kt | 26 +- .../mc/otm/matter/RecipeResolverManager.kt | 39 - .../dbotthepony/mc/otm/matter/UpdateAction.kt | 12 +- .../mc/otm/menu/EnergyCounterMenu.kt | 4 +- .../mc/otm/menu/MatterCapacitorBankMenu.kt | 7 +- .../mc/otm/menu/MatterScannerMenu.kt | 6 +- .../mc/otm/menu/PatternStorageMenu.kt | 8 +- .../mc/otm/menu/widget/LevelGaugeWidget.kt | 18 +- .../mc/otm/network/FieldSynchronizer.kt | 14 +- .../dbotthepony/mc/otm/registry/MRegistry.kt | 4 +- .../ru/dbotthepony/mc/otm/storage/API.kt | 3 - .../ru/dbotthepony/mc/otm/storage/Registry.kt | 11 +- .../dbotthepony/mc/otm/tests/DecimalTests.kt | 93 ++ .../mc/otm/tests/FormattingTests.kt | 28 +- .../dbotthepony/mc/otm/tests/FractionTests.kt | 16 +- .../mc/otm/tests/ImpreciseFractionTests.kt | 94 -- 70 files changed, 1480 insertions(+), 1560 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/core/{ImpreciseFraction.kt => Decimal.kt} (69%) create mode 100644 src/test/kotlin/ru/dbotthepony/mc/otm/tests/DecimalTests.kt delete mode 100644 src/test/kotlin/ru/dbotthepony/mc/otm/tests/ImpreciseFractionTests.kt diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/MatterData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/MatterData.kt index a0adfa5a2..f02e26d98 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/MatterData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/MatterData.kt @@ -1,11 +1,10 @@ package ru.dbotthepony.mc.otm.datagen -import net.minecraft.resources.ResourceLocation import net.minecraft.tags.ItemTags import net.minecraft.world.item.Item import net.minecraft.world.item.Items import net.minecraftforge.common.Tags -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.matter.MatterDataProvider import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItems @@ -91,7 +90,7 @@ fun addMatterData(provider: MatterDataProvider) { blacklist(MItemTags.TRITANIUM_ORES) } - provider.scope(Items.DIRT, ImpreciseFraction(1), 20.0) { + provider.scope(Items.DIRT, Decimal(1), 20.0) { equal( Items.GRASS_BLOCK, Items.PODZOL, diff --git a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java index 207dfb876..61fb44f29 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java +++ b/src/main/java/ru/dbotthepony/mc/otm/OverdriveThatMatters.java @@ -36,7 +36,7 @@ import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer; import ru.dbotthepony.mc.otm.client.render.WidgetAtlasHolder; import ru.dbotthepony.mc.otm.compat.mekanism.QIOKt; import ru.dbotthepony.mc.otm.compat.mekanism.TooltipsKt; -import ru.dbotthepony.mc.otm.core.ImpreciseFraction; +import ru.dbotthepony.mc.otm.core.Decimal; import ru.dbotthepony.mc.otm.item.ItemTritaniumArmor; import ru.dbotthepony.mc.otm.item.QuantumBatteryItem; import ru.dbotthepony.mc.otm.item.weapon.AbstractWeaponItem; @@ -191,7 +191,7 @@ public final class OverdriveThatMatters { WorldNetworkChannel.INSTANCE.register(); GenericNetworkChannel.INSTANCE.register(); - ITEM_STORAGE = StorageRegistry.register(ItemStackWrapper.class, ItemStackWrapper.EMPTY, new ImpreciseFraction("3.125")); + ITEM_STORAGE = StorageRegistry.register(ItemStackWrapper.class, ItemStackWrapper.EMPTY, new Decimal("3.125")); if (ModList.get().isLoaded("mekanism")) { EVENT_BUS.addGenericListener(BlockEntity.class, EventPriority.NORMAL, QIOKt::attachCapabilities); diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt index c2e3cd520..b3df72b72 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/ServerConfig.kt @@ -1,11 +1,8 @@ package ru.dbotthepony.mc.otm -import net.minecraft.world.effect.MobEffect -import net.minecraft.world.effect.MobEffects import net.minecraftforge.common.ForgeConfigSpec import net.minecraftforge.fml.ModLoadingContext import net.minecraftforge.fml.config.ModConfig -import net.minecraftforge.registries.ForgeRegistries import ru.dbotthepony.mc.otm.block.entity.AndroidStationBlockEntity import ru.dbotthepony.mc.otm.block.entity.ChemicalGeneratorBlockEntity import ru.dbotthepony.mc.otm.block.entity.matter.MatterBottlerBlockEntity @@ -14,24 +11,24 @@ import ru.dbotthepony.mc.otm.block.entity.matter.MatterRecyclerBlockEntity import ru.dbotthepony.mc.otm.block.entity.matter.MatterReplicatorBlockEntity import ru.dbotthepony.mc.otm.block.entity.matter.MatterScannerBlockEntity import ru.dbotthepony.mc.otm.capability.BlockEnergyStorageImpl -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.item.EnergySwordItem import ru.dbotthepony.mc.otm.registry.MNames interface VerboseBalanceValues { - val capacity: ImpreciseFraction - val receive: ImpreciseFraction - val extract: ImpreciseFraction + val capacity: Decimal + val receive: Decimal + val extract: Decimal } interface BatteryBalanceValues : VerboseBalanceValues { - val initialBatteryLevel: ImpreciseFraction + val initialBatteryLevel: Decimal } interface ConciseBalanceValues { - val capacity: ImpreciseFraction - val throughput: ImpreciseFraction + val capacity: Decimal + val throughput: Decimal } object ServerConfig { @@ -39,13 +36,13 @@ object ServerConfig { private val spec: ForgeConfigSpec private var registered = false - private fun verboseValues(name: String, storage: ImpreciseFraction, receive: ImpreciseFraction, extract: ImpreciseFraction = receive): VerboseBalanceValues { + private fun verboseValues(name: String, storage: Decimal, receive: Decimal, extract: Decimal = receive): VerboseBalanceValues { specBuilder.push(name) val obj = object : VerboseBalanceValues { - override val capacity: ImpreciseFraction by specBuilder.defineImpreciseFraction("capacity", storage, minimum = ImpreciseFraction.ONE) - override val receive: ImpreciseFraction by specBuilder.defineImpreciseFraction("receive", receive, minimum = ImpreciseFraction.ONE) - override val extract: ImpreciseFraction by specBuilder.defineImpreciseFraction("extract", extract, minimum = ImpreciseFraction.ONE) + override val capacity: Decimal by specBuilder.defineDecimal("capacity", storage, minimum = Decimal.ONE) + override val receive: Decimal by specBuilder.defineDecimal("receive", receive, minimum = Decimal.ONE) + override val extract: Decimal by specBuilder.defineDecimal("extract", extract, minimum = Decimal.ONE) } specBuilder.pop() @@ -53,14 +50,14 @@ object ServerConfig { return obj } - private fun batteryValues(name: String, storage: ImpreciseFraction, receive: ImpreciseFraction, extract: ImpreciseFraction = receive, initialBatteryLevel: ImpreciseFraction = ImpreciseFraction.ZERO): BatteryBalanceValues { + private fun batteryValues(name: String, storage: Decimal, receive: Decimal, extract: Decimal = receive, initialBatteryLevel: Decimal = Decimal.ZERO): BatteryBalanceValues { specBuilder.push(name) val obj = object : BatteryBalanceValues { - override val capacity: ImpreciseFraction by specBuilder.defineImpreciseFraction("capacity", storage, minimum = ImpreciseFraction.ONE) - override val receive: ImpreciseFraction by specBuilder.defineImpreciseFraction("receive", receive, minimum = ImpreciseFraction.ONE) - override val extract: ImpreciseFraction by specBuilder.defineImpreciseFraction("extract", extract, minimum = ImpreciseFraction.ONE) - override val initialBatteryLevel: ImpreciseFraction by specBuilder.defineImpreciseFraction("initialBatteryLevel", initialBatteryLevel, minimum = ImpreciseFraction.ZERO) + override val capacity: Decimal by specBuilder.defineDecimal("capacity", storage, minimum = Decimal.ONE) + override val receive: Decimal by specBuilder.defineDecimal("receive", receive, minimum = Decimal.ONE) + override val extract: Decimal by specBuilder.defineDecimal("extract", extract, minimum = Decimal.ONE) + override val initialBatteryLevel: Decimal by specBuilder.defineDecimal("initialBatteryLevel", initialBatteryLevel, minimum = Decimal.ZERO) } specBuilder.pop() @@ -68,12 +65,12 @@ object ServerConfig { return obj } - private fun conciseValues(name: String, storage: ImpreciseFraction, throughput: ImpreciseFraction): ConciseBalanceValues { + private fun conciseValues(name: String, storage: Decimal, throughput: Decimal): ConciseBalanceValues { specBuilder.push(name) val obj = object : ConciseBalanceValues { - override val capacity: ImpreciseFraction by specBuilder.defineImpreciseFraction("capacity", storage, minimum = ImpreciseFraction.ONE) - override val throughput: ImpreciseFraction by specBuilder.defineImpreciseFraction("throughput", throughput, minimum = ImpreciseFraction.ONE) + override val capacity: Decimal by specBuilder.defineDecimal("capacity", storage, minimum = Decimal.ONE) + override val throughput: Decimal by specBuilder.defineDecimal("throughput", throughput, minimum = Decimal.ONE) } specBuilder.pop() @@ -91,16 +88,16 @@ object ServerConfig { specBuilder.comment("Energy batteries balance values").push("energyBatteries") } - val BATTERY_CRUDE = batteryValues(MNames.BATTERY_CRUDE, ImpreciseFraction(100_000), ImpreciseFraction(160), ImpreciseFraction(40), ImpreciseFraction(80_000)) - val BATTERY_BASIC = batteryValues(MNames.BATTERY_BASIC, ImpreciseFraction(400_000), ImpreciseFraction(600)) - val BATTERY_NORMAL = batteryValues(MNames.BATTERY_NORMAL, ImpreciseFraction(2_000_000), ImpreciseFraction(1_000)) - val BATTERY_DENSE = batteryValues(MNames.BATTERY_DENSE, ImpreciseFraction(10_000_000), ImpreciseFraction(2_000)) - val BATTERY_CAPACITOR = batteryValues(MNames.BATTERY_CAPACITOR, ImpreciseFraction(500_000), ImpreciseFraction(50_000)) + val BATTERY_CRUDE = batteryValues(MNames.BATTERY_CRUDE, Decimal(100_000), Decimal(160), Decimal(40), Decimal(80_000)) + val BATTERY_BASIC = batteryValues(MNames.BATTERY_BASIC, Decimal(400_000), Decimal(600)) + val BATTERY_NORMAL = batteryValues(MNames.BATTERY_NORMAL, Decimal(2_000_000), Decimal(1_000)) + val BATTERY_DENSE = batteryValues(MNames.BATTERY_DENSE, Decimal(10_000_000), Decimal(2_000)) + val BATTERY_CAPACITOR = batteryValues(MNames.BATTERY_CAPACITOR, Decimal(500_000), Decimal(50_000)) - val QUANTUM_BATTERY = conciseValues(MNames.QUANTUM_BATTERY, ImpreciseFraction(40_000_000), ImpreciseFraction(10_000)) - val QUANTUM_CAPACITOR = conciseValues(MNames.QUANTUM_CAPACITOR, ImpreciseFraction(1_000_000), ImpreciseFraction(200_000)) + val QUANTUM_BATTERY = conciseValues(MNames.QUANTUM_BATTERY, Decimal(40_000_000), Decimal(10_000)) + val QUANTUM_CAPACITOR = conciseValues(MNames.QUANTUM_CAPACITOR, Decimal(1_000_000), Decimal(200_000)) - val ZPM_BATTERY = conciseValues(MNames.ZPM_BATTERY, ImpreciseFraction(200_000_000_000_000L), ImpreciseFraction(200_000_000L)) + val ZPM_BATTERY = conciseValues(MNames.ZPM_BATTERY, Decimal(200_000_000_000_000L), Decimal(200_000_000L)) init { specBuilder.pop() @@ -108,11 +105,11 @@ object ServerConfig { specBuilder.comment("Matter capacitors and pattern drives balance values").push("matterCapacitorsAndDrives") } - val MATTER_CAPACITOR_BASIC by specBuilder.defineImpreciseFraction(MNames.MATTER_CAPACITOR_BASIC, ImpreciseFraction(2_000), minimum = ImpreciseFraction.ONE_TENTH) - val MATTER_CAPACITOR_NORMAL by specBuilder.defineImpreciseFraction(MNames.MATTER_CAPACITOR_NORMAL, ImpreciseFraction(40_000), minimum = ImpreciseFraction.ONE_TENTH) - val MATTER_CAPACITOR_DENSE by specBuilder.defineImpreciseFraction(MNames.MATTER_CAPACITOR_DENSE, ImpreciseFraction(400_000), minimum = ImpreciseFraction.ONE_TENTH) + val MATTER_CAPACITOR_BASIC by specBuilder.defineDecimal(MNames.MATTER_CAPACITOR_BASIC, Decimal(2_000), minimum = Decimal.ONE_TENTH) + val MATTER_CAPACITOR_NORMAL by specBuilder.defineDecimal(MNames.MATTER_CAPACITOR_NORMAL, Decimal(40_000), minimum = Decimal.ONE_TENTH) + val MATTER_CAPACITOR_DENSE by specBuilder.defineDecimal(MNames.MATTER_CAPACITOR_DENSE, Decimal(400_000), minimum = Decimal.ONE_TENTH) - val MATTER_DUST_CAPACITY by specBuilder.comment("Maximal matter value one matter dust item can have").defineImpreciseFraction("matterDustCapacity", ImpreciseFraction(2_000), minimum = ImpreciseFraction.ONE_TENTH) + val MATTER_DUST_CAPACITY by specBuilder.comment("Maximal matter value one matter dust item can have").defineDecimal("matterDustCapacity", Decimal(2_000), minimum = Decimal.ONE_TENTH) val PATTERN_DRIVE_NORMAL: Int by specBuilder.defineInRange(MNames.PATTERN_DRIVE_NORMAL, 4, 1, Int.MAX_VALUE) @@ -131,11 +128,11 @@ object ServerConfig { } val PLATE_PRESS = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.PLATE_PRESS) - val STORAGE_POWER_SUPPLIER = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.STORAGE_POWER_SUPPLIER, capacity = ImpreciseFraction(100_000), throughput = ImpreciseFraction(320)) - val STORAGE_INTERFACES = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, "storage_interfaces", capacity = ImpreciseFraction(10_000)) + val STORAGE_POWER_SUPPLIER = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.STORAGE_POWER_SUPPLIER, capacity = Decimal(100_000), throughput = Decimal(320)) + val STORAGE_INTERFACES = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, "storage_interfaces", capacity = Decimal(10_000)) val ITEM_MONITOR = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.ITEM_MONITOR) val DRIVE_VIEWER = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.DRIVE_VIEWER) - val DRIVE_RACK = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.DRIVE_RACK, capacity = ImpreciseFraction(80_000)) + val DRIVE_RACK = BlockEnergyStorageImpl.makeConfigEntry(specBuilder, MNames.DRIVE_RACK, capacity = Decimal(80_000)) init { specBuilder.pop() @@ -167,12 +164,12 @@ object ServerConfig { val ENERGY_PER_HITPOINT by specBuilder .comment("Energy required to regenerate 1 health point (half a heart)") - .defineImpreciseFraction("energyPerHitpoint", ImpreciseFraction(800)) + .defineDecimal("energyPerHitpoint", Decimal(800)) } - val ANDROID_ENERGY_PER_HUNGER_POINT by specBuilder.defineImpreciseFraction("energyPerHunger", ImpreciseFraction(2000), ImpreciseFraction.ZERO) - val ANDROID_MAX_ENERGY by specBuilder.comment("Internal battery of every android has this much storage").defineImpreciseFraction("capacity", ImpreciseFraction(80_000), ImpreciseFraction.ZERO) - val NIGHT_VISION_POWER_DRAW by specBuilder.defineImpreciseFraction("nightVisionPowerDraw", ImpreciseFraction(8), ImpreciseFraction.ZERO) + val ANDROID_ENERGY_PER_HUNGER_POINT by specBuilder.defineDecimal("energyPerHunger", Decimal(2000), Decimal.ZERO) + val ANDROID_MAX_ENERGY by specBuilder.comment("Internal battery of every android has this much storage").defineDecimal("capacity", Decimal(80_000), Decimal.ZERO) + val NIGHT_VISION_POWER_DRAW by specBuilder.defineDecimal("nightVisionPowerDraw", Decimal(8), Decimal.ZERO) val FALL_DAMAGE_REDUCTION_PER_LEVEL: Double by specBuilder.comment("In percent. Level of feature is multiplied by this").defineInRange("fallDamageReductionPerDampenerLevel", 0.25, 0.01, 1.0) object EnderTeleporter { @@ -180,7 +177,7 @@ object ServerConfig { specBuilder.comment("Ender Teleporter ability").push("ender_teleporter") } - val ENERGY_COST by specBuilder.defineImpreciseFraction("energyCost", ImpreciseFraction(4096), ImpreciseFraction.ZERO) + val ENERGY_COST by specBuilder.defineDecimal("energyCost", Decimal(4096), Decimal.ZERO) val COOLDOWN: Int by specBuilder.comment("In ticks").defineInRange("cooldown", 40, 0, Int.MAX_VALUE) val MAX_PHASE_DISTANCE: Int by specBuilder.comment("Determines how much blocks can we 'phase' through to teleport on solid surface").defineInRange("maxPhaseDistance", 6, 0, Int.MAX_VALUE) val MAX_DISTANCE: Double by specBuilder.comment("In blocks, euclidean distance").defineInRange("maxDistance", 12.0, 2.0, Int.MAX_VALUE.toDouble()) @@ -195,7 +192,7 @@ object ServerConfig { specBuilder.comment("Jump boost ability").push("jump_boost") } - val ENERGY_COST by specBuilder.defineImpreciseFraction("energyCost", ImpreciseFraction(1024), ImpreciseFraction.ZERO) + val ENERGY_COST by specBuilder.defineDecimal("energyCost", Decimal(1024), Decimal.ZERO) val POWER: Double by specBuilder.comment("The jump height on jump boost, as (level + 1) of feature, in meters per second").defineInRange("power", 6.0, 0.0, Double.MAX_VALUE) val BASE_COOLDOWN: Int by specBuilder.comment("In ticks").defineInRange("baseCooldown", 40, 0, Int.MAX_VALUE) val COOLDOWN_REDUCTION: Int by specBuilder.comment("In ticks, per level of feature").defineInRange("cooldownReduction", 20, 0, Int.MAX_VALUE) @@ -210,7 +207,7 @@ object ServerConfig { specBuilder.comment("Item magnet ability").push("item_magnet") } - val POWER_DRAW by specBuilder.comment("Per tick per stack").defineImpreciseFraction("powerDraw", ImpreciseFraction(8), ImpreciseFraction.ZERO) + val POWER_DRAW by specBuilder.comment("Per tick per stack").defineDecimal("powerDraw", Decimal(8), Decimal.ZERO) val RADIUS_HORIZONTAL: Double by specBuilder.defineInRange("radiusHorizontal", 6.0, 0.0, Double.MAX_VALUE / 4.0) val RADIUS_VERTICAL: Double by specBuilder.defineInRange("radiusVertical", 3.0, 0.0, Double.MAX_VALUE / 4.0) @@ -236,7 +233,7 @@ object ServerConfig { val BREAK_BLOCKS: Boolean by specBuilder.comment("Break blocks without any blast resistance").define("breakBlocks", true) val DAMAGE: Double by specBuilder.comment("Max potential damage done by shockwave").defineInRange("damage", 12.0, 0.0, Float.MAX_VALUE.toDouble()) val WARDEN_DAMAGE_MULT: Double by specBuilder.defineInRange("wardenDamageMultiplier", 4.0, 0.0, Float.MAX_VALUE.toDouble()) - val ENERGY_COST by specBuilder.defineImpreciseFraction("energyCost", ImpreciseFraction(2048), ImpreciseFraction.ZERO) + val ENERGY_COST by specBuilder.defineDecimal("energyCost", Decimal(2048), Decimal.ZERO) init { specBuilder.pop() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt index 58523e791..f1f9723d9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsArmorFeature.kt @@ -9,7 +9,7 @@ import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.extractEnergyInnerExact -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.registry.AndroidFeatures import ru.dbotthepony.mc.otm.registry.StatNames import ru.dbotthepony.mc.otm.core.set @@ -85,8 +85,8 @@ class NanobotsArmorFeature(android: MatteryPlayerCapability) : AndroidFeature(An } companion object { - private val ENERGY_PER_LAYER = ImpreciseFraction(200) - private val ENERGY_PER_HITPOINT = ImpreciseFraction(500) + private val ENERGY_PER_LAYER = Decimal(200) + private val ENERGY_PER_HITPOINT = Decimal(500) private val TICKS = intArrayOf( 80, // 4 seconds to build a layer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt index d7108cf4c..e2e2b25c1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NanobotsRegenerationFeature.kt @@ -6,7 +6,6 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent import ru.dbotthepony.mc.otm.ServerConfig import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability -import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.registry.AndroidFeatures import ru.dbotthepony.mc.otm.registry.StatNames import ru.dbotthepony.mc.otm.core.set diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/AndroidStationBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/AndroidStationBlockEntity.kt index f0665785d..ec79fb785 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/AndroidStationBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/AndroidStationBlockEntity.kt @@ -13,9 +13,9 @@ import net.minecraft.world.phys.AABB import net.minecraftforge.common.ForgeConfigSpec import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.ImpreciseFractionConfigValue -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.DecimalConfigValue +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.core.ifPresentK import ru.dbotthepony.mc.otm.menu.AndroidStationMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities @@ -35,7 +35,7 @@ class AndroidStationBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : get() = MBlocks.ANDROID_STATION.name override val energy = object : WorkerEnergyStorage(this@AndroidStationBlockEntity::setChangedLight, ::CAPACITY, ::MAX_IO, { null }) { - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return super.extractEnergyInner(howMuch, simulate).also { if (!simulate && this.batteryLevel.isZero) { if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) != WorkerState.IDLE) { @@ -45,7 +45,7 @@ class AndroidStationBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return super.receiveEnergyInner(howMuch, simulate).also { if (!simulate && it.isPositive) { if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) != WorkerState.WORKING) { @@ -84,10 +84,10 @@ class AndroidStationBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val missing = it.androidEnergy.missingPower - if (missing > ImpreciseFraction.ZERO) { + if (missing > Decimal.ZERO) { val extract = energy.extractEnergyInner(missing, true) - if (extract > ImpreciseFraction.ZERO) { + if (extract > Decimal.ZERO) { val received = it.androidEnergy.receiveEnergyOuter(extract, false) energy.extractEnergyInner(received, false) } @@ -97,10 +97,10 @@ class AndroidStationBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } companion object { - private var _CAPACITY: ImpreciseFractionConfigValue by WriteOnce() - private var _MAX_IO: ImpreciseFractionConfigValue by WriteOnce() - private var _ENERGY_PER_OPERATION: ImpreciseFractionConfigValue by WriteOnce() - private var _ENERGY_PER_RESEARCH: ImpreciseFractionConfigValue by WriteOnce() + private var _CAPACITY: DecimalConfigValue by WriteOnce() + private var _MAX_IO: DecimalConfigValue by WriteOnce() + private var _ENERGY_PER_OPERATION: DecimalConfigValue by WriteOnce() + private var _ENERGY_PER_RESEARCH: DecimalConfigValue by WriteOnce() val CAPACITY get() = _CAPACITY.get() val MAX_IO get() = _MAX_IO.get() @@ -110,10 +110,10 @@ class AndroidStationBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.ANDROID_STATION) - _CAPACITY = builder.defineImpreciseFraction("capacity", ImpreciseFraction(100_000), ImpreciseFraction.ONE) - _MAX_IO = builder.defineImpreciseFraction("throughput", ImpreciseFraction.valueOf(2048), ImpreciseFraction.ONE) - _ENERGY_PER_OPERATION = builder.comment("Swapping parts, etc").defineImpreciseFraction("energyPerOperation", ImpreciseFraction.valueOf(2048), ImpreciseFraction.ONE) - _ENERGY_PER_RESEARCH = builder.defineImpreciseFraction("energyPerResearch", ImpreciseFraction.valueOf(16384), ImpreciseFraction.ONE) + _CAPACITY = builder.defineDecimal("capacity", Decimal(100_000), Decimal.ONE) + _MAX_IO = builder.defineDecimal("throughput", Decimal.valueOf(2048), Decimal.ONE) + _ENERGY_PER_OPERATION = builder.comment("Swapping parts, etc").defineDecimal("energyPerOperation", Decimal.valueOf(2048), Decimal.ONE) + _ENERGY_PER_RESEARCH = builder.defineDecimal("energyPerResearch", Decimal.valueOf(16384), Decimal.ONE) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BatteryBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BatteryBankBlockEntity.kt index f1c1335d9..b33e3f97c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BatteryBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BatteryBankBlockEntity.kt @@ -69,30 +69,30 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte } ) - private data class BatteryBankDistribution(val distribution: Array, val maxThroughput: ImpreciseFraction) + private data class BatteryBankDistribution(val distribution: Array, val maxThroughput: Decimal) private enum class BankMode { RECEIVE, EXTRACT, BIDIRECTIONAL } private inner class BatteryBankEnergy(private val mode: BankMode) : IMatteryEnergyStorage { override fun canExtract() = mode != BankMode.RECEIVE override fun canReceive() = mode != BankMode.EXTRACT - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (mode == BankMode.RECEIVE) - return ImpreciseFraction.ZERO + return Decimal.ZERO return extractEnergyInner(howMuch, simulate) } fun getDistribution(isReceiving: Boolean): BatteryBankDistribution { - val distribution = Array(container.containerSize) { ImpreciseFraction.ZERO } - var summ = ImpreciseFraction.ZERO + val distribution = Array(container.containerSize) { Decimal.ZERO } + var summ = Decimal.ZERO for (i in 0 until container.containerSize) { val stack = container.getItem(i) if (!stack.isEmpty) { stack.energy?.let { - val diff: ImpreciseFraction + val diff: Decimal if (isReceiving) { diff = it.receiveEnergy(it.maxEnergyStoredMattery, true) @@ -115,17 +115,17 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte return BatteryBankDistribution(distribution, summ) } - private fun distributeEnergy(isReceiving: Boolean, howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + private fun distributeEnergy(isReceiving: Boolean, howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO val distribution = getDistribution(isReceiving) if (distribution.maxThroughput.isZero) - return ImpreciseFraction.ZERO + return Decimal.ZERO val distList = distribution.distribution - var summ = ImpreciseFraction.ZERO + var summ = Decimal.ZERO for (i in 0 until container.containerSize) { if (!distList[i].isZero) { @@ -133,7 +133,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte if (!stack.isEmpty) { stack.energy?.let { - val diff: ImpreciseFraction + val diff: Decimal if (isReceiving) { diff = it.receiveEnergy(howMuch * distList[i], simulate) @@ -155,23 +155,23 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte return summ } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return distributeEnergy(isReceiving = false, howMuch, simulate) } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (mode == BankMode.EXTRACT) - return ImpreciseFraction.ZERO + return Decimal.ZERO return receiveEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return distributeEnergy(isReceiving = true, howMuch, simulate) } - override val batteryLevel: ImpreciseFraction get() { - var result = ImpreciseFraction.ZERO + override val batteryLevel: Decimal get() { + var result = Decimal.ZERO for (i in 0 until container.containerSize) { val stack = container.getItem(i) @@ -186,8 +186,8 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte return result } - override val maxBatteryLevel: ImpreciseFraction get() { - var result = ImpreciseFraction.ZERO + override val maxBatteryLevel: Decimal get() { + var result = Decimal.ZERO for (i in 0 until container.containerSize) { val stack = container.getItem(i) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/ChemicalGeneratorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/ChemicalGeneratorBlockEntity.kt index 78ecd2422..612303fda 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/ChemicalGeneratorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/ChemicalGeneratorBlockEntity.kt @@ -195,7 +195,7 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryBl val residue = container[SLOT_INPUT].item.getCraftingRemainingItem(container[SLOT_INPUT].copy().also { it.count = 1 }) val canPutResidue = residue.isEmpty || container[SLOT_RESIDUE].isEmpty || ItemStack.isSameItemSameTags(container[SLOT_RESIDUE], residue) && container[SLOT_RESIDUE].count < container[2].maxStackSize - if (canPutResidue && ticks >= 4 && (energy.batteryLevel < ImpreciseFraction.ONE || GENERATION_SPEED * (ticks / 4) + energy.batteryLevel <= energy.maxBatteryLevel)) { + if (canPutResidue && ticks >= 4 && (energy.batteryLevel < Decimal.ONE || GENERATION_SPEED * (ticks / 4) + energy.batteryLevel <= energy.maxBatteryLevel)) { workTicksTotal = ticks / 4 workTicks = ticks / 4 container[SLOT_INPUT].shrink(1) @@ -235,9 +235,9 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryBl private val CAPACITY get() = _CAPACITY.get() private val MACHINE_NAME = TranslatableComponent("block.overdrive_that_matters.chemical_generator") - private var _THROUGHPUT: ImpreciseFractionConfigValue by WriteOnce() - private var _GENERATION_SPEED: ImpreciseFractionConfigValue by WriteOnce() - private var _CAPACITY: ImpreciseFractionConfigValue by WriteOnce() + private var _THROUGHPUT: DecimalConfigValue by WriteOnce() + private var _GENERATION_SPEED: DecimalConfigValue by WriteOnce() + private var _CAPACITY: DecimalConfigValue by WriteOnce() const val SLOT_INPUT = 0 const val SLOT_BATTERY = 1 @@ -247,9 +247,9 @@ class ChemicalGeneratorBlockEntity(pos: BlockPos, state: BlockState) : MatteryBl fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.CHEMICAL_GENERATOR) - _THROUGHPUT = builder.defineImpreciseFraction("throughput", ImpreciseFraction(160), ImpreciseFraction.ONE) - _GENERATION_SPEED = builder.defineImpreciseFraction("generationSpeed", ImpreciseFraction(40), ImpreciseFraction.ONE) - _CAPACITY = builder.defineImpreciseFraction("capacity", ImpreciseFraction(24_000), ImpreciseFraction.ONE) + _THROUGHPUT = builder.defineDecimal("throughput", Decimal(160), Decimal.ONE) + _GENERATION_SPEED = builder.defineDecimal("generationSpeed", Decimal(40), Decimal.ONE) + _CAPACITY = builder.defineDecimal("capacity", Decimal(24_000), Decimal.ONE) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt index 94de468df..5a4d9f90b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt @@ -29,25 +29,25 @@ import java.util.* class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.ENERGY_COUNTER, p_155229_, p_155230_) { var passed by synchronizer.fraction() - private val history = Array(10 * 20) { ImpreciseFraction.ZERO } + private val history = Array(10 * 20) { Decimal.ZERO } internal var historyTick = 0 var lastTick by synchronizer.fraction() internal set - var ioLimit: ImpreciseFraction? = null + var ioLimit: Decimal? = null fun resetStats() { historyTick = 0 - lastTick = ImpreciseFraction.ZERO - passed = ImpreciseFraction.ZERO - Arrays.fill(history, ImpreciseFraction.ZERO) + lastTick = Decimal.ZERO + passed = Decimal.ZERO + Arrays.fill(history, Decimal.ZERO) } - fun getHistory(ticks: Int): Array { + fun getHistory(ticks: Int): Array { require(!(ticks < 1 || ticks >= history.size)) { "Invalid history length provided" } - val history = Array(ticks) { ImpreciseFraction.ZERO } + val history = Array(ticks) { Decimal.ZERO } for (i in 0 until ticks) { var index = (historyTick - i) % this.history.size @@ -58,14 +58,14 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return history } - fun calcAverage(ticks: Int): ImpreciseFraction { + fun calcAverage(ticks: Int): Decimal { return sumHistory(ticks) / ticks } - fun sumHistory(ticks: Int): ImpreciseFraction { + fun sumHistory(ticks: Int): Decimal { require(!(ticks < 1 || ticks >= history.size)) { "Invalid history length provided" } - var value = ImpreciseFraction.ZERO + var value = Decimal.ZERO for (i in 0 until ticks) { var index = (historyTick - i) % history.size @@ -93,17 +93,17 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat override fun load(nbt: CompoundTag) { super.load(nbt) - passed = nbt.getImpreciseFraction(PASSED_ENERGY_KEY) - ioLimit = nbt.map(IO_LIMIT_KEY, ImpreciseFraction.Companion::deserializeNBT) + passed = nbt.getDecimal(PASSED_ENERGY_KEY) + ioLimit = nbt.map(IO_LIMIT_KEY, Decimal.Companion::deserializeNBT) nbt.ifHas(POWER_HISTORY_POINTER_KEY, IntTag::class.java) { historyTick = it.asInt } - Arrays.fill(history, ImpreciseFraction.ZERO) + Arrays.fill(history, Decimal.ZERO) for ((i, bytes) in nbt.getByteArrayList(POWER_HISTORY_KEY).withIndex()) { - history[i] = ImpreciseFraction.deserializeNBT(bytes) + history[i] = Decimal.deserializeNBT(bytes) } } @@ -126,18 +126,18 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat } private inner class EnergyCounterCap(val isInput: Boolean) : IMatteryEnergyStorage { - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return extractEnergyInner(howMuch, simulate) } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (isInput) - return ImpreciseFraction.ZERO + return Decimal.ZERO if (inputCapability.isPresent) { val it = inputCapability.resolve().get() - val diff: ImpreciseFraction + val diff: Decimal val ioLimit = ioLimit @@ -155,21 +155,21 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return diff } - return ImpreciseFraction.ZERO + return Decimal.ZERO } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!isInput) - return ImpreciseFraction.ZERO + return Decimal.ZERO if (outputCapability.isPresent) { val it = outputCapability.resolve().get() - val diff: ImpreciseFraction + val diff: Decimal val ioLimit = ioLimit @@ -187,10 +187,10 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return diff } - return ImpreciseFraction.ZERO + return Decimal.ZERO } - override val batteryLevel: ImpreciseFraction + override val batteryLevel: Decimal get() { if (isInput) { if (outputCapability.isPresent) { @@ -200,7 +200,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.batteryLevel } - return ImpreciseFraction(it.energyStored) + return Decimal(it.energyStored) } } else { if (inputCapability.isPresent) { @@ -210,14 +210,14 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.batteryLevel } - return ImpreciseFraction(it.energyStored) + return Decimal(it.energyStored) } } - return ImpreciseFraction.ZERO + return Decimal.ZERO } - override val maxBatteryLevel: ImpreciseFraction + override val maxBatteryLevel: Decimal get() { if (isInput) { if (outputCapability.isPresent) { @@ -227,7 +227,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.maxBatteryLevel } - return ImpreciseFraction(it.maxEnergyStored) + return Decimal(it.maxEnergyStored) } } else { if (inputCapability.isPresent) { @@ -237,14 +237,14 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.maxBatteryLevel } - return ImpreciseFraction(it.maxEnergyStored) + return Decimal(it.maxEnergyStored) } } - return ImpreciseFraction.ZERO + return Decimal.ZERO } - override val missingPower: ImpreciseFraction + override val missingPower: Decimal get() { if (isInput) { if (outputCapability.isPresent) { @@ -254,7 +254,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.missingPower } - return ImpreciseFraction((it.maxEnergyStored - it.energyStored).coerceAtLeast(0)) + return Decimal((it.maxEnergyStored - it.energyStored).coerceAtLeast(0)) } } else { if (inputCapability.isPresent) { @@ -264,11 +264,11 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat return it.missingPower } - return ImpreciseFraction((it.maxEnergyStored - it.energyStored).coerceAtLeast(0)) + return Decimal((it.maxEnergyStored - it.energyStored).coerceAtLeast(0)) } } - return ImpreciseFraction.ZERO + return Decimal.ZERO } override fun canExtract() = !isInput @@ -394,7 +394,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat fun tick() { lastTick = history[historyTick] historyTick = (historyTick + 1) % history.size - history[historyTick] = ImpreciseFraction.ZERO + history[historyTick] = Decimal.ZERO } fun clientTick() { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyServoBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyServoBlockEntity.kt index ee23dad42..6be52e29e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyServoBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyServoBlockEntity.kt @@ -23,7 +23,7 @@ import ru.dbotthepony.mc.otm.capability.maxEnergyStoredMattery import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainerHooks -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.menu.EnergyServoMenu @@ -58,27 +58,27 @@ class EnergyServoBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte }) val energy = object : IMatteryEnergyStorage { - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return extractEnergyInner(howMuch, simulate) } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - return container[SLOT_DISCHARGE].energy?.extractEnergy(howMuch, simulate) ?: ImpreciseFraction.ZERO + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { + return container[SLOT_DISCHARGE].energy?.extractEnergy(howMuch, simulate) ?: Decimal.ZERO } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - return container[SLOT_CHARGE].energy?.receiveEnergy(howMuch, simulate) ?: ImpreciseFraction.ZERO + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { + return container[SLOT_CHARGE].energy?.receiveEnergy(howMuch, simulate) ?: Decimal.ZERO } - override val batteryLevel: ImpreciseFraction - get() = container[SLOT_CHARGE].energy?.energyStoredMattery ?: container[SLOT_DISCHARGE].energy?.energyStoredMattery ?: ImpreciseFraction.ZERO + override val batteryLevel: Decimal + get() = container[SLOT_CHARGE].energy?.energyStoredMattery ?: container[SLOT_DISCHARGE].energy?.energyStoredMattery ?: Decimal.ZERO - override val maxBatteryLevel: ImpreciseFraction - get() = container[SLOT_CHARGE].energy?.maxEnergyStoredMattery ?: container[SLOT_DISCHARGE].energy?.maxEnergyStoredMattery ?: ImpreciseFraction.ZERO + override val maxBatteryLevel: Decimal + get() = container[SLOT_CHARGE].energy?.maxEnergyStoredMattery ?: container[SLOT_DISCHARGE].energy?.maxEnergyStoredMattery ?: Decimal.ZERO } private var resolverEnergy = LazyOptional.of { energy } @@ -132,7 +132,7 @@ class EnergyServoBlockEntity(blockPos: BlockPos, blockState: BlockState) : Matte val chargeEnergy = charge.energy ?: return val dischargeEnergy = discharge.energy ?: return - val extracted = dischargeEnergy.extractEnergy(ImpreciseFraction.LONG_MAX_VALUE, true) + val extracted = dischargeEnergy.extractEnergy(Decimal.LONG_MAX_VALUE, true) if (extracted.isPositive) { val received = chargeEnergy.receiveEnergy(extracted, true) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt index 668e48172..4200a73ad 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt @@ -4,7 +4,6 @@ import net.minecraft.ChatFormatting import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.nbt.CompoundTag -import net.minecraft.nbt.ListTag import net.minecraft.network.chat.Component import net.minecraft.world.item.BlockItem import net.minecraft.world.item.ItemStack @@ -17,10 +16,9 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities import net.minecraftforge.common.util.LazyOptional import ru.dbotthepony.mc.otm.capability.* import ru.dbotthepony.mc.otm.container.MatteryContainer -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.ifHas import ru.dbotthepony.mc.otm.core.ifPresentK -import ru.dbotthepony.mc.otm.container.set import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.core.set @@ -61,7 +59,7 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229 } } - if (demand <= ImpreciseFraction.ZERO) + if (demand <= Decimal.ZERO) return } } @@ -111,4 +109,4 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229 } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt index 459bb0239..f37d6dc87 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt @@ -24,11 +24,11 @@ abstract class MatteryWorkerBlockEntity( ) : MatteryPoweredBlockEntity(type, blockPos, blockState) { open class Job { open val ticks: Double - open val powerUsage: ImpreciseFraction + open val powerUsage: Decimal constructor( ticks: Double, - powerUsage: ImpreciseFraction = ImpreciseFraction.ZERO + powerUsage: Decimal = Decimal.ZERO ) { this.ticks = ticks this.powerUsage = powerUsage @@ -36,7 +36,7 @@ abstract class MatteryWorkerBlockEntity( constructor( tag: CompoundTag - ) : this(tag.getDouble(TICKS_KEY), tag.getImpreciseFraction(POWER_KEY)) + ) : this(tag.getDouble(TICKS_KEY), tag.getDecimal(POWER_KEY)) open fun serializeNBT(): CompoundTag { return CompoundTag().also { @@ -58,7 +58,7 @@ abstract class MatteryWorkerBlockEntity( constructor( itemStack: ItemStack, ticks: Double, - power: ImpreciseFraction = ImpreciseFraction.ZERO + power: Decimal = Decimal.ZERO ) : super(ticks, power) { this.itemStack = itemStack } @@ -95,7 +95,7 @@ abstract class MatteryWorkerBlockEntity( val success: Boolean, val throttleTicks: Int = 0, val idleReason: IdleReason? = null, - val newDrainedPower: ImpreciseFraction? = null + val newDrainedPower: Decimal? = null ) { companion object { val SUCCESS = Status(true) @@ -206,7 +206,7 @@ abstract class MatteryWorkerBlockEntity( */ protected abstract fun computeNextJob(): Pair - protected open fun onWorkTick(requiredPower: ImpreciseFraction, extractedPower: ImpreciseFraction, ticksAdvanced: Double, job: JobType): Status { + protected open fun onWorkTick(requiredPower: Decimal, extractedPower: Decimal, ticksAdvanced: Double, job: JobType): Status { return Status.SUCCESS } @@ -296,8 +296,8 @@ abstract class MatteryWorkerBlockEntity( val ticksLeft = currentJob.ticks - workTicks val ticksAdvanced: Double - var requiredPower: ImpreciseFraction? = null - var extractedPower: ImpreciseFraction? = null + var requiredPower: Decimal? = null + var extractedPower: Decimal? = null if (currentJob.powerUsage.isZero) { ticksAdvanced = availableTicks.coerceAtMost(ticksLeft) @@ -311,7 +311,7 @@ abstract class MatteryWorkerBlockEntity( break } - val status = onWorkTick(requiredPower ?: ImpreciseFraction.ZERO, extractedPower ?: ImpreciseFraction.ZERO, ticksAdvanced, currentJob) + val status = onWorkTick(requiredPower ?: Decimal.ZERO, extractedPower ?: Decimal.ZERO, ticksAdvanced, currentJob) if (!status.success) { throttleTicks += status.throttleTicks diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PlatePressBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PlatePressBlockEntity.kt index c283f6a06..d64a5e533 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PlatePressBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PlatePressBlockEntity.kt @@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainerHooks -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.menu.PlatePressMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MRecipes @@ -100,7 +100,7 @@ class PlatePressBlockEntity( } companion object { - private val BASELINE_CONSUMPTION = ImpreciseFraction(15) + private val BASELINE_CONSUMPTION = Decimal(15) private val MACHINE_NAME = TranslatableComponent("block.overdrive_that_matters.plate_press") const val SLOT_INPUT = 0 const val SLOT_OUTPUT = 1 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt index b260e88c8..9cc7d00f4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt @@ -22,7 +22,7 @@ import ru.dbotthepony.mc.otm.block.BlackHoleBlock import ru.dbotthepony.mc.otm.block.entity.GravitationStabilizerBlockEntity import ru.dbotthepony.mc.otm.block.entity.SynchronizedBlockEntity import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MItems @@ -39,7 +39,7 @@ import kotlin.math.sqrt class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : SynchronizedBlockEntity(MBlockEntities.BLACK_HOLE, p_155229_, p_155230_) { var mass by synchronizer.fraction(BASELINE_MASS, setter = setter@{ mass, field, setByRemote -> - if (mass <= ImpreciseFraction.ZERO) { + if (mass <= Decimal.ZERO) { collapse() return@setter } @@ -164,7 +164,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Synchro override fun load(tag: CompoundTag) { super.load(tag) - mass = tag.mapIf("mass", ImpreciseFraction::deserializeNBT) ?: BASELINE_MASS + mass = tag.mapIf("mass", Decimal::deserializeNBT) ?: BASELINE_MASS spinDirection = tag.getBoolean("spin_direction") } @@ -327,7 +327,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Synchro companion object { const val ITERATIONS = 30_000 - val BASELINE_MASS = ImpreciseFraction(50_000) - val HAWKING_MASS_LOSE_STEP = ImpreciseFraction(-100) + val BASELINE_MASS = Decimal(50_000) + val HAWKING_MASS_LOSE_STEP = Decimal(-100) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt index d5d5a184a..dbe384158 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterBottlerBlockEntity.kt @@ -120,7 +120,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } } - private var initialCapacity: ImpreciseFraction? = null + private var initialCapacity: Decimal? = null private var lastWorkStack: ItemStack? = null override fun getMatterHandler(): IMatterHandler { @@ -195,18 +195,18 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val cap = lastWorkStack.getCapability(MatteryCapability.MATTER).orNull() ?: return 0f if (this.isBottling) { - if (cap.maxStoredMatter - initialCapacity <= ImpreciseFraction.ZERO) { + if (cap.maxStoredMatter - initialCapacity <= Decimal.ZERO) { return 0f } return ((cap.storedMatter - initialCapacity) / (cap.maxStoredMatter - initialCapacity)).toFloat() } - if (initialCapacity <= ImpreciseFraction.ZERO) { + if (initialCapacity <= Decimal.ZERO) { return 0f } - return (ImpreciseFraction.ONE - cap.storedMatter / initialCapacity).toFloat() + return (Decimal.ONE - cap.storedMatter / initialCapacity).toFloat() } override fun setRemoved() { @@ -242,7 +242,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val cap = itemStack.getCapability(MatteryCapability.MATTER).orNull() ?: continue if (cap.direction !== unexpectedDirection) { - if (this.isBottling && cap.missingMatter > ImpreciseFraction.ZERO || !this.isBottling && cap.storedMatter > ImpreciseFraction.ZERO) { + if (this.isBottling && cap.missingMatter > Decimal.ZERO || !this.isBottling && cap.storedMatter > Decimal.ZERO) { work_stack = itemStack capability = cap work_slot = i @@ -273,13 +273,13 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : matter.missingMatter.coerceAtMost(MATTER_EXCHANGE_RATE * EXTRACTION_TICKS).coerceAtMost(capability.missingMatter - matter.storedMatter), true ) - if (extracted > ImpreciseFraction.ZERO) { + if (extracted > Decimal.ZERO) { val received = matter.receiveMatterOuter(extracted, false) graph.extractMatter(received, false) } } - if (matter.storedMatter > ImpreciseFraction.ZERO) { + if (matter.storedMatter > Decimal.ZERO) { val energyExtracted = energy.extractEnergyInner(ENERGY_CONSUMPTION, true) if (!energyExtracted.isZero) { @@ -345,10 +345,10 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val EXTRACTION_TICKS get() = _EXTRACTION_TICKS.get() val CAPACITY get() = _CAPACITY.get() - private var _MATTER_EXCHANGE_RATE: ImpreciseFractionConfigValue by WriteOnce() - private var _ENERGY_CONSUMPTION: ImpreciseFractionConfigValue by WriteOnce() - private var _EXTRACTION_TICKS: ImpreciseFractionConfigValue by WriteOnce() - private var _CAPACITY: ImpreciseFractionConfigValue by WriteOnce() + private var _MATTER_EXCHANGE_RATE: DecimalConfigValue by WriteOnce() + private var _ENERGY_CONSUMPTION: DecimalConfigValue by WriteOnce() + private var _EXTRACTION_TICKS: DecimalConfigValue by WriteOnce() + private var _CAPACITY: DecimalConfigValue by WriteOnce() var ENERGY_VALUES: ConciseBalanceValues by WriteOnce() private set @@ -358,10 +358,10 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder) - _MATTER_EXCHANGE_RATE = builder.defineImpreciseFraction("matterExchangeRate", ImpreciseFraction("0.04"), ImpreciseFraction("0.0001")) - _ENERGY_CONSUMPTION = builder.defineImpreciseFraction("energyConsumption", ImpreciseFraction(20), ImpreciseFraction.ONE) - _EXTRACTION_TICKS = builder.defineImpreciseFraction("extractionTicks", ImpreciseFraction(200), ImpreciseFraction.ONE) - _CAPACITY = builder.defineImpreciseFraction("matterCapacity", ImpreciseFraction(4_000), ImpreciseFraction.ONE_TENTH) + _MATTER_EXCHANGE_RATE = builder.defineDecimal("matterExchangeRate", Decimal("0.04"), Decimal("0.0001")) + _ENERGY_CONSUMPTION = builder.defineDecimal("energyConsumption", Decimal(20), Decimal.ONE) + _EXTRACTION_TICKS = builder.defineDecimal("extractionTicks", Decimal(200), Decimal.ONE) + _CAPACITY = builder.defineDecimal("matterCapacity", Decimal(4_000), Decimal.ONE_TENTH) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt index 7cb4d5a03..73d01b49b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.block.entity.matter -import net.minecraft.MethodsReturnNonnullByDefault import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.nbt.CompoundTag @@ -24,16 +23,14 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler import ru.dbotthepony.mc.otm.capability.matter.MatterDirection import ru.dbotthepony.mc.otm.container.MatteryContainer -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph import ru.dbotthepony.mc.otm.menu.MatterCapacitorBankMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities -import ru.dbotthepony.mc.otm.container.set import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.core.set -import javax.annotation.ParametersAreNonnullByDefault class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler, IDroppableContainer { var gaugeLevel by synchronizer.float() @@ -42,8 +39,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) override val matterNode = Graph6Node(this) private val resolverNode = LazyOptional.of { this } - override val storedMatter: ImpreciseFraction get() { - var summ = ImpreciseFraction.ZERO + override val storedMatter: Decimal get() { + var summ = Decimal.ZERO for (stack in container) if (!stack.isEmpty) @@ -54,8 +51,8 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) return summ } - override val maxStoredMatter: ImpreciseFraction get() { - var summ = ImpreciseFraction.ZERO + override val maxStoredMatter: Decimal get() { + var summ = Decimal.ZERO for (stack in container) if (!stack.isEmpty) @@ -66,17 +63,17 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) return summ } - override fun receiveMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveMatterInner(howMuch, simulate) } - override fun receiveMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch - var summ = ImpreciseFraction.ZERO + var summ = Decimal.ZERO for (stack in container) { if (!stack.isEmpty) { @@ -99,17 +96,17 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) return summ } - override fun extractMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { return extractMatterInner(howMuch, simulate) } - override fun extractMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch - var summ = ImpreciseFraction.ZERO + var summ = Decimal.ZERO for (stack in container) { if (!stack.isEmpty) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt index c65eba653..e691f44ad 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterDecomposerBlockEntity.kt @@ -41,11 +41,11 @@ import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.core.WriteOnce import ru.dbotthepony.mc.otm.matter.MatterManager -fun moveMatterAsDustIntoContainer(_matterValue: ImpreciseFraction, container: MatteryContainer, OUTPUT_DUST_MAIN: Int, OUTPUT_DUST_STACKING: Int): ImpreciseFraction { +fun moveMatterAsDustIntoContainer(_matterValue: Decimal, container: MatteryContainer, OUTPUT_DUST_MAIN: Int, OUTPUT_DUST_STACKING: Int): Decimal { var matterValue = _matterValue val item = MItems.MATTER_DUST as MatterDustItem - while (matterValue > ImpreciseFraction.ZERO) { + while (matterValue > Decimal.ZERO) { val stack = container[OUTPUT_DUST_MAIN] // первый слот пустой @@ -91,7 +91,7 @@ fun moveMatterAsDustIntoContainer(_matterValue: ImpreciseFraction, container: Ma } } - return ImpreciseFraction.ZERO + return Decimal.ZERO } class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) @@ -99,14 +99,14 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) class DecomposerJob : Job { val toDust: Boolean - var matterValue: ImpreciseFraction + var matterValue: Decimal constructor(tag: CompoundTag) : super(tag) { toDust = tag.getBoolean(TO_DUST_KEY) - matterValue = tag.getImpreciseFraction(MATTER_VALUE_KEY) + matterValue = tag.getDecimal(MATTER_VALUE_KEY) } - constructor(toDust: Boolean, matterValue: ImpreciseFraction, ticks: Double) : super(ticks, BASE_CONSUMPTION) { + constructor(toDust: Boolean, matterValue: Decimal, ticks: Double) : super(ticks, BASE_CONSUMPTION) { this.toDust = toDust this.matterValue = matterValue } @@ -269,8 +269,8 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) val CAPACITY get() = _CAPACITY.get() val BASE_CONSUMPTION get() = _BASE_CONSUMPTION.get() - private var _CAPACITY: ImpreciseFractionConfigValue by WriteOnce() - private var _BASE_CONSUMPTION: ImpreciseFractionConfigValue by WriteOnce() + private var _CAPACITY: DecimalConfigValue by WriteOnce() + private var _BASE_CONSUMPTION: DecimalConfigValue by WriteOnce() var ENERGY_VALUES: ConciseBalanceValues by WriteOnce() private set @@ -278,10 +278,10 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.MATTER_DECOMPOSER) - ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = ImpreciseFraction(400_000), throughput = ImpreciseFraction(2_000)) + ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = Decimal(400_000), throughput = Decimal(2_000)) - _CAPACITY = builder.defineImpreciseFraction("matterCapacity", ImpreciseFraction(20_000), ImpreciseFraction.ONE_TENTH) - _BASE_CONSUMPTION = builder.defineImpreciseFraction("baseConsumption", ImpreciseFraction(240), ImpreciseFraction.ONE) + _CAPACITY = builder.defineDecimal("matterCapacity", Decimal(20_000), Decimal.ONE_TENTH) + _BASE_CONSUMPTION = builder.defineDecimal("baseConsumption", Decimal(240), Decimal.ONE) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt index 0a6966dcf..dab3fded8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterRecyclerBlockEntity.kt @@ -28,7 +28,7 @@ import ru.dbotthepony.mc.otm.capability.matter.MatterDirection import ru.dbotthepony.mc.otm.capability.matter.MatterHandlerImpl import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainerHooks -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph @@ -36,30 +36,30 @@ import ru.dbotthepony.mc.otm.item.MatterDustItem import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.menu.MatterRecyclerMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities -import ru.dbotthepony.mc.otm.core.ImpreciseFractionConfigValue -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.DecimalConfigValue +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.core.WriteOnce -import ru.dbotthepony.mc.otm.core.getImpreciseFraction +import ru.dbotthepony.mc.otm.core.getDecimal class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryWorkerBlockEntity(MBlockEntities.MATTER_RECYCLER, blockPos, blockState, ::RecyclerJob), IMatterGraphNode, IDroppableContainer { class RecyclerJob : Job { - var totalMatter: ImpreciseFraction + var totalMatter: Decimal constructor( ticks: Double, - powerUsage: ImpreciseFraction, - totalMatter: ImpreciseFraction + powerUsage: Decimal, + totalMatter: Decimal ) : super(ticks, powerUsage) { this.totalMatter = totalMatter } constructor(tag: CompoundTag) : super(tag) { - this.totalMatter = tag.getImpreciseFraction(KEY) + this.totalMatter = tag.getDecimal(KEY) } override fun serializeNBT(): CompoundTag { @@ -180,7 +180,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) return RecyclerJob(dustMatter.matter.toDouble() * TICKS_PER_MATTER, POWER_CONSUMPTION, dustMatter.matter * (0.4 + level!!.random.nextDouble() * 0.6)) to null } - override fun onWorkTick(requiredPower: ImpreciseFraction, extractedPower: ImpreciseFraction, ticksAdvanced: Double, job: RecyclerJob): Status { + override fun onWorkTick(requiredPower: Decimal, extractedPower: Decimal, ticksAdvanced: Double, job: RecyclerJob): Status { val receive = job.totalMatter / job.ticks if (receive.isZero) @@ -208,8 +208,8 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) } companion object { - private var _CAPACITY: ImpreciseFractionConfigValue by WriteOnce() - private var _POWER_CONSUMPTION: ImpreciseFractionConfigValue by WriteOnce() + private var _CAPACITY: DecimalConfigValue by WriteOnce() + private var _POWER_CONSUMPTION: DecimalConfigValue by WriteOnce() private var _TICKS_PER_MATTER: ConfigValue by WriteOnce() var ENERGY_CONFIG: ConciseBalanceValues by WriteOnce() @@ -222,10 +222,10 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.MATTER_RECYCLER) - ENERGY_CONFIG = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = ImpreciseFraction(80_000)) + ENERGY_CONFIG = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = Decimal(80_000)) - _CAPACITY = builder.defineImpreciseFraction("matterCapacity", ImpreciseFraction(2_000), ImpreciseFraction.ONE) - _POWER_CONSUMPTION = builder.defineImpreciseFraction("powerConsumption", ImpreciseFraction(80), ImpreciseFraction.ONE) + _CAPACITY = builder.defineDecimal("matterCapacity", Decimal(2_000), Decimal.ONE) + _POWER_CONSUMPTION = builder.defineDecimal("powerConsumption", Decimal(80), Decimal.ONE) _TICKS_PER_MATTER = builder.define("ticksPerMatter", 2.0) builder.pop() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt index b2259c32a..ca1961477 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt @@ -46,15 +46,15 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : }), IMatterGraphNode, IDroppableContainer { class ReplicatorJob : ItemJob { - val matterPerTick: ImpreciseFraction + val matterPerTick: Decimal val task: ReplicationTask - var matterValue: ImpreciseFraction + var matterValue: Decimal val pattern: PatternState? val asDust: Boolean constructor(tag: CompoundTag) : super(tag) { - matterPerTick = tag.getImpreciseFraction(MATTER_PER_TICK_KEY) - matterValue = tag.getImpreciseFraction(MATTER_VALUE_KEY) + matterPerTick = tag.getDecimal(MATTER_PER_TICK_KEY) + matterValue = tag.getDecimal(MATTER_VALUE_KEY) pattern = tag.map(PATTERN_KEY, PatternState::deserializeNBT) asDust = tag.getBoolean(AS_DUST_KEY) task = tag.map(TASK_KEY, ReplicationTask::deserializeNBT) ?: throw NoSuchElementException("Unable to deserialize matter task") @@ -62,9 +62,9 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : constructor( itemStack: ItemStack, - matterPerTick: ImpreciseFraction, + matterPerTick: Decimal, task: ReplicationTask, - matterValue: ImpreciseFraction, + matterValue: Decimal, pattern: PatternState?, asDust: Boolean, ticks: Double, @@ -212,7 +212,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : ) to null } - override fun onWorkTick(requiredPower: ImpreciseFraction, extractedPower: ImpreciseFraction, ticksAdvanced: Double, job: ReplicatorJob): Status { + override fun onWorkTick(requiredPower: Decimal, extractedPower: Decimal, ticksAdvanced: Double, job: ReplicatorJob): Status { val drainPerTick = currentJob!!.matterPerTick * ticksAdvanced val graph = matterNode.graph as MatterNetworkGraph? ?: return Status.FAILURE_WAIT_FAST @@ -303,9 +303,9 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : private val DRAIN_MULT get() = _DRAIN_MULT.get() private val MATTER_CAPACITY get() = _MATTER_CAPACITY.get() - private var _BASE_CONSUMPTION: ImpreciseFractionConfigValue by WriteOnce() - private var _DRAIN_MULT: ImpreciseFractionConfigValue by WriteOnce() - private var _MATTER_CAPACITY: ImpreciseFractionConfigValue by WriteOnce() + private var _BASE_CONSUMPTION: DecimalConfigValue by WriteOnce() + private var _DRAIN_MULT: DecimalConfigValue by WriteOnce() + private var _MATTER_CAPACITY: DecimalConfigValue by WriteOnce() var ENERGY_VALUES: ConciseBalanceValues by WriteOnce() private set @@ -313,11 +313,11 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.MATTER_REPLICATOR) - ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = ImpreciseFraction(200_000), throughput = ImpreciseFraction(4_000)) + ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = Decimal(200_000), throughput = Decimal(4_000)) - _BASE_CONSUMPTION = builder.defineImpreciseFraction("basePowerConsumption", ImpreciseFraction(400), ImpreciseFraction.ONE) - _DRAIN_MULT = builder.comment("How much 'ticks' of replication should replicator drain matter from network when running low on internal matter buffer. This is ultimately a performance value.").defineImpreciseFraction("drainMultiplier", ImpreciseFraction(200), ImpreciseFraction.ONE) - _MATTER_CAPACITY = builder.defineImpreciseFraction("matterCapacity", ImpreciseFraction(400), ImpreciseFraction.ONE_TENTH) + _BASE_CONSUMPTION = builder.defineDecimal("basePowerConsumption", Decimal(400), Decimal.ONE) + _DRAIN_MULT = builder.comment("How much 'ticks' of replication should replicator drain matter from network when running low on internal matter buffer. This is ultimately a performance value.").defineDecimal("drainMultiplier", Decimal(200), Decimal.ONE) + _MATTER_CAPACITY = builder.defineDecimal("matterCapacity", Decimal(400), Decimal.ONE_TENTH) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt index 00242aee7..b9bb50646 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt @@ -26,9 +26,9 @@ import ru.dbotthepony.mc.otm.capability.matter.IPatternState import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainerHooks -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.ImpreciseFractionConfigValue -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.DecimalConfigValue +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.graph.Graph6Node import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode @@ -216,15 +216,15 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : companion object { private val BASE_CONSUMPTION get() = _BASE_CONSUMPTION.get() - private var _BASE_CONSUMPTION: ImpreciseFractionConfigValue by WriteOnce() + private var _BASE_CONSUMPTION: DecimalConfigValue by WriteOnce() var ENERGY_VALUES: ConciseBalanceValues by WriteOnce() private set fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.push(MNames.MATTER_SCANNER) - ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = ImpreciseFraction(80_000), throughput = ImpreciseFraction(400)) - _BASE_CONSUMPTION = builder.defineImpreciseFraction("baseConsumption", ImpreciseFraction(40), ImpreciseFraction.ONE) + ENERGY_VALUES = BlockEnergyStorageImpl.makeConfigEntry(builder, capacity = Decimal(80_000), throughput = Decimal(400)) + _BASE_CONSUMPTION = builder.defineDecimal("baseConsumption", Decimal(40), Decimal.ONE) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt index d51dacf3e..4ab254faa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/DriveRackBlockEntity.kt @@ -14,13 +14,11 @@ import net.minecraft.world.level.block.state.BlockState import net.minecraftforge.common.capabilities.Capability import net.minecraftforge.common.util.LazyOptional import ru.dbotthepony.mc.otm.ServerConfig -import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.container.MatteryContainer -import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.menu.DriveRackMenu import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.core.set @@ -102,4 +100,4 @@ class DriveRackBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : super.setRemoved() cell.destroy(level) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt index 26bfa455f..478eba4d8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StorageInterfaces.kt @@ -123,7 +123,7 @@ abstract class AbstractStorageImportExport( } companion object { - val MAX_POWER = ImpreciseFraction(10_000) + val MAX_POWER = Decimal(10_000) const val FILTER_KEY = "filter" } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt index 37be97800..dbd3a52fe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/storage/StoragePowerSupplierBlockEntity.kt @@ -19,13 +19,13 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.WorkerEnergyStorage import ru.dbotthepony.mc.otm.capability.transferInner -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph import ru.dbotthepony.mc.otm.menu.StoragePowerSupplierMenu import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MNames -import ru.dbotthepony.mc.otm.core.getImpreciseFraction +import ru.dbotthepony.mc.otm.core.getDecimal import ru.dbotthepony.mc.otm.core.set class StoragePowerSupplierBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryPoweredBlockEntity(MBlockEntities.STORAGE_POWER_SUPPLIER, blockPos, blockState) { @@ -38,7 +38,7 @@ class StoragePowerSupplierBlockEntity(blockPos: BlockPos, blockState: BlockState val cell = BasicStorageGraphNode() - var powerPassed = ImpreciseFraction.ZERO + var powerPassed = Decimal.ZERO private set override fun setLevel(p_155231_: Level) { @@ -86,7 +86,7 @@ class StoragePowerSupplierBlockEntity(blockPos: BlockPos, blockState: BlockState if (graph.powerDemandingNodes.isEmpty()) return - var demand = ImpreciseFraction.ZERO + var demand = Decimal.ZERO var i = 0 val available = energy.batteryLevel.coerceAtMost(ServerConfig.STORAGE_POWER_SUPPLIER.throughput) @@ -124,7 +124,7 @@ class StoragePowerSupplierBlockEntity(blockPos: BlockPos, blockState: BlockState override fun load(nbt: CompoundTag) { super.load(nbt) - powerPassed = nbt.getImpreciseFraction(POWER_PASSED_KEY) + powerPassed = nbt.getDecimal(POWER_PASSED_KEY) } companion object { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/AndroidPowerSource.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/AndroidPowerSource.kt index 6e6fc2f2d..c850a32e6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/AndroidPowerSource.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/AndroidPowerSource.kt @@ -6,8 +6,8 @@ import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.minecraftforge.common.capabilities.ForgeCapabilities import net.minecraftforge.common.util.INBTSerializable -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.getImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.getDecimal import ru.dbotthepony.mc.otm.core.getItemStack import ru.dbotthepony.mc.otm.core.ifPresentK import ru.dbotthepony.mc.otm.core.set @@ -18,8 +18,8 @@ import ru.dbotthepony.mc.otm.triggers.AndroidBatteryTrigger class AndroidPowerSource( private val ply: Player, synchronizer: FieldSynchronizer, - initialCharge: ImpreciseFraction, - maxCharge: ImpreciseFraction + initialCharge: Decimal, + maxCharge: Decimal ) : IMatteryEnergyStorage, INBTSerializable { private var battery by synchronizer.fraction(initialCharge, name = "android battery") private var maxBattery by synchronizer.fraction(maxCharge, name = "android max battery") @@ -41,8 +41,8 @@ class AndroidPowerSource( } override fun deserializeNBT(tag: CompoundTag) { - battery = tag.getImpreciseFraction("battery") - maxBattery = tag.getImpreciseFraction("maxBattery") + battery = tag.getDecimal("battery") + maxBattery = tag.getDecimal("maxBattery") item = tag.getItemStack("item") } @@ -58,18 +58,18 @@ class AndroidPowerSource( } } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyOuter(howMuch, simulate) } - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - return ImpreciseFraction.ZERO + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { + return Decimal.ZERO } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { @Suppress("name_shadowing") var howMuch = howMuch - var drained = ImpreciseFraction.ZERO + var drained = Decimal.ZERO if (!item.isEmpty) { item.getCapability(ForgeCapabilities.ENERGY).ifPresentK { @@ -107,10 +107,10 @@ class AndroidPowerSource( return drained } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { @Suppress("name_shadowing") var howMuch = howMuch - var received = ImpreciseFraction.ZERO + var received = Decimal.ZERO if (!item.isEmpty) { item.getCapability(ForgeCapabilities.ENERGY).ifPresentK { @@ -140,7 +140,7 @@ class AndroidPowerSource( return received } - override var batteryLevel: ImpreciseFraction + override var batteryLevel: Decimal get() { if (!item.isEmpty) { item.getCapability(ForgeCapabilities.ENERGY).ifPresentK { @@ -158,7 +158,7 @@ class AndroidPowerSource( battery = value } - override var maxBatteryLevel: ImpreciseFraction + override var maxBatteryLevel: Decimal get() { if (item != ItemStack.EMPTY) { item.getCapability(ForgeCapabilities.ENERGY).ifPresentK { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt index 953ebb4ba..5e96e9c81 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt @@ -24,9 +24,9 @@ import ru.dbotthepony.mc.otm.ConciseBalanceValues import ru.dbotthepony.mc.otm.VerboseBalanceValues import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.compat.mekanism.Mattery2MekanismEnergyWrapper -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.core.formatPower import ru.dbotthepony.mc.otm.core.map import ru.dbotthepony.mc.otm.core.mapIf @@ -34,8 +34,8 @@ import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.tagNotNull sealed interface IEnergyStorageImpl { - val maxInput: ImpreciseFraction? - val maxOutput: ImpreciseFraction? + val maxInput: Decimal? + val maxOutput: Decimal? val direction: FlowDirection } @@ -102,15 +102,15 @@ private fun batteryLevel(it: IMatteryEnergyStorage, tooltips: MutableList= maxBatteryLevel) - return ImpreciseFraction.ZERO + return Decimal.ZERO val newLevel = (batteryLevel + howMuch).coerceAtMost(maxBatteryLevel) val diff = (newLevel - batteryLevel) @@ -232,48 +232,48 @@ sealed class ItemEnergyStorageImpl( open class EnergyConsumerItem( stack: ItemStack, - maxBatteryLevel: ImpreciseFraction, - maxInput: ImpreciseFraction? = null, - maxOutput: ImpreciseFraction? = maxInput, - initialBatteryLevel: ImpreciseFraction = ImpreciseFraction.ZERO + maxBatteryLevel: Decimal, + maxInput: Decimal? = null, + maxOutput: Decimal? = maxInput, + initialBatteryLevel: Decimal = Decimal.ZERO ) : ItemEnergyStorageImpl(FlowDirection.INPUT, stack, maxBatteryLevel, maxInput, maxOutput, initialBatteryLevel) open class EnergyProducerItem( stack: ItemStack, - maxBatteryLevel: ImpreciseFraction, - maxInput: ImpreciseFraction? = null, - maxOutput: ImpreciseFraction? = maxInput, - initialBatteryLevel: ImpreciseFraction = ImpreciseFraction.ZERO + maxBatteryLevel: Decimal, + maxInput: Decimal? = null, + maxOutput: Decimal? = maxInput, + initialBatteryLevel: Decimal = Decimal.ZERO ) : ItemEnergyStorageImpl(FlowDirection.OUTPUT, stack, maxBatteryLevel, maxInput, maxOutput, initialBatteryLevel) open class EnergyCapacitorItem( stack: ItemStack, - maxBatteryLevel: ImpreciseFraction, - maxInput: ImpreciseFraction? = null, - maxOutput: ImpreciseFraction? = maxInput, - initialBatteryLevel: ImpreciseFraction = ImpreciseFraction.ZERO + maxBatteryLevel: Decimal, + maxInput: Decimal? = null, + maxOutput: Decimal? = maxInput, + initialBatteryLevel: Decimal = Decimal.ZERO ) : ItemEnergyStorageImpl(FlowDirection.BI_DIRECTIONAL, stack, maxBatteryLevel, maxInput, maxOutput, initialBatteryLevel) sealed class BlockEnergyStorageImpl( protected val listener: () -> Unit, final override val direction: FlowDirection, - private val maxBatteryLevelProvider: () -> ImpreciseFraction, - private val maxInputProvider: () -> ImpreciseFraction?, - private val maxOutputProvider: () -> ImpreciseFraction?, + private val maxBatteryLevelProvider: () -> Decimal, + private val maxInputProvider: () -> Decimal?, + private val maxOutputProvider: () -> Decimal?, ) : IMatteryEnergyStorage, INBTSerializable, IEnergyStorageImpl { constructor( listener: () -> Unit, direction: FlowDirection, - maxBatteryLevel: ImpreciseFraction, - maxInput: ImpreciseFraction?, - maxOutput: ImpreciseFraction?, + maxBatteryLevel: Decimal, + maxInput: Decimal?, + maxOutput: Decimal?, ) : this(listener, direction, { maxBatteryLevel }, { maxInput }, { maxOutput }) - private var maxInputStorage: ImpreciseFraction? = null - private var maxOutputStorage: ImpreciseFraction? = null - private var maxBatteryLevelStorage: ImpreciseFraction? = null + private var maxInputStorage: Decimal? = null + private var maxOutputStorage: Decimal? = null + private var maxBatteryLevelStorage: Decimal? = null - final override var maxInput: ImpreciseFraction? + final override var maxInput: Decimal? get() = maxInputStorage ?: maxInputProvider.invoke() protected set(value) { if (value != maxInputStorage) { @@ -282,7 +282,7 @@ sealed class BlockEnergyStorageImpl( } } - final override var maxOutput: ImpreciseFraction? + final override var maxOutput: Decimal? get() = maxOutputStorage ?: maxOutputProvider.invoke() protected set(value) { if (value != maxOutputStorage) { @@ -291,7 +291,7 @@ sealed class BlockEnergyStorageImpl( } } - override var maxBatteryLevel: ImpreciseFraction + override var maxBatteryLevel: Decimal get() = maxBatteryLevelStorage ?: maxBatteryLevelProvider.invoke() protected set(value) { if (value != maxBatteryLevelStorage) { @@ -300,7 +300,7 @@ sealed class BlockEnergyStorageImpl( } } - override var batteryLevel = ImpreciseFraction.ZERO + override var batteryLevel = Decimal.ZERO protected set(value) { if (value != field) { field = value @@ -308,23 +308,23 @@ sealed class BlockEnergyStorageImpl( } } - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (direction == FlowDirection.INPUT) - return ImpreciseFraction.ZERO + return Decimal.ZERO return extractEnergyInner(howMuch, simulate) } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (direction == FlowDirection.OUTPUT) - return ImpreciseFraction.ZERO + return Decimal.ZERO return receiveEnergyInner(howMuch, simulate) } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch @@ -335,7 +335,7 @@ sealed class BlockEnergyStorageImpl( } if (!batteryLevel.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO val newLevel = (batteryLevel - howMuch).moreThanZero() val diff = (batteryLevel - newLevel) @@ -347,9 +347,9 @@ sealed class BlockEnergyStorageImpl( return diff } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch @@ -360,7 +360,7 @@ sealed class BlockEnergyStorageImpl( } if (batteryLevel >= maxBatteryLevel) - return ImpreciseFraction.ZERO + return Decimal.ZERO val newLevel = (batteryLevel + howMuch).coerceAtMost(maxBatteryLevel) val diff = (newLevel - batteryLevel) @@ -392,10 +392,10 @@ sealed class BlockEnergyStorageImpl( } override fun deserializeNBT(nbt: CompoundTag) { - batteryLevel = nbt.map(ENERGY_STORED_KEY, ImpreciseFraction.Companion::deserializeNBT) ?: ImpreciseFraction.ZERO - maxBatteryLevelStorage = nbt.mapIf(ENERGY_STORED_MAX_KEY, ImpreciseFraction.Companion::deserializeNBT) - maxInputStorage = nbt.mapIf(MAX_INPUT_KEY, ImpreciseFraction.Companion::deserializeNBT) - maxOutputStorage = nbt.mapIf(MAX_OUTPUT_KEY, ImpreciseFraction.Companion::deserializeNBT) + batteryLevel = nbt.map(ENERGY_STORED_KEY, Decimal.Companion::deserializeNBT) ?: Decimal.ZERO + maxBatteryLevelStorage = nbt.mapIf(ENERGY_STORED_MAX_KEY, Decimal.Companion::deserializeNBT) + maxInputStorage = nbt.mapIf(MAX_INPUT_KEY, Decimal.Companion::deserializeNBT) + maxOutputStorage = nbt.mapIf(MAX_OUTPUT_KEY, Decimal.Companion::deserializeNBT) } var resolver: LazyOptional = LazyOptional.of { this } @@ -410,21 +410,21 @@ sealed class BlockEnergyStorageImpl( } companion object { - val DEFAULT_MAX_IO = ImpreciseFraction(200) - val DEFAULT_MAX_CAPACITY = ImpreciseFraction(60_000) + val DEFAULT_MAX_IO = Decimal(200) + val DEFAULT_MAX_CAPACITY = Decimal(60_000) const val ENERGY_STORED_KEY = "energy_stored" const val ENERGY_STORED_MAX_KEY = "energy_stored_max" const val MAX_INPUT_KEY = "max_input" const val MAX_OUTPUT_KEY = "max_output" - fun makeConfigEntry(builder: ForgeConfigSpec.Builder, name: String? = null, capacity: ImpreciseFraction = DEFAULT_MAX_CAPACITY, throughput: ImpreciseFraction = DEFAULT_MAX_IO): ConciseBalanceValues { + fun makeConfigEntry(builder: ForgeConfigSpec.Builder, name: String? = null, capacity: Decimal = DEFAULT_MAX_CAPACITY, throughput: Decimal = DEFAULT_MAX_IO): ConciseBalanceValues { if (name != null) builder.push(name) val obj = object : ConciseBalanceValues { - override val capacity: ImpreciseFraction by builder.defineImpreciseFraction("capacity", capacity, ImpreciseFraction.ONE) - override val throughput: ImpreciseFraction by builder.defineImpreciseFraction("throughput", throughput, ImpreciseFraction.ONE) + override val capacity: Decimal by builder.defineDecimal("capacity", capacity, Decimal.ONE) + override val throughput: Decimal by builder.defineDecimal("throughput", throughput, Decimal.ONE) } if (name != null) @@ -437,15 +437,15 @@ sealed class BlockEnergyStorageImpl( open class WorkerEnergyStorage( listener: () -> Unit, - maxBatteryLevel: () -> ImpreciseFraction = { DEFAULT_MAX_CAPACITY }, - maxInput: () -> ImpreciseFraction? = { DEFAULT_MAX_IO }, - maxOutput: () -> ImpreciseFraction? = maxInput + maxBatteryLevel: () -> Decimal = { DEFAULT_MAX_CAPACITY }, + maxInput: () -> Decimal? = { DEFAULT_MAX_IO }, + maxOutput: () -> Decimal? = maxInput ) : BlockEnergyStorageImpl(listener, FlowDirection.INPUT, maxBatteryLevel, maxInput, maxOutput) { constructor( listener: () -> Unit, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) constructor( listener: () -> Unit, @@ -465,9 +465,9 @@ open class WorkerEnergyStorage( constructor( listener: BlockEntity, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) companion object { fun appendHoverText(itemStack: ItemStack, tooltips: MutableList) { @@ -485,15 +485,15 @@ open class WorkerEnergyStorage( open class GeneratorEnergyStorage( listener: () -> Unit, - maxBatteryLevel: () -> ImpreciseFraction = { DEFAULT_MAX_CAPACITY }, - maxInput: () -> ImpreciseFraction? = { DEFAULT_MAX_IO }, - maxOutput: () -> ImpreciseFraction? = maxInput + maxBatteryLevel: () -> Decimal = { DEFAULT_MAX_CAPACITY }, + maxInput: () -> Decimal? = { DEFAULT_MAX_IO }, + maxOutput: () -> Decimal? = maxInput ) : BlockEnergyStorageImpl(listener, FlowDirection.OUTPUT, maxBatteryLevel, maxInput, maxOutput) { constructor( listener: () -> Unit, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) constructor( listener: () -> Unit, @@ -513,9 +513,9 @@ open class GeneratorEnergyStorage( constructor( listener: BlockEntity, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) companion object { fun appendHoverText(itemStack: ItemStack, tooltips: MutableList) { @@ -533,15 +533,15 @@ open class GeneratorEnergyStorage( open class CapacitorEnergyStorage( listener: () -> Unit, - maxBatteryLevel: () -> ImpreciseFraction = { DEFAULT_MAX_CAPACITY }, - maxInput: () -> ImpreciseFraction? = { DEFAULT_MAX_IO }, - maxOutput: () -> ImpreciseFraction? = maxInput + maxBatteryLevel: () -> Decimal = { DEFAULT_MAX_CAPACITY }, + maxInput: () -> Decimal? = { DEFAULT_MAX_IO }, + maxOutput: () -> Decimal? = maxInput ) : BlockEnergyStorageImpl(listener, FlowDirection.BI_DIRECTIONAL, maxBatteryLevel, maxInput, maxOutput) { constructor( listener: () -> Unit, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener, { maxBatteryLevel }, { maxInput }, { maxOutput }) constructor( listener: () -> Unit, @@ -561,9 +561,9 @@ open class CapacitorEnergyStorage( constructor( listener: BlockEntity, - maxBatteryLevel: ImpreciseFraction = DEFAULT_MAX_CAPACITY, - maxInput: ImpreciseFraction? = DEFAULT_MAX_IO, - maxOutput: ImpreciseFraction? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) + maxBatteryLevel: Decimal = DEFAULT_MAX_CAPACITY, + maxInput: Decimal? = DEFAULT_MAX_IO, + maxOutput: Decimal? = maxInput) : this(listener::setChanged, maxBatteryLevel, maxInput, maxOutput) companion object { fun appendHoverText(itemStack: ItemStack, tooltips: MutableList) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt index 4cf040c45..489b4e017 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/Ext.kt @@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.container.awareStream import ru.dbotthepony.mc.otm.container.stream import ru.dbotthepony.mc.otm.core.AwareItemStack import ru.dbotthepony.mc.otm.core.ContainerItemStackEntry -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.orNull import java.util.IdentityHashMap import java.util.LinkedList @@ -29,46 +29,46 @@ import java.util.stream.Stream val ICapabilityProvider.matteryPlayer: MatteryPlayerCapability? get() = getCapability(MatteryCapability.MATTERY_PLAYER).orNull() -fun IEnergyStorage.receiveEnergy(amount: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IEnergyStorage.receiveEnergy(amount: Decimal, simulate: Boolean): Decimal { if (this is IMatteryEnergyStorage) return receiveEnergyOuter(amount, simulate) if (!amount.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO - if (amount > ImpreciseFraction.INT_MAX_VALUE) - return ImpreciseFraction.valueOf(receiveEnergy(Int.MAX_VALUE, simulate)) + if (amount > Decimal.INT_MAX_VALUE) + return Decimal.valueOf(receiveEnergy(Int.MAX_VALUE, simulate)) - return ImpreciseFraction.valueOf(receiveEnergy(amount.toInt(), simulate)) + return Decimal.valueOf(receiveEnergy(amount.toInt(), simulate)) } -fun IEnergyStorage.extractEnergy(amount: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IEnergyStorage.extractEnergy(amount: Decimal, simulate: Boolean): Decimal { if (this is IMatteryEnergyStorage) return extractEnergyOuter(amount, simulate) if (!amount.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO - if (amount > ImpreciseFraction.INT_MAX_VALUE) - return ImpreciseFraction.valueOf(extractEnergy(Int.MAX_VALUE, simulate)) + if (amount > Decimal.INT_MAX_VALUE) + return Decimal.valueOf(extractEnergy(Int.MAX_VALUE, simulate)) - return ImpreciseFraction.valueOf(extractEnergy(amount.toInt(), simulate)) + return Decimal.valueOf(extractEnergy(amount.toInt(), simulate)) } -val IEnergyStorage.maxEnergyStoredMattery: ImpreciseFraction get() { +val IEnergyStorage.maxEnergyStoredMattery: Decimal get() { if (this is IMatteryEnergyStorage) { return maxBatteryLevel } - return ImpreciseFraction.valueOf(maxEnergyStored) + return Decimal.valueOf(maxEnergyStored) } -val IEnergyStorage.energyStoredMattery: ImpreciseFraction get() { +val IEnergyStorage.energyStoredMattery: Decimal get() { if (this is IMatteryEnergyStorage) { return batteryLevel } - return ImpreciseFraction.valueOf(energyStored) + return Decimal.valueOf(energyStored) } val IEnergyStorage.chargeRatio: Float get() { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryEnergyStorage.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryEnergyStorage.kt index 785974ea5..f4c241e34 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryEnergyStorage.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/IMatteryEnergyStorage.kt @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.capability -import net.minecraft.util.Mth import net.minecraftforge.energy.IEnergyStorage -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.RGBAColor import java.math.BigInteger import kotlin.math.roundToInt @@ -14,7 +13,7 @@ interface IMatteryEnergyStorage : IEnergyStorage { * * @return energy extracted */ - fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction + fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal /** * Energy extraction by internal processes @@ -24,14 +23,14 @@ interface IMatteryEnergyStorage : IEnergyStorage { * * @return energy extracted */ - fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction + fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal /** * Energy insertion by external interacts * * @return energy accepted */ - fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction + fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal /** * Energy insertion by internal processes @@ -41,11 +40,11 @@ interface IMatteryEnergyStorage : IEnergyStorage { * * @return energy accepted */ - fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction + fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal - val batteryLevel: ImpreciseFraction - val maxBatteryLevel: ImpreciseFraction - val missingPower: ImpreciseFraction + val batteryLevel: Decimal + val maxBatteryLevel: Decimal + val missingPower: Decimal get() = (maxBatteryLevel - batteryLevel).moreThanZero() override fun receiveEnergy(maxReceive: Int, simulate: Boolean): Int { @@ -55,7 +54,7 @@ interface IMatteryEnergyStorage : IEnergyStorage { if (received == 0) return 0 - return receiveEnergyOuter(ImpreciseFraction(received), simulate).toInt() + return receiveEnergyOuter(Decimal(received), simulate).toInt() } override fun extractEnergy(maxReceive: Int, simulate: Boolean): Int { @@ -65,7 +64,7 @@ interface IMatteryEnergyStorage : IEnergyStorage { if (extracted == 0) return 0 - return extractEnergyOuter(ImpreciseFraction(extracted), simulate).toInt() + return extractEnergyOuter(Decimal(extracted), simulate).toInt() } override fun getEnergyStored(): Int { @@ -77,19 +76,19 @@ interface IMatteryEnergyStorage : IEnergyStorage { } override fun canExtract(): Boolean { - return extractEnergyOuter(ImpreciseFraction.ONE, true) > ImpreciseFraction.ZERO + return extractEnergyOuter(Decimal.ONE, true) > Decimal.ZERO } override fun canReceive(): Boolean { - return receiveEnergyOuter(ImpreciseFraction.ONE, true) > ImpreciseFraction.ZERO + return receiveEnergyOuter(Decimal.ONE, true) > Decimal.ZERO } } -fun IMatteryEnergyStorage.receiveEnergyOuterExact(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.receiveEnergyOuterExact(howMuch: Decimal, simulate: Boolean): Decimal { val extracted = receiveEnergyOuter(howMuch, true) if (extracted != howMuch) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (!simulate) { @@ -103,11 +102,11 @@ fun IMatteryEnergyStorage.receiveEnergyOuterExact(howMuch: ImpreciseFraction, si * * @return energy extracted */ -fun IMatteryEnergyStorage.extractEnergyOuterExact(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.extractEnergyOuterExact(howMuch: Decimal, simulate: Boolean): Decimal { val extracted = extractEnergyOuter(howMuch, true) if (extracted != howMuch) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (!simulate) { @@ -122,11 +121,11 @@ fun IMatteryEnergyStorage.extractEnergyOuterExact(howMuch: ImpreciseFraction, si * * @return energy accepted */ -fun IMatteryEnergyStorage.receiveEnergyInnerExact(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.receiveEnergyInnerExact(howMuch: Decimal, simulate: Boolean): Decimal { val extracted = receiveEnergyInner(howMuch, true) if (extracted != howMuch) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (!simulate) { @@ -141,11 +140,11 @@ fun IMatteryEnergyStorage.receiveEnergyInnerExact(howMuch: ImpreciseFraction, si * * @return energy extracted */ -fun IMatteryEnergyStorage.extractEnergyInnerExact(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.extractEnergyInnerExact(howMuch: Decimal, simulate: Boolean): Decimal { val extracted = extractEnergyInner(howMuch, true) if (extracted != howMuch) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (!simulate) { @@ -155,41 +154,41 @@ fun IMatteryEnergyStorage.extractEnergyInnerExact(howMuch: ImpreciseFraction, si return extracted } -fun IMatteryEnergyStorage.extractEnergyOuter(howMuch: Long, simulate: Boolean): ImpreciseFraction { - return extractEnergyOuter(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.extractEnergyOuter(howMuch: Long, simulate: Boolean): Decimal { + return extractEnergyOuter(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.extractEnergyOuter(howMuch: Int, simulate: Boolean): ImpreciseFraction { - return extractEnergyOuter(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.extractEnergyOuter(howMuch: Int, simulate: Boolean): Decimal { + return extractEnergyOuter(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.receiveEnergyOuter(howMuch: Long, simulate: Boolean): ImpreciseFraction { - return receiveEnergyOuter(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.receiveEnergyOuter(howMuch: Long, simulate: Boolean): Decimal { + return receiveEnergyOuter(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.receiveEnergyOuter(howMuch: Int, simulate: Boolean): ImpreciseFraction { - return receiveEnergyOuter(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.receiveEnergyOuter(howMuch: Int, simulate: Boolean): Decimal { + return receiveEnergyOuter(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.extractEnergyInner(howMuch: Long, simulate: Boolean): ImpreciseFraction { - return extractEnergyInner(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.extractEnergyInner(howMuch: Long, simulate: Boolean): Decimal { + return extractEnergyInner(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.extractEnergyInner(howMuch: Int, simulate: Boolean): ImpreciseFraction { - return extractEnergyInner(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.extractEnergyInner(howMuch: Int, simulate: Boolean): Decimal { + return extractEnergyInner(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.receiveEnergyInner(howMuch: Long, simulate: Boolean): ImpreciseFraction { - return receiveEnergyInner(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.receiveEnergyInner(howMuch: Long, simulate: Boolean): Decimal { + return receiveEnergyInner(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.receiveEnergyInner(howMuch: Int, simulate: Boolean): ImpreciseFraction { - return receiveEnergyInner(ImpreciseFraction(howMuch), simulate) +fun IMatteryEnergyStorage.receiveEnergyInner(howMuch: Int, simulate: Boolean): Decimal { + return receiveEnergyInner(Decimal(howMuch), simulate) } -fun IMatteryEnergyStorage.transferInner(other: IMatteryEnergyStorage, amount: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.transferInner(other: IMatteryEnergyStorage, amount: Decimal, simulate: Boolean): Decimal { if (!amount.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO val extracted = extractEnergyInner(amount, true) val received = other.receiveEnergyOuter(extracted, simulate) @@ -200,9 +199,9 @@ fun IMatteryEnergyStorage.transferInner(other: IMatteryEnergyStorage, amount: Im return received } -fun IMatteryEnergyStorage.transferOuter(other: IMatteryEnergyStorage, amount: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { +fun IMatteryEnergyStorage.transferOuter(other: IMatteryEnergyStorage, amount: Decimal, simulate: Boolean): Decimal { if (!amount.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO val extracted = extractEnergyOuter(amount, true) val received = other.receiveEnergyOuter(extracted, simulate) @@ -213,35 +212,35 @@ fun IMatteryEnergyStorage.transferOuter(other: IMatteryEnergyStorage, amount: Im return received } -fun IMatteryEnergyStorage.extractStepInner(base: ImpreciseFraction, multiplier: Int, simulate: Boolean): Int { +fun IMatteryEnergyStorage.extractStepInner(base: Decimal, multiplier: Int, simulate: Boolean): Int { return (extractEnergyInner(base * multiplier, simulate) / base).toInt() } -fun IMatteryEnergyStorage.extractStepOuter(base: ImpreciseFraction, multiplier: Int, simulate: Boolean): Int { +fun IMatteryEnergyStorage.extractStepOuter(base: Decimal, multiplier: Int, simulate: Boolean): Int { return (extractEnergyOuter(base * multiplier, simulate) / base).toInt() } -fun IMatteryEnergyStorage.extractStepInnerBi(base: ImpreciseFraction, multiplier: Int, simulate: Boolean): BigInteger { +fun IMatteryEnergyStorage.extractStepInnerBi(base: Decimal, multiplier: Int, simulate: Boolean): BigInteger { return (extractEnergyInner(base * multiplier, simulate) / base).whole } -fun IMatteryEnergyStorage.extractStepOuterBi(base: ImpreciseFraction, multiplier: Int, simulate: Boolean): BigInteger { +fun IMatteryEnergyStorage.extractStepOuterBi(base: Decimal, multiplier: Int, simulate: Boolean): BigInteger { return (extractEnergyOuter(base * multiplier, simulate) / base).whole } -fun IMatteryEnergyStorage.extractStepInner(base: ImpreciseFraction, multiplier: BigInteger, simulate: Boolean): Int { +fun IMatteryEnergyStorage.extractStepInner(base: Decimal, multiplier: BigInteger, simulate: Boolean): Int { return (extractEnergyInner(base * multiplier, simulate) / base).toInt() } -fun IMatteryEnergyStorage.extractStepOuter(base: ImpreciseFraction, multiplier: BigInteger, simulate: Boolean): Int { +fun IMatteryEnergyStorage.extractStepOuter(base: Decimal, multiplier: BigInteger, simulate: Boolean): Int { return (extractEnergyOuter(base * multiplier, simulate) / base).toInt() } -fun IMatteryEnergyStorage.extractStepInnerBi(base: ImpreciseFraction, multiplier: BigInteger, simulate: Boolean): BigInteger { +fun IMatteryEnergyStorage.extractStepInnerBi(base: Decimal, multiplier: BigInteger, simulate: Boolean): BigInteger { return (extractEnergyInner(base * multiplier, simulate) / base).whole } -fun IMatteryEnergyStorage.extractStepOuterBi(base: ImpreciseFraction, multiplier: BigInteger, simulate: Boolean): BigInteger { +fun IMatteryEnergyStorage.extractStepOuterBi(base: Decimal, multiplier: BigInteger, simulate: Boolean): BigInteger { return (extractEnergyOuter(base * multiplier, simulate) / base).whole } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt index 1496f4b18..bb104b34d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/MatteryPlayerCapability.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.capability import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap -import it.unimi.dsi.fastutil.objects.ReferenceArraySet import net.minecraft.ChatFormatting import net.minecraft.core.Direction import net.minecraft.nbt.CompoundTag @@ -251,7 +250,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial shouldPlaySound = false iteration = 0 deathLog.clear() - androidEnergy.batteryLevel = ImpreciseFraction.ZERO + androidEnergy.batteryLevel = Decimal.ZERO androidEnergy.maxBatteryLevel = ServerConfig.ANDROID_MAX_ENERGY dropBattery() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/drive/API.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/drive/API.kt index fc4db5c62..2c31379ba 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/drive/API.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/drive/API.kt @@ -3,8 +3,6 @@ package ru.dbotthepony.mc.otm.capability.drive import net.minecraft.nbt.CompoundTag import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.core.Fraction -import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.storage.IStorageComponent import ru.dbotthepony.mc.otm.storage.IStorageStack import ru.dbotthepony.mc.otm.storage.IStorageTuple diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/IMatterHandler.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/IMatterHandler.kt index 828c54850..a661ef67a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/IMatterHandler.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/IMatterHandler.kt @@ -1,24 +1,23 @@ package ru.dbotthepony.mc.otm.capability.matter -import net.minecraft.util.Mth import net.minecraftforge.common.capabilities.ICapabilityProvider import ru.dbotthepony.mc.otm.capability.MatteryCapability -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.RGBAColor import ru.dbotthepony.mc.otm.core.orNull import kotlin.math.roundToInt interface IMatterHandler { - val storedMatter: ImpreciseFraction - val maxStoredMatter: ImpreciseFraction + val storedMatter: Decimal + val maxStoredMatter: Decimal - fun receiveMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction - fun receiveMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction - fun extractMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction - fun extractMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction + fun receiveMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal + fun receiveMatterInner(howMuch: Decimal, simulate: Boolean): Decimal + fun extractMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal + fun extractMatterInner(howMuch: Decimal, simulate: Boolean): Decimal val direction: MatterDirection - val missingMatter: ImpreciseFraction + val missingMatter: Decimal get() = maxStoredMatter.minus(storedMatter).moreThanZero() val allowsExtract: Boolean diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/MatterHandlerImpl.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/MatterHandlerImpl.kt index 82f024180..b50bc0bb5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/MatterHandlerImpl.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/matter/MatterHandlerImpl.kt @@ -5,23 +5,22 @@ import net.minecraftforge.common.util.INBTSerializable import net.minecraftforge.common.util.LazyOptional import ru.dbotthepony.mc.otm.ConciseBalanceValues import ru.dbotthepony.mc.otm.VerboseBalanceValues -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.container.set +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.set open class MatterHandlerImpl @JvmOverloads constructor( protected val listener: Runnable?, override val direction: MatterDirection, - protected val maxStoredMatterSupplier: () -> ImpreciseFraction, - protected val maxReceiveSupplier: () -> ImpreciseFraction? = { null }, - protected val maxExtractSupplier: () -> ImpreciseFraction? = maxReceiveSupplier + protected val maxStoredMatterSupplier: () -> Decimal, + protected val maxReceiveSupplier: () -> Decimal? = { null }, + protected val maxExtractSupplier: () -> Decimal? = maxReceiveSupplier ) : IMatterHandler, INBTSerializable { constructor( listener: Runnable?, direction: MatterDirection, - maxStoredMatter: ImpreciseFraction, - maxReceive: ImpreciseFraction? = null, - maxExtract: ImpreciseFraction? = null, + maxStoredMatter: Decimal, + maxReceive: Decimal? = null, + maxExtract: Decimal? = null, ) : this(listener, direction, { maxStoredMatter }, { maxReceive }, { maxExtract }) constructor( @@ -39,10 +38,10 @@ open class MatterHandlerImpl @JvmOverloads constructor( val maxReceive get() = maxReceiveSupplier.invoke() val maxExtract get() = maxExtractSupplier.invoke() - override val maxStoredMatter: ImpreciseFraction + override val maxStoredMatter: Decimal get() = maxStoredMatterSupplier.invoke() - override var storedMatter = ImpreciseFraction.ZERO + override var storedMatter = Decimal.ZERO protected set private var handler = LazyOptional.of { this } @@ -59,19 +58,19 @@ open class MatterHandlerImpl @JvmOverloads constructor( return handler } - open fun canReceiveAll(value: ImpreciseFraction): Boolean { + open fun canReceiveAll(value: Decimal): Boolean { return maxStoredMatter >= value && storedMatter + value <= maxStoredMatter } - override fun receiveMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (direction === MatterDirection.EXTRACT) - return ImpreciseFraction.ZERO + return Decimal.ZERO return receiveMatterInner(howMuch, simulate) } - override fun receiveMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - val new: ImpreciseFraction + override fun receiveMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { + val new: Decimal if (maxReceive == null) { new = (storedMatter + howMuch).coerceAtMost(maxStoredMatter) @@ -89,15 +88,15 @@ open class MatterHandlerImpl @JvmOverloads constructor( return diff } - override fun extractMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { if (direction === MatterDirection.RECEIVE) - return ImpreciseFraction.ZERO + return Decimal.ZERO return extractMatterInner(howMuch, simulate) } - override fun extractMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - val new: ImpreciseFraction + override fun extractMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { + val new: Decimal if (maxExtract == null) { new = (storedMatter - howMuch).moreThanZero() @@ -125,9 +124,9 @@ open class MatterHandlerImpl @JvmOverloads constructor( } override fun deserializeNBT(tag: CompoundTag) { - storedMatter = ImpreciseFraction.deserializeNBT(tag["stored"]) + storedMatter = Decimal.deserializeNBT(tag["stored"]) //maxStoredMatter = ImpreciseFraction.deserializeNBT(tag["max_storage"]) //maxReceive = if (tag.contains("max_receive")) ImpreciseFraction.deserializeNBT(tag["max_receive"]) else null //maxExtract = if (tag.contains("max_extract")) ImpreciseFraction.deserializeNBT(tag["max_extract"]) else null } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Conversions.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Conversions.kt index 8e7bc3d51..ac3a4166d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Conversions.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Conversions.kt @@ -1,13 +1,13 @@ package ru.dbotthepony.mc.otm.compat.mekanism import mekanism.api.math.FloatingLong -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import java.math.BigInteger private val LONG_OVERFLOW = BigInteger.valueOf(Long.MAX_VALUE) + BigInteger.valueOf(Long.MAX_VALUE) + BigInteger.TWO private val LONG_OVERFLOW1 = BigInteger.valueOf(Long.MAX_VALUE) + BigInteger.valueOf(Long.MAX_VALUE) + BigInteger.ONE -fun ImpreciseFraction.toFloatingLong(): FloatingLong { +fun Decimal.toFloatingLong(): FloatingLong { if (isNegative) { // Floating long can't be negative return FloatingLong.ZERO @@ -20,11 +20,11 @@ fun ImpreciseFraction.toFloatingLong(): FloatingLong { return FloatingLong.create(whole.toLong(), (decimal * 10_000.0).toInt().toShort()) } -fun FloatingLong.toImpreciseFraction(): ImpreciseFraction { +fun FloatingLong.toImpreciseFraction(): Decimal { // Overflow if (value < 0L) { - return ImpreciseFraction(LONG_OVERFLOW + BigInteger.valueOf(value), decimal / 10_000.0) + return Decimal(LONG_OVERFLOW + BigInteger.valueOf(value), decimal / 10_000.0) } - return ImpreciseFraction(value, decimal / 10_000.0) + return Decimal(value, decimal / 10_000.0) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt index 17759e270..c9ef0f38c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt @@ -11,7 +11,7 @@ import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.isMekanismLoaded -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import java.lang.ref.WeakReference import java.util.WeakHashMap @@ -48,12 +48,12 @@ private class DoubleLazy(onion: () -> Lazy) : Lazy { private val mekanism2MtJ by DoubleLazy lazy@{ try { val conf = MekanismConfig.general - return@lazy LazyCache(conf.forgeConversionRate::get) { ImpreciseFraction.ONE / it.toImpreciseFraction() } + return@lazy LazyCache(conf.forgeConversionRate::get) { Decimal.ONE / it.toImpreciseFraction() } } catch(err: Throwable) { LOGGER.error("Unable to get Forge Energy to Mekanism Joules's conversion rate! Expect issues", err) } - return@lazy lazyOf(ImpreciseFraction.ONE) + return@lazy lazyOf(Decimal.ONE) } private val mtj2Mekanism by DoubleLazy lazy@{ @@ -64,11 +64,11 @@ private val mtj2Mekanism by DoubleLazy lazy@{ LOGGER.error("Unable to get Mekanism Joules's to Forge Energy conversion rate! Expect issues", err) } - return@lazy lazyOf(ImpreciseFraction.ONE) + return@lazy lazyOf(Decimal.ONE) } class Mekanism2MatteryEnergyWrapper(private val power: IStrictEnergyHandler) : IMatteryEnergyStorage { - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { val action = when (simulate) { true -> Action.SIMULATE false -> Action.EXECUTE @@ -77,11 +77,11 @@ class Mekanism2MatteryEnergyWrapper(private val power: IStrictEnergyHandler) : I return power.extractEnergy((howMuch * mtj2Mekanism).toFloatingLong(), action).toImpreciseFraction() * mekanism2MtJ } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return extractEnergyOuter(howMuch, simulate) } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { val action = when (simulate) { true -> Action.SIMULATE false -> Action.EXECUTE @@ -90,13 +90,13 @@ class Mekanism2MatteryEnergyWrapper(private val power: IStrictEnergyHandler) : I return howMuch - power.insertEnergy((howMuch * mtj2Mekanism).toFloatingLong(), action).toImpreciseFraction() * mekanism2MtJ } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyOuter(howMuch, simulate) } - override val batteryLevel: ImpreciseFraction + override val batteryLevel: Decimal get() { - var sum = ImpreciseFraction.ZERO + var sum = Decimal.ZERO for (i in 0 until power.energyContainerCount) { sum += power.getEnergy(i).toImpreciseFraction() @@ -105,9 +105,9 @@ class Mekanism2MatteryEnergyWrapper(private val power: IStrictEnergyHandler) : I return sum * mekanism2MtJ } - override val maxBatteryLevel: ImpreciseFraction + override val maxBatteryLevel: Decimal get() { - var sum = ImpreciseFraction.ZERO + var sum = Decimal.ZERO for (i in 0 until power.energyContainerCount) { sum += power.getMaxEnergy(i).toImpreciseFraction() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/DataStreams.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/DataStreams.kt index 109f6d260..7e85b630d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/DataStreams.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/DataStreams.kt @@ -66,7 +66,7 @@ val LongValueCodec = StreamCodec(DataInputStream::readLong, DataOutputStream::wr val FloatValueCodec = StreamCodec(DataInputStream::readFloat, DataOutputStream::writeFloat) val DoubleValueCodec = StreamCodec(DataInputStream::readDouble, DataOutputStream::writeDouble) val ItemStackValueCodec = StreamCodec(DataInputStream::readItem, DataOutputStream::writeItem, ItemStack::copy, ItemStack::isSameItemSameTags) -val ImpreciseFractionValueCodec = StreamCodec(DataInputStream::readImpreciseFraction, DataOutputStream::writeImpreciseFraction) +val ImpreciseFractionValueCodec = StreamCodec(DataInputStream::readDecimal, DataOutputStream::writeDecimal) val BigDecimalValueCodec = StreamCodec(DataInputStream::readBigDecimal, DataOutputStream::writeBigDecimal) val UUIDValueCodec = StreamCodec({ s -> UUID(s.readLong(), s.readLong()) }, { s, v -> s.writeLong(v.mostSignificantBits); s.writeLong(v.leastSignificantBits) }) val VarIntValueCodec = StreamCodec(DataInputStream::readVarIntLE, DataOutputStream::writeVarIntLE) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Decimal.kt similarity index 69% rename from src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/core/Decimal.kt index b3eee4c38..68d8ab1d7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/ImpreciseFraction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Decimal.kt @@ -131,13 +131,13 @@ private val MEANINGFUL_BITS_BI = BigInteger.valueOf(MEANINGFUL_BITS_LONG) private val BI_MINUS_ONE = -BigInteger.ONE -fun ImpreciseFraction(value: Byte) = ImpreciseFraction.valueOf(value) -fun ImpreciseFraction(value: Short) = ImpreciseFraction.valueOf(value) -fun ImpreciseFraction(value: Int) = ImpreciseFraction.valueOf(value) -fun ImpreciseFraction(value: Long) = ImpreciseFraction.valueOf(value) +fun Decimal(value: Byte) = Decimal.valueOf(value) +fun Decimal(value: Short) = Decimal.valueOf(value) +fun Decimal(value: Int) = Decimal.valueOf(value) +fun Decimal(value: Long) = Decimal.valueOf(value) /** - * Imprecise Fraction class for dealing with huge numbers that need fractional part to some extent. + * Decimal class for having infinitely precise [whole] part, while having fixed precision [decimal] part. * * In essence, this class is pretty much like [BigDecimal], except decimal part of this number is * not guaranteed to be precise (stored as [Double]). The reason behind creation of this class, however, @@ -145,11 +145,9 @@ fun ImpreciseFraction(value: Long) = ImpreciseFraction.valueOf(value) * * This class is value based, however, [equals] and [compareTo] are not doing *exact* comparison. Whole part is always compared * exactly, but decimal part is considered equal if their difference is less than [EPSILON]. - * - * */ @Suppress("unused") -class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Double = 0.0) : Number(), Comparable, java.io.Serializable { +class Decimal @JvmOverloads constructor(whole: BigInteger, decimal: Double = 0.0) : Number(), Comparable, java.io.Serializable { constructor(whole: Byte, decimal: Double) : this(BigInteger.valueOf(whole.toLong()), decimal) constructor(whole: Short, decimal: Double) : this(BigInteger.valueOf(whole.toLong()), decimal) constructor(whole: Int, decimal: Double) : this(BigInteger.valueOf(whole.toLong()), decimal) @@ -212,10 +210,10 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val isNaN get() = decimal.isNaN() - operator fun plus(other: ImpreciseFraction) = ImpreciseFraction(whole + other.whole, decimal + other.decimal) - operator fun minus(other: ImpreciseFraction) = ImpreciseFraction(whole - other.whole, decimal - other.decimal) + operator fun plus(other: Decimal) = Decimal(whole + other.whole, decimal + other.decimal) + operator fun minus(other: Decimal) = Decimal(whole - other.whole, decimal - other.decimal) - operator fun times(other: ImpreciseFraction): ImpreciseFraction { + operator fun times(other: Decimal): Decimal { if (other == ONE) return this else if (other == MINUS_ONE) @@ -231,12 +229,12 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do if (isZero(a) || isZero(c)) return ZERO - return ImpreciseFraction(a * c) + return Decimal(a * c) } else if (isZero(a) && isZero(c)) { if (bZero || dZero) return ZERO - return ImpreciseFraction(0, decimal * other.decimal) + return Decimal(0, decimal * other.decimal) } else if (bZero) { val d = other.decimal * MEANINGFUL_BITS_DOUBLE val dL = d.toLong() @@ -244,13 +242,13 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val ad = adInflated.divideAndRemainder(MEANINGFUL_BITS_BI) if (isZero(c)) { - return ImpreciseFraction( + return Decimal( ad[0], ad[1].toDouble() / MEANINGFUL_BITS_DOUBLE ) } - return ImpreciseFraction( + return Decimal( a * c + ad[0], ad[1].toDouble() / MEANINGFUL_BITS_DOUBLE ) @@ -261,13 +259,13 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val bc = bcInflated.divideAndRemainder(MEANINGFUL_BITS_BI) if (isZero(a)) { - return ImpreciseFraction( + return Decimal( bc[0], bc[1].toDouble() / MEANINGFUL_BITS_DOUBLE ) } - return ImpreciseFraction( + return Decimal( a * c + bc[0], bc[1].toDouble() / MEANINGFUL_BITS_DOUBLE ) @@ -285,13 +283,13 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val bc = bcInflated.divideAndRemainder(MEANINGFUL_BITS_BI) val ad = adInflated.divideAndRemainder(MEANINGFUL_BITS_BI) - return ImpreciseFraction( + return Decimal( a * c + bc[0] + ad[0], decimal * other.decimal + bc[1].toDouble() / MEANINGFUL_BITS_DOUBLE + ad[1].toDouble() / MEANINGFUL_BITS_DOUBLE ) } - operator fun div(other: ImpreciseFraction): ImpreciseFraction { + operator fun div(other: Decimal): Decimal { if (other == ONE) return this else if (other == MINUS_ONE) @@ -313,29 +311,29 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val bD = b.toDouble() if (bD.isInfinite() || bD == 0.0) { - return ImpreciseFraction(div[0].toBigInteger()) + return Decimal(div[0].toBigInteger()) } - return ImpreciseFraction(div[0].toBigInteger(), div[1].toDouble() / bD) + return Decimal(div[0].toBigInteger(), div[1].toDouble() / bD) } - operator fun plus(other: Float): ImpreciseFraction { + operator fun plus(other: Float): Decimal { if (other == 0f) { return this } - return plus(ImpreciseFraction(other)) + return plus(Decimal(other)) } - operator fun minus(other: Float): ImpreciseFraction { + operator fun minus(other: Float): Decimal { if (other == 0f) { return this } - return minus(ImpreciseFraction(other)) + return minus(Decimal(other)) } - operator fun times(other: Float): ImpreciseFraction { + operator fun times(other: Float): Decimal { if (other == 1f) { return this } else if (other == 0f) { @@ -344,10 +342,10 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return times(ImpreciseFraction(other)) + return times(Decimal(other)) } - operator fun div(other: Float): ImpreciseFraction { + operator fun div(other: Float): Decimal { if (other == 0f) { if (isZero) return NaN @@ -359,26 +357,26 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return div(ImpreciseFraction(other)) + return div(Decimal(other)) } - operator fun plus(other: Double): ImpreciseFraction { + operator fun plus(other: Double): Decimal { if (other == 0.0) { return this } - return plus(ImpreciseFraction(other)) + return plus(Decimal(other)) } - operator fun minus(other: Double): ImpreciseFraction { + operator fun minus(other: Double): Decimal { if (other == 0.0) { return this } - return minus(ImpreciseFraction(other)) + return minus(Decimal(other)) } - operator fun times(other: Double): ImpreciseFraction { + operator fun times(other: Double): Decimal { if (other == 1.0) { return this } else if (other == 0.0) { @@ -387,10 +385,10 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return times(ImpreciseFraction(other)) + return times(Decimal(other)) } - operator fun div(other: Double): ImpreciseFraction { + operator fun div(other: Double): Decimal { if (other == 0.0) { if (isZero) return NaN @@ -402,10 +400,10 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return div(ImpreciseFraction(other)) + return div(Decimal(other)) } - operator fun plus(other: Int): ImpreciseFraction { + operator fun plus(other: Int): Decimal { if (other == 0) { return this } @@ -413,7 +411,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return plus(valueOf(other)) } - operator fun minus(other: Int): ImpreciseFraction { + operator fun minus(other: Int): Decimal { if (other == 0) { return this } @@ -421,7 +419,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return minus(valueOf(other)) } - operator fun times(other: Int): ImpreciseFraction { + operator fun times(other: Int): Decimal { if (other == 1) { return this } else if (other == 0) { @@ -433,7 +431,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return times(valueOf(other)) } - operator fun div(other: Int): ImpreciseFraction { + operator fun div(other: Int): Decimal { if (other == 0) { if (isZero) return NaN @@ -448,7 +446,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return div(valueOf(other)) } - operator fun plus(other: Long): ImpreciseFraction { + operator fun plus(other: Long): Decimal { if (other == 0L) { return this } @@ -456,7 +454,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return plus(valueOf(other)) } - operator fun minus(other: Long): ImpreciseFraction { + operator fun minus(other: Long): Decimal { if (other == 0L) { return this } @@ -464,7 +462,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return minus(valueOf(other)) } - operator fun times(other: Long): ImpreciseFraction { + operator fun times(other: Long): Decimal { if (other == 1L) { return this } else if (other == 0L) { @@ -476,7 +474,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return times(valueOf(other)) } - operator fun div(other: Long): ImpreciseFraction { + operator fun div(other: Long): Decimal { if (other == 0L) { if (isZero) return NaN @@ -491,23 +489,23 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return div(valueOf(other)) } - operator fun plus(other: BigInteger): ImpreciseFraction { + operator fun plus(other: BigInteger): Decimal { if (other == BigInteger.ZERO) { return this } - return plus(ImpreciseFraction(other)) + return plus(Decimal(other)) } - operator fun minus(other: BigInteger): ImpreciseFraction { + operator fun minus(other: BigInteger): Decimal { if (other == BigInteger.ZERO) { return this } - return minus(ImpreciseFraction(other)) + return minus(Decimal(other)) } - operator fun times(other: BigInteger): ImpreciseFraction { + operator fun times(other: BigInteger): Decimal { if (other == BigInteger.ONE) { return this } else if (other == BigInteger.ZERO) { @@ -516,10 +514,10 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return times(ImpreciseFraction(other)) + return times(Decimal(other)) } - operator fun div(other: BigInteger): ImpreciseFraction { + operator fun div(other: BigInteger): Decimal { if (other == BigInteger.ZERO) { return NaN } else if (other == BigInteger.ONE) { @@ -528,18 +526,18 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return -this } - return div(ImpreciseFraction(other)) + return div(Decimal(other)) } - operator fun unaryMinus(): ImpreciseFraction { - return ImpreciseFraction(-whole, -decimal) + operator fun unaryMinus(): Decimal { + return Decimal(-whole, -decimal) } override fun equals(other: Any?): Boolean { if (isNaN) return false - if (other is ImpreciseFraction) { + if (other is Decimal) { return other.whole == whole && weakEqualDoubles(decimal, other.decimal) } @@ -548,9 +546,9 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do fun equalsStrict(other: Any?): Boolean { if (isNaN) - return other is ImpreciseFraction && other.isNaN // ибо hashCode() так требует + return other is Decimal && other.isNaN // ибо hashCode() так требует - if (other is ImpreciseFraction) { + if (other is Decimal) { return other.whole == whole && other.decimal == decimal } @@ -564,11 +562,11 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return 31 * (decimal - decimal % EPSILON).hashCode() + whole.hashCode() } - fun floor(): ImpreciseFraction { + fun floor(): Decimal { if (decimal == 0.0) return this - return ImpreciseFraction(whole) + return Decimal(whole) } fun toString(decimals: Int): String { @@ -612,7 +610,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return if (decimal > 0.0) 1 else -1 } - override fun compareTo(other: ImpreciseFraction): Int { + override fun compareTo(other: Decimal): Int { if (isNaN) return 1 else if (other.isNaN) @@ -633,7 +631,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return whole.compareTo(other.whole) } - fun compareToStrict(other: ImpreciseFraction): Int { + fun compareToStrict(other: Decimal): Int { if (isNaN) return 1 else if (other.isNaN) @@ -671,14 +669,14 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do val isPositive get() = this > ZERO val isNegative get() = this < ZERO - fun moreThanZero(): ImpreciseFraction { + fun moreThanZero(): Decimal { if (signum() >= 0) return this return ZERO } - fun lessOrZero(): ImpreciseFraction { + fun lessOrZero(): Decimal { if (signum() <= 0) return this @@ -743,7 +741,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return Fraction(toBigDecmial()) } - fun percentage(divisor: ImpreciseFraction, zeroing: Boolean = true): Float { + fun percentage(divisor: Decimal, zeroing: Boolean = true): Float { if ((isZero || divisor.isZero) && zeroing) return 0f if (isNaN || divisor.isNaN || divisor.isZero) return Float.NaN @@ -756,7 +754,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do return toBigDecmial().divide(divisor.toBigDecmial(), PERCENTAGE_CONTEXT).toFloat() } - operator fun rem(divisor: ImpreciseFraction): ImpreciseFraction { + operator fun rem(divisor: Decimal): Decimal { TODO("Not yet implemented") } @@ -764,47 +762,47 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do @JvmStatic val serialVersionUID: Long = 287354739494574838L - @JvmField val MINUS_ZERO = ImpreciseFraction(0, -0.0) - @JvmField val ZERO = ImpreciseFraction(BigInteger.ZERO) - @JvmField val ONE = ImpreciseFraction(BigInteger.ONE) - @JvmField val MINUS_ONE = ImpreciseFraction(-BigInteger.ONE) - @JvmField val TWO = ImpreciseFraction(BigInteger.TWO) - @JvmField val TEN = ImpreciseFraction(BigInteger.TEN) + @JvmField val MINUS_ZERO = Decimal(0, -0.0) + @JvmField val ZERO = Decimal(BigInteger.ZERO) + @JvmField val ONE = Decimal(BigInteger.ONE) + @JvmField val MINUS_ONE = Decimal(-BigInteger.ONE) + @JvmField val TWO = Decimal(BigInteger.TWO) + @JvmField val TEN = Decimal(BigInteger.TEN) - @JvmField val INT_MAX_VALUE = ImpreciseFraction(BI_INT_MAX) - @JvmField val INT_MIN_VALUE = ImpreciseFraction(BI_INT_MIN) - @JvmField val LONG_MAX_VALUE = ImpreciseFraction(BI_LONG_MAX) - @JvmField val LONG_MIN_VALUE = ImpreciseFraction(BI_LONG_MIN) + @JvmField val INT_MAX_VALUE = Decimal(BI_INT_MAX) + @JvmField val INT_MIN_VALUE = Decimal(BI_INT_MIN) + @JvmField val LONG_MAX_VALUE = Decimal(BI_LONG_MAX) + @JvmField val LONG_MIN_VALUE = Decimal(BI_LONG_MIN) - @JvmField val FLOAT_MAX_VALUE = ImpreciseFraction(BI_FLOAT_MAX) - @JvmField val FLOAT_MIN_VALUE = ImpreciseFraction(BI_FLOAT_MIN) - @JvmField val DOUBLE_MAX_VALUE = ImpreciseFraction(BI_DOUBLE_MAX) - @JvmField val DOUBLE_MIN_VALUE = ImpreciseFraction(BI_DOUBLE_MIN) + @JvmField val FLOAT_MAX_VALUE = Decimal(BI_FLOAT_MAX) + @JvmField val FLOAT_MIN_VALUE = Decimal(BI_FLOAT_MIN) + @JvmField val DOUBLE_MAX_VALUE = Decimal(BI_DOUBLE_MAX) + @JvmField val DOUBLE_MIN_VALUE = Decimal(BI_DOUBLE_MIN) - @JvmField val ONE_TENTH = ImpreciseFraction("0.1") + @JvmField val ONE_TENTH = Decimal("0.1") - private val cache = Array(2048) { ImpreciseFraction(it - 1024, 0.0) } + private val cache = Array(2048) { Decimal(it - 1024, 0.0) } /** * Returns pooled value if present, otherwise constructs new object */ - fun valueOf(value: Int): ImpreciseFraction { + fun valueOf(value: Int): Decimal { if (value in -1024 .. 1023) { return cache[value + 1024] } - return ImpreciseFraction(value, 0.0) + return Decimal(value, 0.0) } /** * Returns pooled value if present, otherwise constructs new object */ - fun valueOf(value: Long): ImpreciseFraction { + fun valueOf(value: Long): Decimal { if (value in -1024L .. 1023L) { return cache[value.toInt() + 1024] } - return ImpreciseFraction(value, 0.0) + return Decimal(value, 0.0) } /** @@ -818,81 +816,81 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do fun valueOf(value: Byte) = valueOf(value.toInt()) @JvmField - val NaN = ImpreciseFraction(0, Double.NaN) + val NaN = Decimal(0, Double.NaN) @JvmStatic - fun fromByteArray(input: ByteArray): ImpreciseFraction { + fun fromByteArray(input: ByteArray): Decimal { val size = unsignedInt(input[0]) if (size > 0) { val slice = input.copyOfRange(1, 1 + size) val bits = bytesToLongBE(input, 1 + size) - return ImpreciseFraction(BigInteger(slice), Double.fromBits(bits)) + return Decimal(BigInteger(slice), Double.fromBits(bits)) } else { - return ImpreciseFraction(BigInteger.ZERO, Double.fromBits(bytesToLongBE(input, 1))) + return Decimal(BigInteger.ZERO, Double.fromBits(bytesToLongBE(input, 1))) } } @JvmStatic - fun deserializeNBT(input: Tag?): ImpreciseFraction { + fun deserializeNBT(input: Tag?): Decimal { if (input is ByteArrayTag) { return fromByteArray(input.asByteArray) } else if (input is StringTag) { - return ImpreciseFraction(input.asString) + return Decimal(input.asString) } return ZERO } @JvmStatic - fun deserializeNBT(input: ByteArrayTag): ImpreciseFraction { + fun deserializeNBT(input: ByteArrayTag): Decimal { return fromByteArray(input.asByteArray) } @JvmStatic - fun read(buff: FriendlyByteBuf): ImpreciseFraction { - return ImpreciseFraction(BigInteger(buff.readByteArray()), buff.readDouble()) + fun read(buff: FriendlyByteBuf): Decimal { + return Decimal(BigInteger(buff.readByteArray()), buff.readDouble()) } } } -fun FriendlyByteBuf.readImpreciseFraction() = ImpreciseFraction.read(this) -fun FriendlyByteBuf.writeImpreciseFraction(value: ImpreciseFraction) = value.write(this) +fun FriendlyByteBuf.readDecimal() = Decimal.read(this) +fun FriendlyByteBuf.writeDecimal(value: Decimal) = value.write(this) -fun InputStream.readImpreciseFraction(): ImpreciseFraction { +fun InputStream.readDecimal(): Decimal { val bytes = ByteArray(readVarIntLE()) read(bytes) - return ImpreciseFraction(BigInteger(bytes), readDouble()) + return Decimal(BigInteger(bytes), readDouble()) } -fun OutputStream.writeImpreciseFraction(value: ImpreciseFraction) { +fun OutputStream.writeDecimal(value: Decimal) { val bytes = value.whole.toByteArray() writeVarIntLE(bytes.size) write(bytes) writeDouble(value.decimal) } -fun CompoundTag.getImpreciseFraction(key: String) = ImpreciseFraction.deserializeNBT(this[key]) -fun CompoundTag.putImpreciseFraction(key: String, value: ImpreciseFraction) = put(key, value.serializeNBT()) +fun CompoundTag.getDecimal(key: String) = Decimal.deserializeNBT(this[key]) +fun CompoundTag.putDecimal(key: String, value: Decimal) = put(key, value.serializeNBT()) -operator fun CompoundTag.set(key: String, value: ImpreciseFraction) = putImpreciseFraction(key, value) +operator fun CompoundTag.set(key: String, value: Decimal) = putDecimal(key, value) -fun Float.toImpreciseFraction() = ImpreciseFraction(this) -fun Double.toImpreciseFraction() = ImpreciseFraction(this) -fun Int.toImpreciseFraction() = ImpreciseFraction(this) -fun Byte.toImpreciseFraction() = ImpreciseFraction(this) -fun Short.toImpreciseFraction() = ImpreciseFraction(this) -fun Long.toImpreciseFraction() = ImpreciseFraction(this) -fun ImpreciseFraction.toImpreciseFraction() = this +fun Float.toDecimal() = Decimal(this) +fun Double.toDecimal() = Decimal(this) +fun Int.toDecimal() = Decimal(this) +fun Byte.toDecimal() = Decimal(this) +fun Short.toDecimal() = Decimal(this) +fun Long.toDecimal() = Decimal(this) +fun Decimal.toDecimal() = this -class ImpreciseFractionConfigValue( +class DecimalConfigValue( parent: ForgeConfigSpec.ConfigValue, - val minimum: ImpreciseFraction? = null, - val maximum: ImpreciseFraction? = null, -) : ObservedConfigValue(parent) { - override fun fromString(value: String): ImpreciseFraction? { + val minimum: Decimal? = null, + val maximum: Decimal? = null, +) : ObservedConfigValue(parent) { + override fun fromString(value: String): Decimal? { try { - val parsed = ImpreciseFraction(value) + val parsed = Decimal(value) if (minimum != null && minimum > parsed) { return minimum @@ -906,7 +904,7 @@ class ImpreciseFractionConfigValue( } } - override fun toString(value: ImpreciseFraction): Pair { + override fun toString(value: Decimal): Pair { if (minimum != null && minimum > value) { return minimum.toString() to minimum } else if (maximum != null && maximum < value) { @@ -917,7 +915,7 @@ class ImpreciseFractionConfigValue( } } -private fun ForgeConfigSpec.Builder.commentRange(minimum: ImpreciseFraction?, maximum: ImpreciseFraction?) { +private fun ForgeConfigSpec.Builder.commentRange(minimum: Decimal?, maximum: Decimal?) { if (minimum != null && maximum != null) { comment("Range: $minimum ~ $maximum") } else if (minimum != null) { @@ -927,14 +925,14 @@ private fun ForgeConfigSpec.Builder.commentRange(minimum: ImpreciseFraction?, ma } } -fun ForgeConfigSpec.Builder.defineImpreciseFraction(path: String, defaultValue: ImpreciseFraction, minimum: ImpreciseFraction? = null, maximum: ImpreciseFraction? = null): ImpreciseFractionConfigValue { +fun ForgeConfigSpec.Builder.defineDecimal(path: String, defaultValue: Decimal, minimum: Decimal? = null, maximum: Decimal? = null): DecimalConfigValue { commentRange(minimum, maximum) comment("Default: $defaultValue") - return ImpreciseFractionConfigValue(define(path, defaultValue.toString()), minimum, maximum) + return DecimalConfigValue(define(path, defaultValue.toString()), minimum, maximum) } -fun ForgeConfigSpec.Builder.defineImpreciseFraction(path: List, defaultValue: ImpreciseFraction, minimum: ImpreciseFraction? = null, maximum: ImpreciseFraction? = null): ImpreciseFractionConfigValue { +fun ForgeConfigSpec.Builder.defineDecimal(path: List, defaultValue: Decimal, minimum: Decimal? = null, maximum: Decimal? = null): DecimalConfigValue { commentRange(minimum, maximum) comment("Default: $defaultValue") - return ImpreciseFractionConfigValue(define(path, defaultValue.toString()), minimum, maximum) + return DecimalConfigValue(define(path, defaultValue.toString()), minimum, maximum) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt index e4b002a44..614b49645 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Ext.kt @@ -50,13 +50,13 @@ fun Number.dynPlus(other: Number): Number { is Short -> this + other.toShort() is Byte -> this + other.toByte() - is ImpreciseFraction -> { + is Decimal -> { when (other) { is Float -> this + other.toFloat() is Double -> this + other.toDouble() is Int, is Byte, is Short -> this + other.toInt() is Long -> this + other.toLong() - is ImpreciseFraction -> this + other + is Decimal -> this + other is Fraction -> this + other.toImpreciseFraction() else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -68,7 +68,7 @@ fun Number.dynPlus(other: Number): Number { is Double -> this + other.toDouble() is Int, is Byte, is Short -> this + other.toInt() is Long -> this + other.toLong() - is ImpreciseFraction -> this + other.toFraction() + is Decimal -> this + other.toFraction() is Fraction -> this + other else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -92,13 +92,13 @@ fun Number.dynMinus(other: Number): Number { is Short -> this - other.toShort() is Byte -> this - other.toByte() - is ImpreciseFraction -> { + is Decimal -> { when (other) { is Float -> this - other.toFloat() is Double -> this - other.toDouble() is Int, is Byte, is Short -> this - other.toInt() is Long -> this - other.toLong() - is ImpreciseFraction -> this - other + is Decimal -> this - other is Fraction -> this - other.toImpreciseFraction() else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -110,7 +110,7 @@ fun Number.dynMinus(other: Number): Number { is Double -> this - other.toDouble() is Int, is Byte, is Short -> this - other.toInt() is Long -> this - other.toLong() - is ImpreciseFraction -> this - other.toFraction() + is Decimal -> this - other.toFraction() is Fraction -> this - other else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -134,13 +134,13 @@ fun Number.dynTimes(other: Number): Number { is Short -> this * other.toShort() is Byte -> this * other.toByte() - is ImpreciseFraction -> { + is Decimal -> { when (other) { is Float -> this * other.toFloat() is Double -> this * other.toDouble() is Int, is Byte, is Short -> this * other.toInt() is Long -> this * other.toLong() - is ImpreciseFraction -> this * other + is Decimal -> this * other is Fraction -> this * other.toImpreciseFraction() else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -152,7 +152,7 @@ fun Number.dynTimes(other: Number): Number { is Double -> this * other.toDouble() is Int, is Byte, is Short -> this * other.toInt() is Long -> this * other.toLong() - is ImpreciseFraction -> this * other.toFraction() + is Decimal -> this * other.toFraction() is Fraction -> this * other else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -176,13 +176,13 @@ fun Number.dynDiv(other: Number): Number { is Short -> this / other.toShort() is Byte -> this / other.toByte() - is ImpreciseFraction -> { + is Decimal -> { when (other) { is Float -> this / other.toFloat() is Double -> this / other.toDouble() is Int, is Byte, is Short -> this / other.toInt() is Long -> this / other.toLong() - is ImpreciseFraction -> this / other + is Decimal -> this / other is Fraction -> this / other.toImpreciseFraction() else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -194,7 +194,7 @@ fun Number.dynDiv(other: Number): Number { is Double -> this / other.toDouble() is Int, is Byte, is Short -> this / other.toInt() is Long -> this / other.toLong() - is ImpreciseFraction -> this / other.toFraction() + is Decimal -> this / other.toFraction() is Fraction -> this / other else -> throw IllegalStateException("I don't know what to do with ${other::class.qualifiedName} (right hand operand)") } @@ -204,18 +204,18 @@ fun Number.dynDiv(other: Number): Number { } } -val Number.isFractional get() = this is Float || this is Double || this is ImpreciseFraction || this is Fraction +val Number.isFractional get() = this is Float || this is Double || this is Decimal || this is Fraction val Number.isWhole get() = !isFractional -fun Number.toImpreciseFraction(): ImpreciseFraction { +fun Number.toDecimal(): Decimal { return when (this) { - is ImpreciseFraction -> this - is Float -> ImpreciseFraction(this) - is Double -> ImpreciseFraction(this) - is Int -> ImpreciseFraction(this) - is Byte -> ImpreciseFraction(this) - is Short -> ImpreciseFraction(this) - is Long -> ImpreciseFraction(this) + is Decimal -> this + is Float -> Decimal(this) + is Double -> Decimal(this) + is Int -> Decimal(this) + is Byte -> Decimal(this) + is Short -> Decimal(this) + is Long -> Decimal(this) is Fraction -> this.toImpreciseFraction() else -> throw ClassCastException("Can not turn $this into ImpreciseFraction") } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Formatting.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Formatting.kt index 5a4d9c717..70dbdba68 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Formatting.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Formatting.kt @@ -88,7 +88,7 @@ enum class SiPrefix( val decimal = BigDecimal(string) val fraction = Fraction(decimal) - val impreciseFraction = ImpreciseFraction(string) + val impreciseFraction = Decimal(string) val integer = if (!fractional) BigInteger(string) else null val long = if (!fractional) string.toLongOrNull() else null @@ -280,7 +280,7 @@ fun BigInteger.formatSiComponent(suffix: Any = "", decimalPlaces: Int = 2): Comp return TranslatableComponent(prefix.formatLocaleKey, String(buffer), suffix) } -fun ImpreciseFraction.determineSiPrefix(): SiPrefix? { +fun Decimal.determineSiPrefix(): SiPrefix? { if (isZero) { return null } @@ -293,7 +293,7 @@ fun ImpreciseFraction.determineSiPrefix(): SiPrefix? { var prev: SiPrefix? = null - if (num >= ImpreciseFraction.ONE) { + if (num >= Decimal.ONE) { for (value in SiPrefix.MULTIPLIES) { if (value.impreciseFraction <= num) { prev = value @@ -366,7 +366,7 @@ fun Double.determineSiPrefix(): SiPrefix? { return prev } -fun ImpreciseFraction.formatSi(decimalPlaces: Int = 2): String { +fun Decimal.formatSi(decimalPlaces: Int = 2): String { require(decimalPlaces >= 0) { "Invalid amount of decimal places required: $decimalPlaces" } val prefix = determineSiPrefix() ?: return toString(decimalPlaces) return (this / prefix.impreciseFraction).toString(decimalPlaces) + prefix.symbol @@ -384,7 +384,7 @@ fun Double.formatSiComponent(suffix: Any = "", decimalPlaces: Int = 2): Componen return TranslatableComponent(prefix.formatLocaleKey, "%.${decimalPlaces}f".format(this / prefix.double), suffix) } -fun ImpreciseFraction.formatSiComponent(suffix: Any = "", decimalPlaces: Int = 2): Component { +fun Decimal.formatSiComponent(suffix: Any = "", decimalPlaces: Int = 2): Component { require(decimalPlaces >= 0) { "Invalid amount of decimal places required: $decimalPlaces" } val prefix = determineSiPrefix() ?: return if (suffix == "") TextComponent(toString(decimalPlaces)) else if (suffix is Component) TextComponent(toString(decimalPlaces) + " " + suffix.string) else TextComponent(toString(decimalPlaces) + " " + suffix) return TranslatableComponent(prefix.formatLocaleKey, (this / prefix.impreciseFraction).toString(decimalPlaces), suffix) @@ -395,16 +395,16 @@ val MATTER_NAME = TranslatableComponent("otm.gui.matter.name") fun Int.formatPower(decimalPlaces: Int = 2) = formatSiComponent(POWER_NAME, decimalPlaces) -fun ImpreciseFraction.formatPower(decimalPlaces: Int = 2) = formatSiComponent(POWER_NAME, decimalPlaces) -fun ImpreciseFraction.formatMatter(decimalPlaces: Int = 2) = formatSiComponent(MATTER_NAME, decimalPlaces) -fun ImpreciseFraction.formatMatterFull(decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.matter.format", formatSiComponent(MATTER_NAME, decimalPlaces)) +fun Decimal.formatPower(decimalPlaces: Int = 2) = formatSiComponent(POWER_NAME, decimalPlaces) +fun Decimal.formatMatter(decimalPlaces: Int = 2) = formatSiComponent(MATTER_NAME, decimalPlaces) +fun Decimal.formatMatterFull(decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.matter.format", formatSiComponent(MATTER_NAME, decimalPlaces)) fun BigInteger.formatPower(decimalPlaces: Int = 2) = formatSiComponent(POWER_NAME, decimalPlaces) fun BigInteger.formatMatter(decimalPlaces: Int = 2) = formatSiComponent(MATTER_NAME, decimalPlaces) fun BigInteger.formatMatterFull(decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.matter.format", formatSiComponent(MATTER_NAME, decimalPlaces)) -fun formatPowerLevel(a: ImpreciseFraction, b: ImpreciseFraction, decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.level", a.formatPower(decimalPlaces), b.formatPower(decimalPlaces)) -fun formatMatterLevel(a: ImpreciseFraction, b: ImpreciseFraction, decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.level", a.formatMatter(decimalPlaces), b.formatMatter(decimalPlaces)) +fun formatPowerLevel(a: Decimal, b: Decimal, decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.level", a.formatPower(decimalPlaces), b.formatPower(decimalPlaces)) +fun formatMatterLevel(a: Decimal, b: Decimal, decimalPlaces: Int = 2) = TranslatableComponent("otm.gui.level", a.formatMatter(decimalPlaces), b.formatMatter(decimalPlaces)) private fun padded(num: Int): String { if (num in 0 .. 9) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt index 2b7c8d6d8..4733891a5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/Fraction.kt @@ -602,25 +602,25 @@ class Fraction @JvmOverloads constructor( return (value / divisor).toDouble() + ((value % divisor).toDouble() / divisor.toDouble()) } - fun toImpreciseFraction(): ImpreciseFraction { + fun toImpreciseFraction(): Decimal { if (isNaN()) - return ImpreciseFraction.NaN + return Decimal.NaN val div = value.divideAndRemainder(divisor) val a = divisor.toDouble() val b = div[1].toDouble() if (b == 0.0 || !a.isFinite() || !b.isFinite()) { - return ImpreciseFraction(div[0]) + return Decimal(div[0]) } val div2 = a / b if (div2.isFinite() && !div2.isNaN()) { - return ImpreciseFraction(div[0], div2) + return Decimal(div[0], div2) } - return ImpreciseFraction(div[0]) + return Decimal(div[0]) } fun toByteArray(): ByteArray { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt index 6ace7adea..d9251d542 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt @@ -6,7 +6,7 @@ import net.minecraft.world.item.Item import net.minecraft.world.level.block.entity.BlockEntity import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.matter.* -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.graph.Abstract6Graph import ru.dbotthepony.mc.otm.graph.Graph6Node import java.util.* @@ -73,8 +73,8 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe } } - fun getMatterStorageLevel(): ImpreciseFraction { - var level = ImpreciseFraction.ZERO + fun getMatterStorageLevel(): Decimal { + var level = Decimal.ZERO for (node in nodes) { val matter = node.value.getMatterHandler() @@ -87,8 +87,8 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe return level } - fun getMatterStorageMaxLevel(): ImpreciseFraction { - var level = ImpreciseFraction.ZERO + fun getMatterStorageMaxLevel(): Decimal { + var level = Decimal.ZERO for (node in nodes) { val matter = node.value.getMatterHandler() @@ -101,13 +101,13 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe return level } - fun extractMatter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - if (howMuch <= ImpreciseFraction.ZERO) - return ImpreciseFraction.ZERO + fun extractMatter(howMuch: Decimal, simulate: Boolean): Decimal { + if (howMuch <= Decimal.ZERO) + return Decimal.ZERO @Suppress("name_shadowing") var howMuch = howMuch - var extracted = ImpreciseFraction.ZERO + var extracted = Decimal.ZERO for (node in nodes) { val matter = node.value.getMatterHandler() @@ -117,7 +117,7 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe howMuch -= value extracted += value - if (howMuch <= ImpreciseFraction.ZERO) + if (howMuch <= Decimal.ZERO) return extracted } } @@ -125,13 +125,13 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe return extracted } - fun receiveMatter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - if (howMuch <= ImpreciseFraction.ZERO) - return ImpreciseFraction.ZERO + fun receiveMatter(howMuch: Decimal, simulate: Boolean): Decimal { + if (howMuch <= Decimal.ZERO) + return Decimal.ZERO @Suppress("name_shadowing") var howMuch = howMuch - var received = ImpreciseFraction.ZERO + var received = Decimal.ZERO for (node in nodes) { val matter = node.value.getMatterHandler() @@ -141,7 +141,7 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe howMuch -= value received += value - if (howMuch <= ImpreciseFraction.ZERO) + if (howMuch <= Decimal.ZERO) return received } } @@ -149,13 +149,13 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe return received } - fun receiveMatterForce(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - if (howMuch <= ImpreciseFraction.ZERO) - return ImpreciseFraction.ZERO + fun receiveMatterForce(howMuch: Decimal, simulate: Boolean): Decimal { + if (howMuch <= Decimal.ZERO) + return Decimal.ZERO @Suppress("name_shadowing") var howMuch = howMuch - var received = ImpreciseFraction.ZERO + var received = Decimal.ZERO for (node in nodes) { val matter = node.value.getMatterHandler() @@ -165,7 +165,7 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe howMuch -= value received += value - if (howMuch <= ImpreciseFraction.ZERO) + if (howMuch <= Decimal.ZERO) return received } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt index 179f2fab2..02a5b8bb8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt @@ -18,7 +18,6 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider import ru.dbotthepony.mc.otm.BatteryBalanceValues import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.ServerConfig -import ru.dbotthepony.mc.otm.VerboseBalanceValues import ru.dbotthepony.mc.otm.capability.* import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.* @@ -28,50 +27,50 @@ import kotlin.math.roundToInt open class BatteryItem : Item { private inner class Power(stack: ItemStack) : EnergyCapacitorItem(stack, this@BatteryItem.capacity, this@BatteryItem.receive, this@BatteryItem.extract, initialBatteryLevel = this@BatteryItem.initialBatteryLevel) { - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (isCreative) return howMuch return super.extractEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (isCreative) return howMuch return super.receiveEnergyInner(howMuch, simulate) } - override val missingPower: ImpreciseFraction get() { - return if (isCreative) ImpreciseFraction.LONG_MAX_VALUE else super.missingPower + override val missingPower: Decimal get() { + return if (isCreative) Decimal.LONG_MAX_VALUE else super.missingPower } fun maxPower() { batteryLevel = maxBatteryLevel } - override var batteryLevel: ImpreciseFraction - get() { return if (isCreative) ImpreciseFraction.LONG_MAX_VALUE else super.batteryLevel } + override var batteryLevel: Decimal + get() { return if (isCreative) Decimal.LONG_MAX_VALUE else super.batteryLevel } set(value) { super.batteryLevel = value } } private val isCreative: Boolean - val _capacity: () -> ImpreciseFraction - val _receive: () -> ImpreciseFraction - val _extract: () -> ImpreciseFraction - val _initialBatteryLevel: () -> ImpreciseFraction + val _capacity: () -> Decimal + val _receive: () -> Decimal + val _extract: () -> Decimal + val _initialBatteryLevel: () -> Decimal - val capacity: ImpreciseFraction + val capacity: Decimal get() = _capacity.invoke() - val receive: ImpreciseFraction + val receive: Decimal get() = _receive.invoke() - val extract: ImpreciseFraction + val extract: Decimal get() = _extract.invoke() - val initialBatteryLevel: ImpreciseFraction + val initialBatteryLevel: Decimal get() = _initialBatteryLevel.invoke() constructor( - storage: ImpreciseFraction, - receive: ImpreciseFraction, - extract: ImpreciseFraction = receive, - initialBatteryLevel: ImpreciseFraction = ImpreciseFraction.ZERO + storage: Decimal, + receive: Decimal, + extract: Decimal = receive, + initialBatteryLevel: Decimal = Decimal.ZERO ) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = false this._capacity = { storage } @@ -81,10 +80,10 @@ open class BatteryItem : Item { } constructor( - storage: () -> ImpreciseFraction, - receive: () -> ImpreciseFraction, - extract: () -> ImpreciseFraction = receive, - initialBatteryLevel: () -> ImpreciseFraction = { ImpreciseFraction.ZERO } + storage: () -> Decimal, + receive: () -> Decimal, + extract: () -> Decimal = receive, + initialBatteryLevel: () -> Decimal = { Decimal.ZERO } ) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = false this._capacity = storage @@ -103,10 +102,10 @@ open class BatteryItem : Item { constructor() : super(Properties().stacksTo(1).rarity(Rarity.EPIC).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = true - _capacity = { ImpreciseFraction.LONG_MAX_VALUE } - _receive = { ImpreciseFraction.LONG_MAX_VALUE } - _extract = { ImpreciseFraction.LONG_MAX_VALUE } - _initialBatteryLevel = { ImpreciseFraction.LONG_MAX_VALUE } + _capacity = { Decimal.LONG_MAX_VALUE } + _receive = { Decimal.LONG_MAX_VALUE } + _extract = { Decimal.LONG_MAX_VALUE } + _initialBatteryLevel = { Decimal.LONG_MAX_VALUE } } override fun isBarVisible(p_150899_: ItemStack): Boolean { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt index 3ef25f266..d8ad325eb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt @@ -35,10 +35,10 @@ import ru.dbotthepony.mc.otm.capability.getBarColor import ru.dbotthepony.mc.otm.capability.getBarWidth import ru.dbotthepony.mc.otm.capability.matteryEnergy import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.ImpreciseFractionConfigValue +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.DecimalConfigValue import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.defineImpreciseFraction +import ru.dbotthepony.mc.otm.core.defineDecimal import ru.dbotthepony.mc.otm.core.ifPresentK import ru.dbotthepony.mc.otm.core.orNull import ru.dbotthepony.mc.otm.registry.EMPDamageSource @@ -220,20 +220,20 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(Ov val COBWEB_POWER_COST get() = _COBWEB_POWER_COST.get() val PLANT_POWER_COST get() = _PLANT_POWER_COST.get() - private var _MAX_ENERGY: ImpreciseFractionConfigValue by WriteOnce() - private var _ENERGY_ZAP: ImpreciseFractionConfigValue by WriteOnce() - private var _ENERGY_PER_SWING: ImpreciseFractionConfigValue by WriteOnce() - private var _COBWEB_POWER_COST: ImpreciseFractionConfigValue by WriteOnce() - private var _PLANT_POWER_COST: ImpreciseFractionConfigValue by WriteOnce() + private var _MAX_ENERGY: DecimalConfigValue by WriteOnce() + private var _ENERGY_ZAP: DecimalConfigValue by WriteOnce() + private var _ENERGY_PER_SWING: DecimalConfigValue by WriteOnce() + private var _COBWEB_POWER_COST: DecimalConfigValue by WriteOnce() + private var _PLANT_POWER_COST: DecimalConfigValue by WriteOnce() fun registerConfig(builder: ForgeConfigSpec.Builder) { builder.comment("Energy sword values").push("energy_sword") - _MAX_ENERGY = builder.defineImpreciseFraction("MAX_ENERGY", ImpreciseFraction(500_000), ImpreciseFraction.ZERO) - _ENERGY_ZAP = builder.defineImpreciseFraction("ENERGY_ZAP", ImpreciseFraction(4_000), ImpreciseFraction.ZERO) - _ENERGY_PER_SWING = builder.defineImpreciseFraction("ENERGY_PER_SWING", ImpreciseFraction(2_000), ImpreciseFraction.ZERO) - _COBWEB_POWER_COST = builder.defineImpreciseFraction("COBWEB_POWER_COST", ImpreciseFraction(2_500), ImpreciseFraction.ZERO) - _PLANT_POWER_COST = builder.defineImpreciseFraction("PLANT_POWER_COST", ImpreciseFraction(500), ImpreciseFraction.ZERO) + _MAX_ENERGY = builder.defineDecimal("MAX_ENERGY", Decimal(500_000), Decimal.ZERO) + _ENERGY_ZAP = builder.defineDecimal("ENERGY_ZAP", Decimal(4_000), Decimal.ZERO) + _ENERGY_PER_SWING = builder.defineDecimal("ENERGY_PER_SWING", Decimal(2_000), Decimal.ZERO) + _COBWEB_POWER_COST = builder.defineDecimal("COBWEB_POWER_COST", Decimal(2_500), Decimal.ZERO) + _PLANT_POWER_COST = builder.defineDecimal("PLANT_POWER_COST", Decimal(500), Decimal.ZERO) builder.pop() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterCapacitorItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterCapacitorItem.kt index 4920897e6..612c6a831 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterCapacitorItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterCapacitorItem.kt @@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.matter.* -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.formatMatter import ru.dbotthepony.mc.otm.core.ifPresentK import ru.dbotthepony.mc.otm.core.tagNotNull @@ -35,30 +35,30 @@ class MatterCapacitorItem : Item { return if (cap === MatteryCapability.MATTER) resolver.cast() else LazyOptional.empty() } - override var storedMatter: ImpreciseFraction + override var storedMatter: Decimal get() { val tag = stack.orCreateTag return if (tag.contains("matter")) { - ImpreciseFraction.deserializeNBT(tag["matter"]) - } else ImpreciseFraction.ZERO + Decimal.deserializeNBT(tag["matter"]) + } else Decimal.ZERO } set(value) { stack.tagNotNull.put("matter", value.serializeNBT()) } - override val maxStoredMatter: ImpreciseFraction get() { + override val maxStoredMatter: Decimal get() { return capacity } - override val missingMatter: ImpreciseFraction get() { - return if (isCreative) ImpreciseFraction.LONG_MAX_VALUE else super.missingMatter + override val missingMatter: Decimal get() { + return if (isCreative) Decimal.LONG_MAX_VALUE else super.missingMatter } - override fun receiveMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveMatterInner(howMuch, simulate) } - override fun receiveMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { if (isCreative) return howMuch val new = storedMatter.plus(howMuch.coerceAtMost(maxInput)).coerceAtMost(capacity) val diff = new.minus(storedMatter) @@ -70,11 +70,11 @@ class MatterCapacitorItem : Item { return diff } - override fun extractMatterOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractMatterOuter(howMuch: Decimal, simulate: Boolean): Decimal { return extractMatterInner(howMuch, simulate) } - override fun extractMatterInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractMatterInner(howMuch: Decimal, simulate: Boolean): Decimal { if (isCreative) return howMuch val new = storedMatter.minus(howMuch.coerceAtMost(maxOutput)).moreThanZero() val diff = storedMatter.minus(new) @@ -89,24 +89,24 @@ class MatterCapacitorItem : Item { override val direction = MatterDirection.BIDIRECTIONAL } - private val _capacity: () -> ImpreciseFraction + private val _capacity: () -> Decimal val capacity get() = _capacity.invoke() private val isCreative: Boolean - constructor(storage: ImpreciseFraction) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { + constructor(storage: Decimal) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = false _capacity = { storage } } - constructor(storage: () -> ImpreciseFraction) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { + constructor(storage: () -> Decimal) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = false _capacity = storage } constructor() : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).rarity(Rarity.EPIC)) { isCreative = true - _capacity = { ImpreciseFraction.LONG_MAX_VALUE } + _capacity = { Decimal.LONG_MAX_VALUE } } override fun fillItemCategory(p_41391_: CreativeModeTab, p_41392_: NonNullList) { @@ -171,8 +171,8 @@ class MatterCapacitorItem : Item { } companion object { - private val maxInput = ImpreciseFraction.LONG_MAX_VALUE - private val maxOutput = ImpreciseFraction.LONG_MAX_VALUE + private val maxInput = Decimal.LONG_MAX_VALUE + private val maxOutput = Decimal.LONG_MAX_VALUE private val INFINITE_STORAGE: Component = TranslatableComponent("otm.item.matter.infinite").withStyle(ChatFormatting.GRAY) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt index 3e3d57bdd..73bf251da 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt @@ -9,24 +9,24 @@ import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.ServerConfig import ru.dbotthepony.mc.otm.core.TranslatableComponent -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.matter.IMatterItem import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.matter.IMatterValue import ru.dbotthepony.mc.otm.matter.MatterValue class MatterDustItem : Item(Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)), IMatterItem { - private fun matter(stack: ItemStack): ImpreciseFraction { - return stack.tag?.get("matter")?.let { return@let ImpreciseFraction.deserializeNBT(it) } ?: return ImpreciseFraction.ZERO + private fun matter(stack: ItemStack): Decimal { + return stack.tag?.get("matter")?.let { return@let Decimal.deserializeNBT(it) } ?: return Decimal.ZERO } - private fun matter(stack: ItemStack, matter: ImpreciseFraction) { + private fun matter(stack: ItemStack, matter: Decimal) { stack.orCreateTag["matter"] = matter.serializeNBT() } override fun getMatterValue(stack: ItemStack): IMatterValue? { val value = stack.tag?.get("matter") ?: return null - return MatterValue(ImpreciseFraction.deserializeNBT(value), 1.0) + return MatterValue(Decimal.deserializeNBT(value), 1.0) } override fun canDecompose(stack: ItemStack) = false @@ -51,14 +51,14 @@ class MatterDustItem : Item(Properties().tab(OverdriveThatMatters.INSTANCE.CREAT } } - fun addMatterValue(stack: ItemStack, matter: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + fun addMatterValue(stack: ItemStack, matter: Decimal, simulate: Boolean): Decimal { if (stack.count != 1) - return ImpreciseFraction.ZERO + return Decimal.ZERO val matterThis = matter(stack) if (matterThis >= ServerConfig.MATTER_DUST_CAPACITY) - return ImpreciseFraction.ZERO + return Decimal.ZERO val newMatter = (matterThis + matter).coerceAtMost(ServerConfig.MATTER_DUST_CAPACITY) val diff = newMatter - matterThis diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/QuantumBatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/QuantumBatteryItem.kt index cd7ef386c..7bdc4ee87 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/QuantumBatteryItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/QuantumBatteryItem.kt @@ -9,7 +9,6 @@ import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.Tag import net.minecraft.network.FriendlyByteBuf import net.minecraft.network.chat.Component -import net.minecraft.util.Mth import net.minecraft.world.item.* import net.minecraft.world.level.Level import net.minecraftforge.client.event.ClientPlayerNetworkEvent @@ -25,13 +24,10 @@ import net.minecraftforge.registries.ForgeRegistry import ru.dbotthepony.mc.otm.* import ru.dbotthepony.mc.otm.capability.* import ru.dbotthepony.mc.otm.compat.mekanism.Mattery2MekanismEnergyWrapper -import ru.dbotthepony.mc.otm.core.itemStackIterator -import ru.dbotthepony.mc.otm.core.nonEmpty import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.network.GenericNetworkChannel import ru.dbotthepony.mc.otm.network.MatteryPacket import ru.dbotthepony.mc.otm.network.packetHandled -import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.saveddata.SavedCountingMap import java.util.function.Supplier @@ -39,17 +35,17 @@ class QuantumBatteryItem : Item { class Data( val parent: SavedCountingMap?, val index: Int = -1, - energy: ImpreciseFraction = ImpreciseFraction.ZERO, - passed: ImpreciseFraction = ImpreciseFraction.ZERO, - received: ImpreciseFraction = ImpreciseFraction.ZERO, + energy: Decimal = Decimal.ZERO, + passed: Decimal = Decimal.ZERO, + received: Decimal = Decimal.ZERO, ) { constructor( - energy: ImpreciseFraction = ImpreciseFraction.ZERO, - passed: ImpreciseFraction = ImpreciseFraction.ZERO, - received: ImpreciseFraction = ImpreciseFraction.ZERO, + energy: Decimal = Decimal.ZERO, + passed: Decimal = Decimal.ZERO, + received: Decimal = Decimal.ZERO, ) : this(null, -1, energy, passed, received) - var energy: ImpreciseFraction = energy + var energy: Decimal = energy set(value) { if (field != value) { field = value @@ -57,7 +53,7 @@ class QuantumBatteryItem : Item { } } - var passed: ImpreciseFraction = passed + var passed: Decimal = passed set(value) { if (field != value) { field = value @@ -65,7 +61,7 @@ class QuantumBatteryItem : Item { } } - var received: ImpreciseFraction = received + var received: Decimal = received set(value) { if (field != value) { field = value @@ -90,20 +86,20 @@ class QuantumBatteryItem : Item { return LazyOptional.empty() } - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return extractEnergyInner(howMuch, simulate) } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (howMuch.isNegative) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (data.parent == null && isServerThread()) { determineQuantumLink() if (data.parent == null) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } } @@ -130,20 +126,20 @@ class QuantumBatteryItem : Item { return diff } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (howMuch.isNegative) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } if (data.parent == null && isServerThread()) { determineQuantumLink() if (data.parent == null) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } } @@ -157,7 +153,7 @@ class QuantumBatteryItem : Item { } if (data.energy >= capacity!!) { - return ImpreciseFraction.ZERO + return Decimal.ZERO } val newEnergy = (data.energy + howMuch.coerceAtMost(throughput!!)).coerceAtMost(capacity!!) @@ -171,7 +167,7 @@ class QuantumBatteryItem : Item { return diff } - override val batteryLevel: ImpreciseFraction + override val batteryLevel: Decimal get() { if (data.parent == null) { determineQuantumLink() @@ -184,7 +180,7 @@ class QuantumBatteryItem : Item { return data.energy } - val passed: ImpreciseFraction get() { + val passed: Decimal get() { if (data.parent == null) { determineQuantumLink() } @@ -196,7 +192,7 @@ class QuantumBatteryItem : Item { return data.passed } - val received: ImpreciseFraction get() { + val received: Decimal get() { if (data.parent == null) { determineQuantumLink() } @@ -208,11 +204,11 @@ class QuantumBatteryItem : Item { return data.received } - override val maxBatteryLevel: ImpreciseFraction - get() = capacity ?: (batteryLevel + ImpreciseFraction.LONG_MAX_VALUE) + override val maxBatteryLevel: Decimal + get() = capacity ?: (batteryLevel + Decimal.LONG_MAX_VALUE) - override val missingPower: ImpreciseFraction - get() = if (isCreative) ImpreciseFraction.LONG_MAX_VALUE else super.missingPower + override val missingPower: Decimal + get() = if (isCreative) Decimal.LONG_MAX_VALUE else super.missingPower override fun canExtract(): Boolean { return true @@ -263,8 +259,8 @@ class QuantumBatteryItem : Item { val isCreative: Boolean - private val _capacity: () -> ImpreciseFraction? - private val _throughput: () -> ImpreciseFraction? + private val _capacity: () -> Decimal? + private val _throughput: () -> Decimal? val capacity get() = _capacity.invoke() val throughput get() = _throughput.invoke() @@ -284,9 +280,9 @@ class QuantumBatteryItem : Item { } data class ClientData( - val energy: ImpreciseFraction = ImpreciseFraction.ZERO, - val passed: ImpreciseFraction = ImpreciseFraction.ZERO, - val received: ImpreciseFraction = ImpreciseFraction.ZERO, + val energy: Decimal = Decimal.ZERO, + val passed: Decimal = Decimal.ZERO, + val received: Decimal = Decimal.ZERO, ) val clientPowerMap: Int2ObjectAVLTreeMap by lazy { @@ -301,7 +297,7 @@ class QuantumBatteryItem : Item { this.saveDataID = "otm_$saveDataID".intern() } - constructor(saveDataID: String, capacity: ImpreciseFraction, io: ImpreciseFraction) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { + constructor(saveDataID: String, capacity: Decimal, io: Decimal) : super(Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { isCreative = false _capacity = { capacity } _throughput = { io } @@ -385,9 +381,9 @@ class QuantumBatteryItem : Item { return ChargePacket( (ForgeRegistries.ITEMS as ForgeRegistry).getValue(buff.readInt()) as QuantumBatteryItem, buff.readInt(), - buff.readImpreciseFraction(), - buff.readImpreciseFraction(), - buff.readImpreciseFraction(), + buff.readDecimal(), + buff.readDecimal(), + buff.readDecimal(), ) } @@ -415,9 +411,9 @@ class QuantumBatteryItem : Item { private fun loadValue(parent: SavedCountingMap, tag: Tag, index: Int): Data { if (tag is ByteArrayTag) { - return Data(parent, index, ImpreciseFraction.deserializeNBT(tag)) + return Data(parent, index, Decimal.deserializeNBT(tag)) } else if (tag is CompoundTag) { - return Data(parent, index, ImpreciseFraction.deserializeNBT(tag["energy"]), ImpreciseFraction.deserializeNBT(tag["passed"]), ImpreciseFraction.deserializeNBT(tag["received"])) + return Data(parent, index, Decimal.deserializeNBT(tag["energy"]), Decimal.deserializeNBT(tag["passed"]), Decimal.deserializeNBT(tag["received"])) } else { return Data(parent, index) } @@ -435,16 +431,16 @@ class QuantumBatteryItem : Item { class ChargePacket( val type: QuantumBatteryItem, val channel: Int, - val energy: ImpreciseFraction, - val passed: ImpreciseFraction, - val received: ImpreciseFraction, + val energy: Decimal, + val passed: Decimal, + val received: Decimal, ) : MatteryPacket { override fun write(buff: FriendlyByteBuf) { buff.writeInt((ForgeRegistries.ITEMS as ForgeRegistry).getID(type)) buff.writeInt(channel) - buff.writeImpreciseFraction(energy) - buff.writeImpreciseFraction(passed) - buff.writeImpreciseFraction(received) + buff.writeDecimal(energy) + buff.writeDecimal(passed) + buff.writeDecimal(received) } override fun play(context: Supplier) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/SingleUseBatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/SingleUseBatteryItem.kt index 308d3a6b0..37c0bb5f8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/SingleUseBatteryItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/SingleUseBatteryItem.kt @@ -16,12 +16,12 @@ import ru.dbotthepony.mc.otm.capability.* import ru.dbotthepony.mc.otm.core.* open class SingleUseBatteryItem( - private val _capacity: () -> ImpreciseFraction, - private val _throughput: () -> ImpreciseFraction? = { null }, + private val _capacity: () -> Decimal, + private val _throughput: () -> Decimal? = { null }, properties: Properties = Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB) ) : Item(properties) { constructor(values: ConciseBalanceValues, properties: Properties = Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) : this(values::capacity, values::throughput, properties) - constructor(storage: ImpreciseFraction, throughput: ImpreciseFraction? = null, properties: Properties = Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) : this({ storage }, { throughput }, properties) + constructor(storage: Decimal, throughput: Decimal? = null, properties: Properties = Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) : this({ storage }, { throughput }, properties) val capacity get() = _capacity.invoke() val throughput get() = _throughput.invoke() @@ -70,8 +70,8 @@ class ZPMItem : SingleUseBatteryItem(ServerConfig.ZPM_BATTERY, Properties().stac } companion object { - val MAX_STORAGE = ImpreciseFraction(200_000_000_000_000L) - val THROUGHPUT = ImpreciseFraction(200_000_000L) + val MAX_STORAGE = Decimal(200_000_000_000_000L) + val THROUGHPUT = Decimal(200_000_000L) private val DESCRIPTION = TranslatableComponent("item.${OverdriveThatMatters.MOD_ID}.zpm_battery.description").withStyle(ChatFormatting.DARK_GRAY) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaRifleItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaRifleItem.kt index dc3b97c44..13c13645a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaRifleItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaRifleItem.kt @@ -1,26 +1,16 @@ package ru.dbotthepony.mc.otm.item.weapon import net.minecraft.sounds.SoundSource -import net.minecraft.util.Mth -import net.minecraft.world.entity.Entity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack -import net.minecraft.world.phys.Vec3 import ru.dbotthepony.mc.otm.capability.extractEnergyInnerExact -import ru.dbotthepony.mc.otm.capability.getBarColor -import ru.dbotthepony.mc.otm.capability.getBarWidth -import ru.dbotthepony.mc.otm.capability.matteryEnergy import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.core.Vector import ru.dbotthepony.mc.otm.entity.PlasmaProjectile import ru.dbotthepony.mc.otm.core.position import ru.dbotthepony.mc.otm.registry.MSoundEvents -import java.util.* -import kotlin.math.PI -import kotlin.math.cos -import kotlin.math.sin -class PlasmaRifleItem : PlasmaWeaponItem(PlasmaWeaponDataTable::class, ImpreciseFraction(200_000)) { +class PlasmaRifleItem : PlasmaWeaponItem(PlasmaWeaponDataTable::class, Decimal(200_000)) { override val roundsPerMinute: Int = 200 override val scopingTime: Int = 7 @@ -70,6 +60,6 @@ class PlasmaRifleItem : PlasmaWeaponItem(PlasmaWeaponData } companion object { - private val ENERGY_PER_SHOT = ImpreciseFraction(3_000) + private val ENERGY_PER_SHOT = Decimal(3_000) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaWeaponItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaWeaponItem.kt index 86b805374..d16fe3a3f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaWeaponItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/PlasmaWeaponItem.kt @@ -21,10 +21,10 @@ import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.registry.MSoundEvents import kotlin.reflect.KClass -class PlasmaWeaponEnergy(val itemStack: ItemStack, private val innerCapacity: ImpreciseFraction) : +class PlasmaWeaponEnergy(val itemStack: ItemStack, private val innerCapacity: Decimal) : IMatteryEnergyStorage, ICapabilityProvider, INBTSerializable { private val energyResolver = LazyOptional.of { this } - private var innerBatteryLevel = ImpreciseFraction.ZERO + private var innerBatteryLevel = Decimal.ZERO var battery: ItemStack = ItemStack.EMPTY @@ -44,21 +44,21 @@ class PlasmaWeaponEnergy(val itemStack: ItemStack, private val innerCapacity: Im } override fun deserializeNBT(nbt: CompoundTag) { - innerBatteryLevel = ImpreciseFraction.deserializeNBT(nbt["battery_level"]) + innerBatteryLevel = Decimal.deserializeNBT(nbt["battery_level"]) battery = ItemStack.of(nbt["battery"] as CompoundTag) } - override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { - return ImpreciseFraction.ZERO + override fun extractEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { + return Decimal.ZERO } - override fun extractEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun extractEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch - var totalExtracted = ImpreciseFraction.ZERO + var totalExtracted = Decimal.ZERO if (!battery.isEmpty) { battery.getCapability(ForgeCapabilities.ENERGY).ifPresentK { @@ -83,17 +83,17 @@ class PlasmaWeaponEnergy(val itemStack: ItemStack, private val innerCapacity: Im return diff + totalExtracted } - override fun receiveEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyOuter(howMuch: Decimal, simulate: Boolean): Decimal { return receiveEnergyInner(howMuch, simulate) } - override fun receiveEnergyInner(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { + override fun receiveEnergyInner(howMuch: Decimal, simulate: Boolean): Decimal { if (!howMuch.isPositive) - return ImpreciseFraction.ZERO + return Decimal.ZERO @Suppress("NAME_SHADOWING") var howMuch = howMuch - var totalReceived = ImpreciseFraction.ZERO + var totalReceived = Decimal.ZERO if (!battery.isEmpty) { battery.getCapability(ForgeCapabilities.ENERGY).ifPresentK { @@ -138,11 +138,11 @@ class PlasmaWeaponEnergy(val itemStack: ItemStack, private val innerCapacity: Im return true } - override val batteryLevel: ImpreciseFraction - get() = (battery.energy?.energyStoredMattery ?: ImpreciseFraction.ZERO) + innerBatteryLevel + override val batteryLevel: Decimal + get() = (battery.energy?.energyStoredMattery ?: Decimal.ZERO) + innerBatteryLevel - override val maxBatteryLevel: ImpreciseFraction - get() = (battery.energy?.maxEnergyStoredMattery ?: ImpreciseFraction.ZERO) + innerCapacity + override val maxBatteryLevel: Decimal + get() = (battery.energy?.maxEnergyStoredMattery ?: Decimal.ZERO) + innerCapacity } open class PlasmaWeaponDataTable(tag: CompoundTag) : WeaponDataTable(tag) { @@ -150,7 +150,7 @@ open class PlasmaWeaponDataTable(tag: CompoundTag) : WeaponDataTable(tag) { var heatCooldown by tag.ints } -abstract class PlasmaWeaponItem(tables: KClass, private val energyCapacity: ImpreciseFraction) : AbstractWeaponItem(tables) { +abstract class PlasmaWeaponItem(tables: KClass, private val energyCapacity: Decimal) : AbstractWeaponItem(tables) { override fun appendHoverText( itemStack: ItemStack, p_41422_: Level?, @@ -284,4 +284,4 @@ abstract class PlasmaWeaponItem(tables: KClass, pr override fun initCapabilities(stack: ItemStack, nbt: CompoundTag?): ICapabilityProvider { return PlasmaWeaponEnergy(stack, energyCapacity) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/AbstractRegistryAction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/AbstractRegistryAction.kt index d7b95ff3b..6b77baf72 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/AbstractRegistryAction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/AbstractRegistryAction.kt @@ -8,7 +8,7 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.tags.ItemTags import net.minecraft.tags.TagKey import net.minecraft.world.item.Item -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.set sealed class AbstractRegistryAction : Comparable { @@ -25,7 +25,7 @@ sealed class AbstractRegistryAction : Comparable { val errorOnFailure: Boolean val tag: TagKey? val key: ResourceLocation? - val matter: ImpreciseFraction? + val matter: Decimal? val complexity: Double? val priority: Int? @@ -50,7 +50,7 @@ sealed class AbstractRegistryAction : Comparable { } try { - matter = json["matter"]?.asString?.let(::ImpreciseFraction) + matter = json["matter"]?.asString?.let(::Decimal) if (matter != null && !matter.isPositive) { throw JsonParseException("Can't have non-positive matter value. To remove an entry from registry please use 'delete' action instead.") @@ -72,7 +72,7 @@ sealed class AbstractRegistryAction : Comparable { constructor( tag: TagKey, - matter: ImpreciseFraction?, + matter: Decimal?, complexity: Double?, priority: Int? = null, errorOnFailure: Boolean = false @@ -95,7 +95,7 @@ sealed class AbstractRegistryAction : Comparable { constructor( key: ResourceLocation, - matter: ImpreciseFraction?, + matter: Decimal?, complexity: Double?, priority: Int? = null, errorOnFailure: Boolean = false diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/BoundMatterFunction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/BoundMatterFunction.kt index 77753b9d1..f4a239e52 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/BoundMatterFunction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/BoundMatterFunction.kt @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.matter import com.google.gson.JsonElement import com.google.gson.JsonObject -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.set class BoundMatterFunction(val function: MatterFunction, val value: T) { @@ -24,7 +24,7 @@ class BoundMatterFunction(val function: MatterFunction, val value: T companion object { inline fun getValue(value: JsonElement): T { return when (T::class) { - ImpreciseFraction::class -> ImpreciseFraction(value.asString) as T + Decimal::class -> Decimal(value.asString) as T Double::class -> value.asDouble as T Int::class -> value.asInt as T else -> throw RuntimeException("Unknown number type: ${T::class.qualifiedName}") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt index 9e25a4895..9ffb62311 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/ComputeAction.kt @@ -10,7 +10,7 @@ import net.minecraft.tags.TagKey import net.minecraft.world.item.Item import net.minecraft.world.level.ItemLike import net.minecraftforge.registries.ForgeRegistries -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.data.stream @@ -78,11 +78,11 @@ class ComputeAction : AbstractRegistryAction { } class Constant : Source { - val matter: ImpreciseFraction + val matter: Decimal val complexity: Double constructor( - matter: ImpreciseFraction, + matter: Decimal, complexity: Double, matterFunction: MatterFunction, complexityFunction: MatterFunction = matterFunction, @@ -93,7 +93,7 @@ class ComputeAction : AbstractRegistryAction { constructor(json: JsonObject) : super(json) { try { - matter = ImpreciseFraction(json["matter"]?.asString ?: throw JsonSyntaxException("Missing matter value")) + matter = Decimal(json["matter"]?.asString ?: throw JsonSyntaxException("Missing matter value")) } catch(err: NumberFormatException) { throw JsonSyntaxException("Invalid matter value: ${json["matter"]}") } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterValue.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterValue.kt index e20876ee2..7fc49dd3b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterValue.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterValue.kt @@ -1,12 +1,12 @@ package ru.dbotthepony.mc.otm.matter import net.minecraft.network.FriendlyByteBuf -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.readImpreciseFraction -import ru.dbotthepony.mc.otm.core.writeImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal +import ru.dbotthepony.mc.otm.core.readDecimal +import ru.dbotthepony.mc.otm.core.writeDecimal interface IMatterValue : Comparable { - val matter: ImpreciseFraction + val matter: Decimal val complexity: Double val hasMatterValue: Boolean get() = matter.isPositive && complexity > 0.0 @@ -38,8 +38,8 @@ interface IMatterValue : Comparable { * ZERO */ companion object : IMatterValue { - override val matter: ImpreciseFraction - get() = ImpreciseFraction.ZERO + override val matter: Decimal + get() = Decimal.ZERO override val complexity: Double get() = 0.0 } @@ -47,12 +47,12 @@ interface IMatterValue : Comparable { fun FriendlyByteBuf.writeMatterValue(value: IMatterValue) { - writeImpreciseFraction(value.matter) + writeDecimal(value.matter) writeDouble(value.complexity) } fun FriendlyByteBuf.readMatterValue(): IMatterValue { - val matter = readImpreciseFraction() + val matter = readDecimal() val complexity = readDouble() if (matter.isZero && complexity == 0.0) { @@ -63,6 +63,6 @@ fun FriendlyByteBuf.readMatterValue(): IMatterValue { } data class MatterValue( - override val matter: ImpreciseFraction, + override val matter: Decimal, override val complexity: Double ) : IMatterValue diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/InsertAction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/InsertAction.kt index 218b23f37..b0f54b201 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/InsertAction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/InsertAction.kt @@ -4,7 +4,7 @@ import com.google.gson.JsonObject import net.minecraft.resources.ResourceLocation import net.minecraft.tags.TagKey import net.minecraft.world.item.Item -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.probablyParallelStream import ru.dbotthepony.mc.otm.core.set @@ -14,7 +14,7 @@ class InsertAction : AbstractRegistryAction { constructor( key: ResourceLocation, - matter: ImpreciseFraction?, + matter: Decimal?, complexity: Double?, priority: Int? = null, errorOnFailure: Boolean = false, @@ -27,7 +27,7 @@ class InsertAction : AbstractRegistryAction { constructor( tag: TagKey, - matter: ImpreciseFraction?, + matter: Decimal?, complexity: Double?, priority: Int? = null, errorOnFailure: Boolean = false, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterDataProvider.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterDataProvider.kt index cec30e258..e2a37e01d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterDataProvider.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterDataProvider.kt @@ -8,7 +8,7 @@ import net.minecraft.tags.TagKey import net.minecraft.world.item.Item import net.minecraft.world.level.ItemLike import net.minecraftforge.data.event.GatherDataEvent -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.registryName import java.util.Collections import java.util.function.Consumer @@ -22,7 +22,7 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na sealed class Configuration(val name: ResourceLocation) { var errorOnFailure: Boolean = false - var matter: ImpreciseFraction? = null + var matter: Decimal? = null var complexity: Double? = null var priority: Int? = null @@ -50,7 +50,7 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na } protected fun checkMatterValues() { - check(matter == null || (matter ?: throw ConcurrentModificationException()) >= ImpreciseFraction.ZERO) { "Invalid matter value: ${matter ?: throw ConcurrentModificationException()}" } + check(matter == null || (matter ?: throw ConcurrentModificationException()) >= Decimal.ZERO) { "Invalid matter value: ${matter ?: throw ConcurrentModificationException()}" } check(complexity == null || (complexity ?: throw ConcurrentModificationException()) >= 0.0) { "Invalid matter value: ${matter ?: throw ConcurrentModificationException()}" } } @@ -139,22 +139,22 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na return this } - fun plus(matter: ImpreciseFraction, complexity: Double): ComputeConfiguration { + fun plus(matter: Decimal, complexity: Double): ComputeConfiguration { values.add(ComputeAction.Constant(matter, complexity, MatterFunction.ADD)) return this } - fun minus(matter: ImpreciseFraction, complexity: Double): ComputeConfiguration { + fun minus(matter: Decimal, complexity: Double): ComputeConfiguration { values.add(ComputeAction.Constant(matter, complexity, MatterFunction.SUBTRACT)) return this } - fun multiply(matter: ImpreciseFraction, complexity: Double): ComputeConfiguration { + fun multiply(matter: Decimal, complexity: Double): ComputeConfiguration { values.add(ComputeAction.Constant(matter, complexity, MatterFunction.MULTIPLY)) return this } - fun divide(matter: ImpreciseFraction, complexity: Double): ComputeConfiguration { + fun divide(matter: Decimal, complexity: Double): ComputeConfiguration { values.add(ComputeAction.Constant(matter, complexity, MatterFunction.DIVIDE)) return this } @@ -242,11 +242,11 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na } class UpdateConfiguration(name: ResourceLocation) : Configuration(name) { - val matterFunctions = ArrayList>() + val matterFunctions = ArrayList>() val complexityFunctions = ArrayList>() val priorityFunctions = ArrayList>() - fun addMatterFunction(function: MatterFunction, value: ImpreciseFraction): UpdateConfiguration { + fun addMatterFunction(function: MatterFunction, value: Decimal): UpdateConfiguration { matterFunctions.add(BoundMatterFunction(function, value)) matter = null return this @@ -304,543 +304,543 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na } } - fun Scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) + fun Scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) - fun Scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue, complexity, configurator) - fun scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue, complexity, configurator) - fun scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue, complexity, configurator) - fun scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) + fun scope(matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue, complexity, configurator) + fun scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue, complexity, configurator) + fun scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue, complexity, configurator) + fun scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) - fun scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) + fun Scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun Scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) - fun Scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue, complexity, configurator) - fun scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue, complexity, configurator) - fun scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue, complexity, configurator) - fun scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) - fun scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity, configurator) + fun scope(matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue, complexity, configurator) + fun scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue, complexity, configurator) + fun scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue, complexity, configurator) + fun scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) + fun scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity, configurator) - fun scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue), complexity.toDouble(), configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue), complexity.toDouble(), configurator) /** * Allows to easily declare matter values using relative costs in DSL pattern */ - inner class Scope(val matterValue: ImpreciseFraction, val complexity: Double, configurator: Scope.() -> Unit) { - constructor(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) : this(matterValue, complexity, configurator) { + inner class Scope(val matterValue: Decimal, val complexity: Double, configurator: Scope.() -> Unit) { + constructor(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) : this(matterValue, complexity, configurator) { insert(item, matterValue, complexity) } - constructor(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) : this(matterValue, complexity, configurator) { + constructor(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) : this(matterValue, complexity, configurator) { insert(tag, matterValue, complexity) } - constructor(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) { + constructor(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) { insert(item, matterValue, complexity) } - constructor(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) { + constructor(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) { insert(tag, matterValue, complexity) } - constructor(matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) + constructor(matterValue: Decimal, complexity: Double, configurator: Consumer) : this(matterValue, complexity, configurator::accept) init { configurator.invoke(this) } - fun Scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Scope.() -> Unit) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) // ---- - fun Scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun Scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope( matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun scope(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer) = this@MatterDataProvider.Scope(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) ////////// - fun relative(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Int, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Int, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Long, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Long, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Double, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Double, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Float, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Float, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Int, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Int, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Long, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Long, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Double, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Double, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Float, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Float, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Int, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Int, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Long, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Long, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Double, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Double, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Float, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Float, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Int, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Int, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Long, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Long, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Double, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Double, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Float, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Float, complexity: Int, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Int, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Int, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Long, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Long, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Double, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Double, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Float, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Float, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Int, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Int, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Long, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Long, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Double, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Double, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Float, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Float, complexity: Float, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Int, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Int, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Long, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Long, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Double, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Double, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(item: ItemLike, matterValue: Float, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - fun relative(tag: TagKey, matterValue: Float, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Int, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Int, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Long, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Long, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Double, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Double, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(item: ItemLike, matterValue: Float, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + fun relative(tag: TagKey, matterValue: Float, complexity: Long, configurator: InsertConfiguration.() -> Unit) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, matterValue * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, matterValue * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, matterValue * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Double, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Double, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Int, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Int, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Float, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Float, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) - @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, ImpreciseFraction(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Int, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Int, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Long, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Long, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Double, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Double, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(item: ItemLike, matterValue: Float, complexity: Long, configurator: Consumer = Consumer {}) = insert(item, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) + @JvmOverloads fun relative(tag: TagKey, matterValue: Float, complexity: Long, configurator: Consumer = Consumer {}) = insert(tag, Decimal(matterValue) * this.matterValue, complexity * this.complexity, configurator) //////// @@ -962,54 +962,54 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na // multiplied inheritance fun inherit(destination: ItemLike, source: ItemLike, multiplier: Double, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { - add(ComputeAction.Constant(ImpreciseFraction(multiplier), multiplier, MatterFunction.MULTIPLY)) + add(ComputeAction.Constant(Decimal(multiplier), multiplier, MatterFunction.MULTIPLY)) configurator.invoke(this) } } fun inherit(destination: TagKey, source: ItemLike, multiplier: Double, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { - add(ComputeAction.Constant(ImpreciseFraction(multiplier), multiplier, MatterFunction.MULTIPLY)) + add(ComputeAction.Constant(Decimal(multiplier), multiplier, MatterFunction.MULTIPLY)) configurator.invoke(this) } } fun inherit(destination: ItemLike, source: TagKey, multiplier: Double, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { - add(ComputeAction.Constant(ImpreciseFraction(multiplier), multiplier, MatterFunction.MULTIPLY)) + add(ComputeAction.Constant(Decimal(multiplier), multiplier, MatterFunction.MULTIPLY)) configurator.invoke(this) } } fun inherit(destination: TagKey, source: TagKey, multiplier: Double, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { - add(ComputeAction.Constant(ImpreciseFraction(multiplier), multiplier, MatterFunction.MULTIPLY)) + add(ComputeAction.Constant(Decimal(multiplier), multiplier, MatterFunction.MULTIPLY)) configurator.invoke(this) } } - fun inherit(destination: ItemLike, source: ItemLike, multiplier: ImpreciseFraction, configurator: ComputeConfiguration.() -> Unit): ComputeAction { + fun inherit(destination: ItemLike, source: ItemLike, multiplier: Decimal, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { add(ComputeAction.Constant(multiplier, multiplier.toDouble(), MatterFunction.MULTIPLY)) configurator.invoke(this) } } - fun inherit(destination: TagKey, source: ItemLike, multiplier: ImpreciseFraction, configurator: ComputeConfiguration.() -> Unit): ComputeAction { + fun inherit(destination: TagKey, source: ItemLike, multiplier: Decimal, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { add(ComputeAction.Constant(multiplier, multiplier.toDouble(), MatterFunction.MULTIPLY)) configurator.invoke(this) } } - fun inherit(destination: ItemLike, source: TagKey, multiplier: ImpreciseFraction, configurator: ComputeConfiguration.() -> Unit): ComputeAction { + fun inherit(destination: ItemLike, source: TagKey, multiplier: Decimal, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { add(ComputeAction.Constant(multiplier, multiplier.toDouble(), MatterFunction.MULTIPLY)) configurator.invoke(this) } } - fun inherit(destination: TagKey, source: TagKey, multiplier: ImpreciseFraction, configurator: ComputeConfiguration.() -> Unit): ComputeAction { + fun inherit(destination: TagKey, source: TagKey, multiplier: Decimal, configurator: ComputeConfiguration.() -> Unit): ComputeAction { return inherit(destination, source) { add(ComputeAction.Constant(multiplier, multiplier.toDouble(), MatterFunction.MULTIPLY)) configurator.invoke(this) @@ -1058,22 +1058,22 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na } @JvmOverloads - fun inherit(destination: ItemLike, source: ItemLike, multiplier: ImpreciseFraction, configurator: Consumer = Consumer { }): ComputeAction { + fun inherit(destination: ItemLike, source: ItemLike, multiplier: Decimal, configurator: Consumer = Consumer { }): ComputeAction { return inherit(destination, source, multiplier, configurator::accept) } @JvmOverloads - fun inherit(destination: TagKey, source: ItemLike, multiplier: ImpreciseFraction, configurator: Consumer = Consumer { }): ComputeAction { + fun inherit(destination: TagKey, source: ItemLike, multiplier: Decimal, configurator: Consumer = Consumer { }): ComputeAction { return inherit(destination, source, multiplier, configurator::accept) } @JvmOverloads - fun inherit(destination: ItemLike, source: TagKey, multiplier: ImpreciseFraction, configurator: Consumer = Consumer { }): ComputeAction { + fun inherit(destination: ItemLike, source: TagKey, multiplier: Decimal, configurator: Consumer = Consumer { }): ComputeAction { return inherit(destination, source, multiplier, configurator::accept) } @JvmOverloads - fun inherit(destination: TagKey, source: TagKey, multiplier: ImpreciseFraction, configurator: Consumer = Consumer { }): ComputeAction { + fun inherit(destination: TagKey, source: TagKey, multiplier: Decimal, configurator: Consumer = Consumer { }): ComputeAction { return inherit(destination, source, multiplier, configurator::accept) } @@ -1141,39 +1141,39 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na fun delete(name: TagKey, configurator: Consumer) = delete(name, configurator::accept) fun update(name: TagKey, configurator: Consumer) = update(name, configurator::accept) - fun insert(name: ResourceLocation, matterValue: ImpreciseFraction, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: ResourceLocation, matterValue: Decimal, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity configurator.invoke(this) } - fun insert(name: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: ItemLike, matterValue: Decimal, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity configurator.invoke(this) } - fun insert(name: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: TagKey, matterValue: Decimal, complexity: Double, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity configurator.invoke(this) } - fun insert(name: ResourceLocation, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: ResourceLocation, matterValue: Decimal, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity this.priority = priority configurator.invoke(this) } - fun insert(name: ItemLike, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: ItemLike, matterValue: Decimal, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity this.priority = priority configurator.invoke(this) } - fun insert(name: TagKey, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { + fun insert(name: TagKey, matterValue: Decimal, complexity: Double, priority: Int, configurator: InsertConfiguration.() -> Unit) = insert(name) { this.matter = matterValue this.complexity = complexity this.priority = priority @@ -1181,18 +1181,18 @@ open class MatterDataProvider(protected val dataGenerator: DataGenerator, val na } @JvmOverloads - fun insert(name: ResourceLocation, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) + fun insert(name: ResourceLocation, matterValue: Decimal, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) @JvmOverloads - fun insert(name: ItemLike, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) + fun insert(name: ItemLike, matterValue: Decimal, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) @JvmOverloads - fun insert(name: TagKey, matterValue: ImpreciseFraction, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) + fun insert(name: TagKey, matterValue: Decimal, complexity: Double, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, configurator::accept) @JvmOverloads - fun insert(name: ResourceLocation, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) + fun insert(name: ResourceLocation, matterValue: Decimal, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) @JvmOverloads - fun insert(name: ItemLike, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) + fun insert(name: ItemLike, matterValue: Decimal, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) @JvmOverloads - fun insert(name: TagKey, matterValue: ImpreciseFraction, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) + fun insert(name: TagKey, matterValue: Decimal, complexity: Double, priority: Int, configurator: Consumer = Consumer { }) = insert(name, matterValue, complexity, priority, configurator::accept) /** * Override this if you prefer The Mundane Way™ instead of calling [insert], [delete] and [update] directly diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterFunction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterFunction.kt index 24203cc22..37b2e7a9f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterFunction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterFunction.kt @@ -1,75 +1,75 @@ package ru.dbotthepony.mc.otm.matter import com.google.gson.JsonParseException -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.integerDivisionDown import ru.dbotthepony.mc.otm.core.integerDivisionUp enum class MatterFunction { ADD { override fun updateValue(self: Int, other: Int): Int = self + other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self + other + override fun updateValue(self: Decimal, other: Decimal): Decimal = self + other override fun updateValue(self: Double, other: Double): Double = self + other }, SUBTRACT { override fun updateValue(self: Int, other: Int): Int = self - other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self - other + override fun updateValue(self: Decimal, other: Decimal): Decimal = self - other override fun updateValue(self: Double, other: Double): Double = self - other }, MULTIPLY { override fun updateValue(self: Int, other: Int): Int = self * other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self * other + override fun updateValue(self: Decimal, other: Decimal): Decimal = self * other override fun updateValue(self: Double, other: Double): Double = self * other }, DIVIDE { override fun updateValue(self: Int, other: Int): Int = self / other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self / other + override fun updateValue(self: Decimal, other: Decimal): Decimal = self / other override fun updateValue(self: Double, other: Double): Double = self / other }, DIVIDE_UP { override fun updateValue(self: Int, other: Int): Int = integerDivisionUp(self, other) - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = throw JsonParseException("Integer division up is available only for integers") + override fun updateValue(self: Decimal, other: Decimal): Decimal = throw JsonParseException("Integer division up is available only for integers") override fun updateValue(self: Double, other: Double): Double = throw JsonParseException("Integer division up is available only for integers") }, DIVIDE_DOWN { override fun updateValue(self: Int, other: Int): Int = integerDivisionDown(self, other) - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = throw JsonParseException("Integer division down is available only for integers") + override fun updateValue(self: Decimal, other: Decimal): Decimal = throw JsonParseException("Integer division down is available only for integers") override fun updateValue(self: Double, other: Double): Double = throw JsonParseException("Integer division down is available only for integers") }, MODULO { override fun updateValue(self: Int, other: Int): Int = self % other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self % other + override fun updateValue(self: Decimal, other: Decimal): Decimal = self % other override fun updateValue(self: Double, other: Double): Double = self % other }, AT_LEAST { override fun updateValue(self: Int, other: Int): Int = self.coerceAtLeast(other) - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self.coerceAtLeast(other) + override fun updateValue(self: Decimal, other: Decimal): Decimal = self.coerceAtLeast(other) override fun updateValue(self: Double, other: Double): Double = self.coerceAtLeast(other) }, AT_MOST { override fun updateValue(self: Int, other: Int): Int = self.coerceAtMost(other) - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self.coerceAtMost(other) + override fun updateValue(self: Decimal, other: Decimal): Decimal = self.coerceAtMost(other) override fun updateValue(self: Double, other: Double): Double = self.coerceAtMost(other) }, REPLACE { override fun updateValue(self: Int, other: Int): Int = other - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = other + override fun updateValue(self: Decimal, other: Decimal): Decimal = other override fun updateValue(self: Double, other: Double): Double = other }, NOOP { override fun updateValue(self: Int, other: Int): Int = self - override fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction = self + override fun updateValue(self: Decimal, other: Decimal): Decimal = self override fun updateValue(self: Double, other: Double): Double = self }, ; protected abstract fun updateValue(self: Int, other: Int): Int - protected abstract fun updateValue(self: ImpreciseFraction, other: ImpreciseFraction): ImpreciseFraction + protected abstract fun updateValue(self: Decimal, other: Decimal): Decimal protected abstract fun updateValue(self: Double, other: Double): Double fun updateValue(self: T, other: T): T { return when (self) { - is ImpreciseFraction -> updateValue(self as ImpreciseFraction, other as ImpreciseFraction) as T + is Decimal -> updateValue(self as Decimal, other as Decimal) as T is Double -> updateValue(self as Double, other as Double) as T is Int -> updateValue(self as Int, other as Int) as T else -> throw RuntimeException("Unknown number type: ${self::class.qualifiedName}") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt index 8540dc592..7fdb9011d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt @@ -62,7 +62,7 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.container.stream -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.filterNotNull @@ -96,7 +96,7 @@ import kotlin.math.pow import kotlin.math.roundToInt internal sealed class MutableEntry( - var matter: ImpreciseFraction, + var matter: Decimal, var complexity: Double, var priority: Int ) { @@ -105,7 +105,7 @@ internal sealed class MutableEntry( internal class MutableTagEntry( val tag: TagKey, - matter: ImpreciseFraction, + matter: Decimal, complexity: Double, priority: Int ) : MutableEntry(matter, complexity, priority) { @@ -116,7 +116,7 @@ internal class MutableTagEntry( internal class MutableKeyEntry( val key: ResourceLocation, - matter: ImpreciseFraction, + matter: Decimal, complexity: Double, priority: Int ) : MutableEntry(matter, complexity, priority) { @@ -136,16 +136,16 @@ internal class MutableKeyEntry( } internal sealed class Entry( - final override val matter: ImpreciseFraction, + final override val matter: Decimal, final override val complexity: Double, val priority: Int, ) : IMatterValue { - companion object : Entry(ImpreciseFraction.ZERO, 0.0, Int.MIN_VALUE) + companion object : Entry(Decimal.ZERO, 0.0, Int.MIN_VALUE) } internal class TagEntry( val tag: TagKey, - matter: ImpreciseFraction, + matter: Decimal, complexity: Double, priority: Int, ) : Entry(matter, complexity, priority) { @@ -157,7 +157,7 @@ internal class TagEntry( internal class KeyEntry( val key: ResourceLocation, - matter: ImpreciseFraction, + matter: Decimal, complexity: Double, priority: Int, ) : Entry(matter, complexity, priority) @@ -669,7 +669,7 @@ object MatterManager { } private fun doDetermineValue(item: Item): Result { - var minimalMatter: ImpreciseFraction? = null + var minimalMatter: Decimal? = null var minimalComplexity: Double? = null val recipes = output2Recipes[item] @@ -689,7 +689,7 @@ object MatterManager { continue } - var accumulatedMatter: ImpreciseFraction? = null + var accumulatedMatter: Decimal? = null var accumulatedComplexity: Double? = null inputsLoop@ for ((i, inputs) in recipe.inputs.withIndex()) { @@ -1059,7 +1059,7 @@ object MatterManager { if (value.item is IMatterItem) can = (value.item as IMatterItem).canDecompose(value) - can = can && (value.getCapability(MatteryCapability.MATTER).orNull()?.storedMatter ?: ImpreciseFraction.ZERO).isZero + can = can && (value.getCapability(MatteryCapability.MATTER).orNull()?.storedMatter ?: Decimal.ZERO).isZero can = can && (value.getCapability(MatteryCapability.DRIVE).orNull()?.storedCount ?: BigInteger.ZERO).isZero return can && get(value).hasMatterValue @@ -1140,7 +1140,7 @@ object MatterManager { class ResolvedRecipe( inputs: Stream>, val output: ImmutableStack, - val transformMatterValue: (ImpreciseFraction) -> ImpreciseFraction = { it }, + val transformMatterValue: (Decimal) -> Decimal = { it }, val transformComplexity: (Double) -> Double = { it }, /** @@ -1169,7 +1169,7 @@ object MatterManager { constructor( inputs: Collection>, output: ImmutableStack, - transformMatterValue: (ImpreciseFraction) -> ImpreciseFraction = { it }, + transformMatterValue: (Decimal) -> Decimal = { it }, transformComplexity: (Double) -> Double = { it }, ) : this(inputs.stream().map { it.stream() }, output, transformMatterValue, transformComplexity) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/RecipeResolverManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/RecipeResolverManager.kt index c2c26877c..ca85b7742 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/RecipeResolverManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/RecipeResolverManager.kt @@ -1,41 +1,2 @@ package ru.dbotthepony.mc.otm.matter -import com.google.common.collect.ImmutableList -import com.google.common.collect.ImmutableMap -import com.google.common.collect.Streams -import com.google.gson.GsonBuilder -import com.google.gson.JsonElement -import com.google.gson.JsonObject -import com.google.gson.JsonParseException -import com.google.gson.JsonSyntaxException -import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction -import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap -import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet -import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet -import net.minecraft.network.chat.Component -import net.minecraft.network.chat.MutableComponent -import net.minecraft.resources.ResourceLocation -import net.minecraft.server.MinecraftServer -import net.minecraft.server.packs.resources.ResourceManager -import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener -import net.minecraft.util.profiling.ProfilerFiller -import net.minecraft.world.Container -import net.minecraft.world.item.Item -import net.minecraft.world.item.ItemStack -import net.minecraft.world.item.crafting.Recipe -import net.minecraft.world.item.crafting.RecipeType -import net.minecraftforge.event.AddReloadListenerEvent -import net.minecraftforge.event.server.ServerStartedEvent -import net.minecraftforge.eventbus.api.IEventBus -import net.minecraftforge.registries.DeferredRegister -import net.minecraftforge.registries.ForgeRegistries -import org.apache.logging.log4j.LogManager -import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.SystemTime -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.TextComponent -import ru.dbotthepony.mc.otm.core.isActuallyEmpty -import ru.dbotthepony.mc.otm.core.registryName -import ru.dbotthepony.mc.otm.core.stream -import ru.dbotthepony.mc.otm.registry.RegistryDelegate -import java.util.stream.Stream diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/UpdateAction.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/UpdateAction.kt index 1d5180e2c..5a255cf50 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/UpdateAction.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/UpdateAction.kt @@ -8,7 +8,7 @@ import com.google.gson.JsonParseException import net.minecraft.resources.ResourceLocation import net.minecraft.tags.TagKey import net.minecraft.world.item.Item -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.data.stream @@ -45,7 +45,7 @@ class UpdateAction : AbstractRegistryAction { } } - val matterFunctions: List> + val matterFunctions: List> val complexityFunctions: List> val priorityFunctions: List> @@ -57,11 +57,11 @@ class UpdateAction : AbstractRegistryAction { constructor( tag: TagKey, - matter: ImpreciseFraction? = null, + matter: Decimal? = null, complexity: Double? = null, priority: Int? = null, errorOnFailure: Boolean = false, - matterFunctions: List> = ImmutableList.of(), + matterFunctions: List> = ImmutableList.of(), complexityFunctions: List> = ImmutableList.of(), priorityFunctions: List> = ImmutableList.of(), ) : super(tag = tag, matter = matter, complexity = complexity, priority = priority, errorOnFailure = errorOnFailure) { @@ -76,11 +76,11 @@ class UpdateAction : AbstractRegistryAction { constructor( key: ResourceLocation, - matter: ImpreciseFraction? = null, + matter: Decimal? = null, complexity: Double? = null, priority: Int? = null, errorOnFailure: Boolean = false, - matterFunctions: List> = ImmutableList.of(), + matterFunctions: List> = ImmutableList.of(), complexityFunctions: List> = ImmutableList.of(), priorityFunctions: List> = ImmutableList.of(), ) : super(key = key, matter = matter, complexity = complexity, priority = priority, errorOnFailure = errorOnFailure) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/EnergyCounterMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/EnergyCounterMenu.kt index ab6b85e56..827b45194 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/EnergyCounterMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/EnergyCounterMenu.kt @@ -7,7 +7,7 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.level.block.Block import ru.dbotthepony.mc.otm.block.EnergyCounterBlock import ru.dbotthepony.mc.otm.block.entity.EnergyCounterBlockEntity -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.menu.widget.NumberPlayerInputWidget import ru.dbotthepony.mc.otm.menu.widget.OneWayPlayerInputWidget import ru.dbotthepony.mc.otm.registry.MMenus @@ -46,7 +46,7 @@ class EnergyCounterMenu @JvmOverloads constructor( if (it.signum() < 0) { tile.ioLimit = null } else { - tile.ioLimit = ImpreciseFraction(it) + tile.ioLimit = Decimal(it) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt index e8fa42f17..759e5a326 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt @@ -2,10 +2,9 @@ package ru.dbotthepony.mc.otm.menu import net.minecraft.world.SimpleContainer import net.minecraft.world.entity.player.Inventory -import net.minecraft.world.inventory.Slot import ru.dbotthepony.mc.otm.core.ImmutableList import ru.dbotthepony.mc.otm.block.entity.matter.MatterCapacitorBankBlockEntity -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.registry.MMenus @@ -28,9 +27,9 @@ class MatterCapacitorBankMenu @JvmOverloads constructor( } else { matterGauge = LevelGaugeWidget(this, tile) totalMatterGauge = LevelGaugeWidget(this, { - tile.matterGraph?.getMatterStorageLevel() ?: ImpreciseFraction.ZERO + tile.matterGraph?.getMatterStorageLevel() ?: Decimal.ZERO }, { - tile.matterGraph?.getMatterStorageMaxLevel() ?: ImpreciseFraction.ZERO + tile.matterGraph?.getMatterStorageMaxLevel() ?: Decimal.ZERO }) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt index bca32c61a..5c1384149 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt @@ -7,7 +7,7 @@ import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import net.minecraft.world.SimpleContainer import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.matter.MatterManager import ru.dbotthepony.mc.otm.registry.MMenus @@ -34,8 +34,8 @@ class MatterScannerMenu @JvmOverloads constructor( if (tile != null) { progress = ProgressGaugeWidget(this, tile::workProgress, tile::isUnableToProcess) patterns = LevelGaugeWidget(this, - { ImpreciseFraction(tile.matterGraph?.patternCount ?: 0L) }, - { ImpreciseFraction(tile.matterGraph?.patternCapacity ?: 0L) }) + { Decimal(tile.matterGraph?.patternCount ?: 0L) }, + { Decimal(tile.matterGraph?.patternCapacity ?: 0L) }) } else { progress = ProgressGaugeWidget(this) patterns = LevelGaugeWidget(this) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt index d78250a82..7b4990b01 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt @@ -4,7 +4,7 @@ import net.minecraft.world.SimpleContainer import net.minecraft.world.entity.player.Inventory import ru.dbotthepony.mc.otm.core.ImmutableList import ru.dbotthepony.mc.otm.block.entity.matter.PatternStorageBlockEntity -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.registry.MMenus @@ -27,9 +27,9 @@ class PatternStorageMenu @JvmOverloads constructor( } else { storedThis = LevelGaugeWidget(this, tile) storedGrid = LevelGaugeWidget(this, { - ImpreciseFraction(tile.matterGraph?.patternCount ?: 0) + Decimal(tile.matterGraph?.patternCount ?: 0) }, { - ImpreciseFraction(tile.matterGraph?.patternCapacity ?: 0) + Decimal(tile.matterGraph?.patternCapacity ?: 0) }) } @@ -43,4 +43,4 @@ class PatternStorageMenu @JvmOverloads constructor( addInventorySlots() } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/widget/LevelGaugeWidget.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/widget/LevelGaugeWidget.kt index 57a554f90..df67049fb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/widget/LevelGaugeWidget.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/widget/LevelGaugeWidget.kt @@ -3,13 +3,13 @@ package ru.dbotthepony.mc.otm.menu.widget import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler import ru.dbotthepony.mc.otm.capability.matter.IPatternStorage -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.menu.MatteryMenu @Suppress("unused") class LevelGaugeWidget(menu: MatteryMenu) : AbstractWidget(menu) { - var levelProvider = { ImpreciseFraction.ONE } - var maxLevelProvider = {ImpreciseFraction.ONE } + var levelProvider = { Decimal.ONE } + var maxLevelProvider = {Decimal.ONE } var level by menu.mSynchronizer.fraction() private set @@ -42,14 +42,14 @@ class LevelGaugeWidget(menu: MatteryMenu) : AbstractWidget(menu) { ) : this(menu) { if (patterns == null) return - this.levelProvider = {ImpreciseFraction(patterns.storedPatterns)} - this.maxLevelProvider = {ImpreciseFraction(patterns.patternCapacity)} + this.levelProvider = {Decimal(patterns.storedPatterns)} + this.maxLevelProvider = {Decimal(patterns.patternCapacity)} } constructor( menu: MatteryMenu, - level: () -> ImpreciseFraction, - maxLevel: () -> ImpreciseFraction, + level: () -> Decimal, + maxLevel: () -> Decimal, ) : this(menu) { this.levelProvider = level this.maxLevelProvider = maxLevel @@ -60,7 +60,7 @@ class LevelGaugeWidget(menu: MatteryMenu) : AbstractWidget(menu) { maxLevel = maxLevelProvider.invoke() } - fun level(): ImpreciseFraction = level - fun maxLevel(): ImpreciseFraction = maxLevel + fun level(): Decimal = level + fun maxLevel(): Decimal = maxLevel fun percentage(): Float = level.percentage(maxLevel) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/network/FieldSynchronizer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/network/FieldSynchronizer.kt index 078f38a33..7043a50d4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/network/FieldSynchronizer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/network/FieldSynchronizer.kt @@ -147,7 +147,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa fun uuid(getter: () -> UUID, name: String = nextFieldName()) = ComputedField(getter, UUIDValueCodec, name) fun int(getter: () -> Int, name: String = nextFieldName()) = ComputedField(getter, VarIntValueCodec, name) fun fixedInt(getter: () -> Int, name: String = nextFieldName()) = ComputedField(getter, IntValueCodec, name) - fun fraction(getter: () -> ImpreciseFraction, name: String = nextFieldName()) = ComputedField(getter, ImpreciseFractionValueCodec, name) + fun fraction(getter: () -> Decimal, name: String = nextFieldName()) = ComputedField(getter, ImpreciseFractionValueCodec, name) fun bigDecimal(getter: () -> BigDecimal, name: String = nextFieldName()) = ComputedField(getter, BigDecimalValueCodec, name) fun item(getter: () -> ItemStack, name: String = nextFieldName()) = ComputedField(getter, ItemStackValueCodec, name) @@ -161,7 +161,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa fun uuid(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, UUIDValueCodec, name) fun int(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, VarIntValueCodec, name) fun fixedInt(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, IntValueCodec, name) - fun fraction(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, ImpreciseFractionValueCodec, name) + fun fraction(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, ImpreciseFractionValueCodec, name) fun bigDecimal(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, BigDecimalValueCodec, name) fun item(getter: KProperty0, name: String = nextFieldName()) = ComputedField(getter, ItemStackValueCodec, name) @@ -175,7 +175,7 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa fun uuid(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, UUIDValueCodec, name) fun int(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, VarIntValueCodec, name) fun fixedInt(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, IntValueCodec, name) - fun fraction(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, ImpreciseFractionValueCodec, name) + fun fraction(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, ImpreciseFractionValueCodec, name) fun bigDecimal(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, BigDecimalValueCodec, name) fun item(getter: Supplier, name: String = nextFieldName()) = ComputedField(getter::get, ItemStackValueCodec, name) @@ -279,11 +279,11 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa } fun fraction( - value: ImpreciseFraction = ImpreciseFraction.ZERO, - getter: FieldGetter? = null, - setter: FieldSetter? = null, + value: Decimal = Decimal.ZERO, + getter: FieldGetter? = null, + setter: FieldSetter? = null, name: String = nextFieldName(), - ): Field { + ): Field { return Field(value, ImpreciseFractionValueCodec, getter, setter, name = name) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt index 1ed4493bb..c29be5ec0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt @@ -27,7 +27,7 @@ import ru.dbotthepony.mc.otm.android.feature.ShockwaveFeature import ru.dbotthepony.mc.otm.block.CargoCrateBlock import ru.dbotthepony.mc.otm.block.TritaniumPressurePlate import ru.dbotthepony.mc.otm.capability.matteryEnergy -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.item.EnergySwordItem import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.CrateProperties @@ -268,7 +268,7 @@ object MRegistry { private fun initializeClient(event: FMLClientSetupEvent) { ItemProperties.register(MItems.ENERGY_SWORD, ResourceLocation(OverdriveThatMatters.MOD_ID, "is_powered")) { stack, _, _, _ -> - if ((stack.matteryEnergy?.batteryLevel ?: ImpreciseFraction.ZERO) >= EnergySwordItem.ENERGY_PER_SWING) { + if ((stack.matteryEnergy?.batteryLevel ?: Decimal.ZERO) >= EnergySwordItem.ENERGY_PER_SWING) { 1f } else { 0f diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/storage/API.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/storage/API.kt index 6737794a5..6081246ed 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/storage/API.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/storage/API.kt @@ -1,10 +1,7 @@ package ru.dbotthepony.mc.otm.storage -import net.minecraft.world.item.crafting.Ingredient -import ru.dbotthepony.mc.otm.core.ImpreciseFraction import java.math.BigInteger import java.util.* -import java.util.stream.Collectors import java.util.stream.Stream /** diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/storage/Registry.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/storage/Registry.kt index a4cd6584f..56ad6c23f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/storage/Registry.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/storage/Registry.kt @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.storage import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import ru.dbotthepony.mc.otm.core.Fraction +import ru.dbotthepony.mc.otm.core.Decimal import java.util.IdentityHashMap open class StorageStackType( @@ -12,15 +11,15 @@ open class StorageStackType( /** * Speculated energy required per operation on stack with size of 1 */ - open val energyPerOperation: ImpreciseFraction, + open val energyPerOperation: Decimal, ) { - open fun energyPerOperation(stack: T): ImpreciseFraction { + open fun energyPerOperation(stack: T): Decimal { return energyPerOperation * stack.count } open fun energyPerStorage(stack: T) = energyPerOperation(stack) open fun energyPerExtraction(stack: T) = energyPerOperation(stack) - open fun energyForUpkeep(stack: T) = ImpreciseFraction.ZERO + open fun energyForUpkeep(stack: T) = Decimal.ZERO } @Suppress("unchecked_cast") @@ -41,7 +40,7 @@ object StorageRegistry { fun register( identity: Class, empty: T, - energyPerOperation: ImpreciseFraction + energyPerOperation: Decimal ): StorageStackType { return register(StorageStackType(identity, empty, energyPerOperation)) as StorageStackType } diff --git a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/DecimalTests.kt b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/DecimalTests.kt new file mode 100644 index 000000000..52b31fcaf --- /dev/null +++ b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/DecimalTests.kt @@ -0,0 +1,93 @@ +package ru.dbotthepony.mc.otm.tests + +import it.unimi.dsi.fastutil.io.FastByteArrayInputStream +import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test +import ru.dbotthepony.mc.otm.core.Decimal +import java.io.ObjectInputStream +import java.io.ObjectOutputStream + +object DecimalTests { + @Test + @DisplayName("ImpreciseFraction comparison") + fun comparison() { + check(Decimal(642, 0.43774) > Decimal(641, 0.43774)) { "must be bigger" } + check(Decimal(642, 0.43774) > Decimal(-641, 0.43774)) { "must be bigger" } + check(Decimal(0) == Decimal(0)) { "integer notation" } + check(Decimal(0.1) > Decimal(0)) { "must be bigger" } + check(Decimal(-0.1) < Decimal(0)) { "must be lesser" } + check(Decimal(-1, -0.1) < Decimal(-1)) { "must be lesser" } + check(Decimal(0.1) == Decimal(0.1)) { "double notation" } + check(Decimal("0.1") == Decimal("0.1")) { "string notation" } + } + + @Test + @DisplayName("ImpreciseFraction mathematical operations") + fun math() { + check((Decimal(1) + Decimal(2)) == Decimal(3)) { "1 + 2 != 3" } + check((Decimal(0, 0.5) + Decimal(0, 0.5)) == Decimal(1)) { "0.5 + 0.5 != 1" } + check((Decimal(0, 0.5) + Decimal(0, -0.5)) == Decimal(0)) { "0.5 + -0.5 != 1" } + check((Decimal(0, 0.5) - Decimal(0, -0.5)) == Decimal(1)) { "0.5 - -0.5 != 1" } + check((Decimal(0, 0.3) - Decimal(1, 0.2)) == Decimal(0, -0.9)) { "0.3 - 1.2 != -0.9" } + check((Decimal(0, 0.3) * Decimal(0, 0.3)) == Decimal(0, 0.09)) { "0.3 * 0.3 != 0.9 ${Decimal(0, 0.3) * Decimal(0, 0.3)}" } + check((Decimal(2, 0.3) * Decimal(2, 0.3)) == Decimal(5, 0.29)) { "2.3 * 2.3 != 5.29 ${Decimal(2, 0.3) * Decimal(2, 0.3)}" } + check((Decimal(4) / Decimal(2)) == Decimal(2)) { "4 / 2 != 2" } + check((Decimal(6) / Decimal(2)) == Decimal(3)) { "6 / 2 != 2" } + check((Decimal(1) / Decimal(0, 0.25)) == Decimal(4)) { "1 / 0.25 != 4" } + } + + @Test + @DisplayName("ImpreciseFraction store/load") + fun storeLoad() { + run { + val f = Decimal(4, 0.28) + val loaded = Decimal.fromByteArray(f.toByteArray()) + check(f == loaded) { "$f != $loaded" } + } + + run { + val f = Decimal(32748293658335L, 0.3472302174) + val loaded = Decimal.fromByteArray(f.toByteArray()) + check(f == loaded) { "$f != $loaded" } + } + } + + @Test + @DisplayName("ImpreciseFraction.valueOf") + fun valueOf() { + for (i in -2100 .. 2100) { + assertEquals(Decimal(i), Decimal.valueOf(i)) + } + + for (i in -2100 .. 2100) { + assertEquals(Decimal(i.toLong()), Decimal.valueOf(i.toLong())) + } + } + + @Test + @DisplayName("ImpreciseFraction serialization") + fun serialization() { + val output = FastByteArrayOutputStream() + val outputStream = ObjectOutputStream(output) + + val val1 = Decimal("283") + val val2 = Decimal("0") + val val3 = Decimal("-4") + val val4 = Decimal("25.225") + + outputStream.writeObject(val1) + outputStream.writeObject(val2) + outputStream.writeObject(val3) + outputStream.writeObject(val4) + + val input = FastByteArrayInputStream(output.array, 0, output.length) + val inputStream = ObjectInputStream(input) + + assertEquals(val1, inputStream.readObject()) + assertEquals(val2, inputStream.readObject()) + assertEquals(val3, inputStream.readObject()) + assertEquals(val4, inputStream.readObject()) + } +} diff --git a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FormattingTests.kt b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FormattingTests.kt index 3096a73eb..b278c12e9 100644 --- a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FormattingTests.kt +++ b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FormattingTests.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.tests import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import ru.dbotthepony.mc.otm.core.formatReadableNumber import ru.dbotthepony.mc.otm.core.formatSi import java.math.BigInteger @@ -52,18 +52,18 @@ object FormattingTests { @Test @DisplayName("ImpreciseFraction formatting as si number") fun impreciseFractionSi() { - assertEquals("0.00", ImpreciseFraction("0").formatSi(2)) - assertEquals("14.62", ImpreciseFraction("14.62").formatSi(2)) - assertEquals("1.00k", ImpreciseFraction("1000").formatSi(2)) - assertEquals("1.00k", ImpreciseFraction("1000.1").formatSi(2)) - assertEquals("1.00k", ImpreciseFraction("1004.2").formatSi(2)) - assertEquals("1.01k", ImpreciseFraction("1014.5").formatSi(2)) - assertEquals("1.014k", ImpreciseFraction("1014.5").formatSi(3)) - assertEquals("1.01k", ImpreciseFraction("1014.256").formatSi(2)) - assertEquals("12.73k", ImpreciseFraction("12734.256").formatSi(2)) - assertEquals("127.34k", ImpreciseFraction("127342.256").formatSi(2)) - assertEquals("1.27M", ImpreciseFraction("1273421.256").formatSi(2)) - assertEquals("1.273M", ImpreciseFraction("1273421.256").formatSi(3)) - assertEquals("1.2734M", ImpreciseFraction("1273421.256").formatSi(4)) + assertEquals("0.00", Decimal("0").formatSi(2)) + assertEquals("14.62", Decimal("14.62").formatSi(2)) + assertEquals("1.00k", Decimal("1000").formatSi(2)) + assertEquals("1.00k", Decimal("1000.1").formatSi(2)) + assertEquals("1.00k", Decimal("1004.2").formatSi(2)) + assertEquals("1.01k", Decimal("1014.5").formatSi(2)) + assertEquals("1.014k", Decimal("1014.5").formatSi(3)) + assertEquals("1.01k", Decimal("1014.256").formatSi(2)) + assertEquals("12.73k", Decimal("12734.256").formatSi(2)) + assertEquals("127.34k", Decimal("127342.256").formatSi(2)) + assertEquals("1.27M", Decimal("1273421.256").formatSi(2)) + assertEquals("1.273M", Decimal("1273421.256").formatSi(3)) + assertEquals("1.2734M", Decimal("1273421.256").formatSi(4)) } } diff --git a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FractionTests.kt b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FractionTests.kt index 9a2afa555..e51fa3924 100644 --- a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FractionTests.kt +++ b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/FractionTests.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import ru.dbotthepony.mc.otm.core.Fraction -import ru.dbotthepony.mc.otm.core.ImpreciseFraction +import ru.dbotthepony.mc.otm.core.Decimal import java.math.BigDecimal import java.math.BigInteger @@ -138,12 +138,12 @@ object FractionTests { ) private val samplesIM = arrayOf( - ImpreciseFraction(9475.0 / 4729), - ImpreciseFraction(23535.0 / 58723), - ImpreciseFraction(-4852.0 / 6859), - ImpreciseFraction(-45623.0 / -76849), - ImpreciseFraction(38494.0 / -76849), - ImpreciseFraction(1043.0 / -648), + Decimal(9475.0 / 4729), + Decimal(23535.0 / 58723), + Decimal(-4852.0 / 6859), + Decimal(-45623.0 / -76849), + Decimal(38494.0 / -76849), + Decimal(1043.0 / -648), ) private val samples2 = arrayOf( @@ -169,7 +169,7 @@ object FractionTests { fun performance() { val rand = java.util.Random() val blackHole = arrayOfNulls(100_000) - val blackHoleIM = arrayOfNulls(100_000) + val blackHoleIM = arrayOfNulls(100_000) val size = samples.size var time = System.currentTimeMillis() diff --git a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/ImpreciseFractionTests.kt b/src/test/kotlin/ru/dbotthepony/mc/otm/tests/ImpreciseFractionTests.kt deleted file mode 100644 index a87a8025d..000000000 --- a/src/test/kotlin/ru/dbotthepony/mc/otm/tests/ImpreciseFractionTests.kt +++ /dev/null @@ -1,94 +0,0 @@ -package ru.dbotthepony.mc.otm.tests - -import it.unimi.dsi.fastutil.io.FastByteArrayInputStream -import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test -import ru.dbotthepony.mc.otm.core.ImpreciseFraction -import java.io.File -import java.io.ObjectInputStream -import java.io.ObjectOutputStream - -object ImpreciseFractionTests { - @Test - @DisplayName("ImpreciseFraction comparison") - fun comparison() { - check(ImpreciseFraction(642, 0.43774) > ImpreciseFraction(641, 0.43774)) { "must be bigger" } - check(ImpreciseFraction(642, 0.43774) > ImpreciseFraction(-641, 0.43774)) { "must be bigger" } - check(ImpreciseFraction(0) == ImpreciseFraction(0)) { "integer notation" } - check(ImpreciseFraction(0.1) > ImpreciseFraction(0)) { "must be bigger" } - check(ImpreciseFraction(-0.1) < ImpreciseFraction(0)) { "must be lesser" } - check(ImpreciseFraction(-1, -0.1) < ImpreciseFraction(-1)) { "must be lesser" } - check(ImpreciseFraction(0.1) == ImpreciseFraction(0.1)) { "double notation" } - check(ImpreciseFraction("0.1") == ImpreciseFraction("0.1")) { "string notation" } - } - - @Test - @DisplayName("ImpreciseFraction mathematical operations") - fun math() { - check((ImpreciseFraction(1) + ImpreciseFraction(2)) == ImpreciseFraction(3)) { "1 + 2 != 3" } - check((ImpreciseFraction(0, 0.5) + ImpreciseFraction(0, 0.5)) == ImpreciseFraction(1)) { "0.5 + 0.5 != 1" } - check((ImpreciseFraction(0, 0.5) + ImpreciseFraction(0, -0.5)) == ImpreciseFraction(0)) { "0.5 + -0.5 != 1" } - check((ImpreciseFraction(0, 0.5) - ImpreciseFraction(0, -0.5)) == ImpreciseFraction(1)) { "0.5 - -0.5 != 1" } - check((ImpreciseFraction(0, 0.3) - ImpreciseFraction(1, 0.2)) == ImpreciseFraction(0, -0.9)) { "0.3 - 1.2 != -0.9" } - check((ImpreciseFraction(0, 0.3) * ImpreciseFraction(0, 0.3)) == ImpreciseFraction(0, 0.09)) { "0.3 * 0.3 != 0.9 ${ImpreciseFraction(0, 0.3) * ImpreciseFraction(0, 0.3)}" } - check((ImpreciseFraction(2, 0.3) * ImpreciseFraction(2, 0.3)) == ImpreciseFraction(5, 0.29)) { "2.3 * 2.3 != 5.29 ${ImpreciseFraction(2, 0.3) * ImpreciseFraction(2, 0.3)}" } - check((ImpreciseFraction(4) / ImpreciseFraction(2)) == ImpreciseFraction(2)) { "4 / 2 != 2" } - check((ImpreciseFraction(6) / ImpreciseFraction(2)) == ImpreciseFraction(3)) { "6 / 2 != 2" } - check((ImpreciseFraction(1) / ImpreciseFraction(0, 0.25)) == ImpreciseFraction(4)) { "1 / 0.25 != 4" } - } - - @Test - @DisplayName("ImpreciseFraction store/load") - fun storeLoad() { - run { - val f = ImpreciseFraction(4, 0.28) - val loaded = ImpreciseFraction.fromByteArray(f.toByteArray()) - check(f == loaded) { "$f != $loaded" } - } - - run { - val f = ImpreciseFraction(32748293658335L, 0.3472302174) - val loaded = ImpreciseFraction.fromByteArray(f.toByteArray()) - check(f == loaded) { "$f != $loaded" } - } - } - - @Test - @DisplayName("ImpreciseFraction.valueOf") - fun valueOf() { - for (i in -2100 .. 2100) { - assertEquals(ImpreciseFraction(i), ImpreciseFraction.valueOf(i)) - } - - for (i in -2100 .. 2100) { - assertEquals(ImpreciseFraction(i.toLong()), ImpreciseFraction.valueOf(i.toLong())) - } - } - - @Test - @DisplayName("ImpreciseFraction serialization") - fun serialization() { - val output = FastByteArrayOutputStream() - val outputStream = ObjectOutputStream(output) - - val val1 = ImpreciseFraction("283") - val val2 = ImpreciseFraction("0") - val val3 = ImpreciseFraction("-4") - val val4 = ImpreciseFraction("25.225") - - outputStream.writeObject(val1) - outputStream.writeObject(val2) - outputStream.writeObject(val3) - outputStream.writeObject(val4) - - val input = FastByteArrayInputStream(output.array, 0, output.length) - val inputStream = ObjectInputStream(input) - - assertEquals(val1, inputStream.readObject()) - assertEquals(val2, inputStream.readObject()) - assertEquals(val3, inputStream.readObject()) - assertEquals(val4, inputStream.readObject()) - } -}