summaryrefslogtreecommitdiff
path: root/dice/src/main/java/bjc/dicelang/dicev2/Die.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-04-13 18:32:11 -0400
committerBen Culkin <scorpress@gmail.com>2020-04-13 18:32:11 -0400
commit5a26fb2c0d899b1c80fabb39366a7b7db4d8ca41 (patch)
tree19e19dab7c72aaee504a07e9434cde8c379092c8 /dice/src/main/java/bjc/dicelang/dicev2/Die.java
parent25fbdca78518df0cb096544e912cdb3913f348fd (diff)
Add some javadoc
Add some javadoc comments
Diffstat (limited to 'dice/src/main/java/bjc/dicelang/dicev2/Die.java')
-rw-r--r--dice/src/main/java/bjc/dicelang/dicev2/Die.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/dice/src/main/java/bjc/dicelang/dicev2/Die.java b/dice/src/main/java/bjc/dicelang/dicev2/Die.java
index d688cfa..ab4f880 100644
--- a/dice/src/main/java/bjc/dicelang/dicev2/Die.java
+++ b/dice/src/main/java/bjc/dicelang/dicev2/Die.java
@@ -2,6 +2,11 @@ package bjc.dicelang.dicev2;
import java.util.Random;
+/**
+ * An abstract class that represents a single pool of dice.
+ * @author Ben Culkin
+ *
+ */
public abstract class Die {
private static final Random BASE = new Random();
@@ -15,13 +20,37 @@ public abstract class Die {
rng = rnd;
}
+ /**
+ * Set the RNG this die pool uses.
+ * @param rnd The RNG used by the die pool.
+ */
public void setRandom(Random rnd) {
rng = rnd;
}
+ /**
+ * Roll the entire die pool.
+ * @return The results from rolling the dice.
+ */
public abstract long[] roll();
+ /**
+ * Roll a single die in the pool.
+ *
+ * For pools with multiple die, this may be somewhat arbitrary.
+ * @return Result from rolling a single die in the pool.
+ */
public abstract long rollSingle();
+ /**
+ * Can this pool be optimized?
+ * @return Is the pool optimizable?
+ */
public abstract boolean canOptimize();
+ /**
+ * Optimize the die pool.
+ *
+ * Is undefined if called while canOptimize is false.
+ * @return The optimized version of the pool.
+ */
public abstract long optimize();
}