From f2a505ae9f6ea4b6a4dad5a6fdd83498138e5517 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Tue, 24 Apr 2018 08:28:11 +0200 Subject: Extract inner class to work around coverage bug --- .../game/resources/BestPriceCalculator.java | 25 ------------------- .../sevenwonders/game/resources/ResourcePool.java | 29 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 game-engine/src/main/java/org/luxons/sevenwonders/game/resources/ResourcePool.java (limited to 'game-engine/src/main/java/org') diff --git a/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/BestPriceCalculator.java b/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/BestPriceCalculator.java index 8fed41d1..0cae3fe2 100644 --- a/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/BestPriceCalculator.java +++ b/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/BestPriceCalculator.java @@ -73,30 +73,5 @@ public class BestPriceCalculator { return currentMinPrice; } - private static class ResourcePool { - - private final Set> choices; - - private final Provider provider; - - private final TradingRules rules; - - private ResourcePool(Production production, Provider provider, TradingRules rules) { - this.choices = production.asChoices(); - this.provider = provider; - this.rules = rules; - } - - Set> getChoices() { - return choices; - } - - int getCost(ResourceType type) { - if (provider == null) { - return 0; - } - return rules.getCost(type, provider); - } - } } diff --git a/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/ResourcePool.java b/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/ResourcePool.java new file mode 100644 index 00000000..ad368066 --- /dev/null +++ b/game-engine/src/main/java/org/luxons/sevenwonders/game/resources/ResourcePool.java @@ -0,0 +1,29 @@ +package org.luxons.sevenwonders.game.resources; + +import java.util.Set; + +class ResourcePool { + + private final Set> choices; + + private final Provider provider; + + private final TradingRules rules; + + ResourcePool(Production production, Provider provider, TradingRules rules) { + this.choices = production.asChoices(); + this.provider = provider; + this.rules = rules; + } + + Set> getChoices() { + return choices; + } + + int getCost(ResourceType type) { + if (provider == null) { + return 0; + } + return rules.getCost(type, provider); + } +} -- cgit