diff --git a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorCMC.java b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorCMC.java index 412e11eeafb..7ed336c88e5 100644 --- a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorCMC.java +++ b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorCMC.java @@ -1,53 +1,46 @@ package mage.client.deck.generator; -import java.util.ArrayList; +import com.google.common.collect.ImmutableList; + import java.util.List; public enum DeckGeneratorCMC { - Low( - new ArrayList() {{ - add(new CMC(0, 2, 0.60f)); - add(new CMC(3, 4, 0.30f)); - add(new CMC(5, 6, 0.10f)); - }}, - new ArrayList() {{ - add(new CMC(0, 2, 0.65f)); - add(new CMC(3, 4, 0.30f)); - add(new CMC(5, 5, 0.05f)); - }}), - Default( - new ArrayList() {{ - add(new CMC(0, 2, 0.20f)); - add(new CMC(3, 5, 0.50f)); - add(new CMC(6, 7, 0.25f)); - add(new CMC(8, 100, 0.05f)); - }}, - new ArrayList() {{ - add(new CMC(0, 2, 0.30f)); - add(new CMC(3, 4, 0.45f)); - add(new CMC(5, 6, 0.20f)); - add(new CMC(7, 100, 0.05f)); - }}), - High( - new ArrayList() {{ - add(new CMC(0, 2, 0.05f)); - add(new CMC(3, 5, 0.35f)); - add(new CMC(6, 7, 0.40f)); - add(new CMC(8, 100, 0.15f)); - }}, - new ArrayList() {{ - add(new CMC(0, 2, 0.10f)); - add(new CMC(3, 4, 0.30f)); - add(new CMC(5, 6, 0.45f)); - add(new CMC(7, 100, 0.15f)); - }}); + Low(ImmutableList.builder() + .add(new CMC(0, 2, 0.60f)) + .add(new CMC(3, 4, 0.30f)) + .add(new CMC(5, 6, 0.10f)).build(), + ImmutableList.builder() + .add(new CMC(0, 2, 0.65f)) + .add(new CMC(3, 4, 0.30f)) + .add(new CMC(5, 5, 0.05f)).build()), + Default(ImmutableList.builder() + .add(new CMC(0, 2, 0.20f)) + .add(new CMC(3, 5, 0.50f)) + .add(new CMC(6, 7, 0.25f)) + .add(new CMC(8, 100, 0.05f)).build(), + ImmutableList.builder() + .add(new CMC(0, 2, 0.30f)) + .add(new CMC(3, 4, 0.45f)) + .add(new CMC(5, 6, 0.20f)) + .add(new CMC(7, 100, 0.05f)).build()), - private final ArrayList poolCMCs60; - private final ArrayList poolCMCs40; + High(ImmutableList.builder(). + add(new CMC(0, 2, 0.05f)) + .add(new CMC(3, 5, 0.35f)) + .add(new CMC(6, 7, 0.40f)) + .add(new CMC(8, 100, 0.15f)).build(), + ImmutableList.builder(). + add(new CMC(0, 2, 0.10f)) + .add(new CMC(3, 4, 0.30f)) + .add(new CMC(5, 6, 0.45f)) + .add(new CMC(7, 100, 0.15f)).build()); - DeckGeneratorCMC(ArrayList CMCs60, ArrayList CMCs40) { + private final List poolCMCs60; + private final List poolCMCs40; + + DeckGeneratorCMC(List CMCs60, List CMCs40) { this.poolCMCs60 = CMCs60; this.poolCMCs40 = CMCs40; } @@ -60,8 +53,7 @@ public enum DeckGeneratorCMC { return this.poolCMCs60; } - static class CMC - { + static class CMC { public final int min; public final int max; public final float percentage; @@ -69,12 +61,12 @@ public enum DeckGeneratorCMC { /** * Constructs a CMC range given a minimum and maximum, and the percentage of cards that are in this range. - * @param min the minimum CMC a card in this range can be. - * @param max the maximum CMC a card in this range can be. + * + * @param min the minimum CMC a card in this range can be. + * @param max the maximum CMC a card in this range can be. * @param percentage the percentage of cards in the range (min, max) */ - CMC(int min, int max, float percentage) - { + CMC(int min, int max, float percentage) { this.min = min; this.max = max; this.percentage = percentage; @@ -82,19 +74,19 @@ public enum DeckGeneratorCMC { /** * Sets the amount of cards needed in this CMC range. + * * @param amount the number of cards needed. */ - public void setAmount(int amount) - { + public void setAmount(int amount) { this.amount = amount; } /** * Gets the number of cards needed in this CMC range. + * * @return the number of cards needed in this CMC range. */ - public int getAmount() - { + public int getAmount() { return this.amount; } }