diff options
| author | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
| commit | 01136c6796e21f023713e026674576d8e623462d (patch) | |
| tree | e77886fe0e0adaf3c0430fba9ce248ef83f74fe4 /dice-lang/src/bjc/dicelang/v1/ComplexDice.java | |
| parent | 870d769cfc152171d27b2331a7c590d0b307ad48 (diff) | |
Formatting
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v1/ComplexDice.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/v1/ComplexDice.java | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/dice-lang/src/bjc/dicelang/v1/ComplexDice.java b/dice-lang/src/bjc/dicelang/v1/ComplexDice.java index 62d59c6..b9796f9 100644 --- a/dice-lang/src/bjc/dicelang/v1/ComplexDice.java +++ b/dice-lang/src/bjc/dicelang/v1/ComplexDice.java @@ -1,8 +1,8 @@ package bjc.dicelang.v1; /** - * Implements a collection of one or more of a particular die, where the - * number of dice in the group is variable. + * Implements a collection of one or more of a particular die, where the number + * of dice in the group is variable. * * @author ben * @@ -12,7 +12,7 @@ public class ComplexDice implements IDiceExpression { * Create a dice from a string expression * * @param expression - * The string to parse the dice from + * The string to parse the dice from * @return A dice group parsed from the string */ public static IDiceExpression fromString(String expression) { @@ -28,38 +28,35 @@ public class ComplexDice implements IDiceExpression { try { // Create the actual group of dice - return new ComplexDice( - new ScalarDie(Integer.parseInt(strangs[0])), + return new ComplexDice(new ScalarDie(Integer.parseInt(strangs[0])), new Die(Integer.parseInt(strangs[1]))); } catch (NumberFormatException nfex) { // We don't care about details // Tell the user the expression is invalid - throw new IllegalArgumentException( - "Attempted to create a set of dice using invalid arguments." - + " They must be integers. " + strangs[0] - + " and " + strangs[1] - + " are likely culprits."); + throw new IllegalArgumentException("Attempted to create a set of dice using invalid arguments." + + " They must be integers. " + strangs[0] + " and " + strangs[1] + + " are likely culprits."); } } /* * The die being rolled */ - private IDiceExpression die; + private IDiceExpression die; /* * The number of the particular die to roll */ - private IDiceExpression nDice; + private IDiceExpression nDice; /** * Create a new collection of dice * * @param nDce - * The number of dice in the collection + * The number of dice in the collection * @param de - * The type of dice the collection is composed of + * The type of dice the collection is composed of */ public ComplexDice(IDiceExpression nDce, IDiceExpression de) { nDice = nDce; @@ -70,9 +67,9 @@ public class ComplexDice implements IDiceExpression { * Create a new collection of dice * * @param nSides - * The number of dice in the collection + * The number of dice in the collection * @param de - * The type of dice the collection is composed of + * The type of dice the collection is composed of */ public ComplexDice(int nSides, int de) { nDice = new ScalarDie(nSides); @@ -93,10 +90,9 @@ public class ComplexDice implements IDiceExpression { @Override public int optimize() { if (!canOptimize()) { - throw new UnsupportedOperationException( - "This complex dice cannot be optimized. " - + "Both the dice to be rolled and the number of" - + " dice must be optimizable."); + throw new UnsupportedOperationException("This complex dice cannot be optimized. " + + "Both the dice to be rolled and the number of" + + " dice must be optimizable."); } return nDice.optimize(); @@ -112,9 +108,8 @@ public class ComplexDice implements IDiceExpression { int nRoll = nDice.roll(); if (nRoll < 0) { - throw new UnsupportedOperationException( - "Attempted to roll a negative number of dice. " - + "The problematic expression is " + nDice); + throw new UnsupportedOperationException("Attempted to roll a negative number of dice. " + + "The problematic expression is " + nDice); } // Roll all the dice and combine them @@ -132,7 +127,6 @@ public class ComplexDice implements IDiceExpression { return nDice.toString() + die.toString(); } - return "complex[n=" + nDice.toString() + ", d=" + die.toString() - + "]"; + return "complex[n=" + nDice.toString() + ", d=" + die.toString() + "]"; } } |
