From 5a26fb2c0d899b1c80fabb39366a7b7db4d8ca41 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:32:11 -0400 Subject: Add some javadoc Add some javadoc comments --- .../main/java/bjc/dicelang/dicev2/CountDieMod.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'dice/src/main/java/bjc/dicelang/dicev2/CountDieMod.java') diff --git a/dice/src/main/java/bjc/dicelang/dicev2/CountDieMod.java b/dice/src/main/java/bjc/dicelang/dicev2/CountDieMod.java index 0b5ec5b..c74e0bf 100644 --- a/dice/src/main/java/bjc/dicelang/dicev2/CountDieMod.java +++ b/dice/src/main/java/bjc/dicelang/dicev2/CountDieMod.java @@ -2,17 +2,44 @@ package bjc.dicelang.dicev2; import java.util.function.LongPredicate; +/** + * Create a die pool that will count successes/failures. + * @author Ben Culkin + * + */ public class CountDieMod extends Die { + /** + * The pool of dice that will be rolled. + */ public final Die[] dice; + /** + * The predicate for counting successes. + */ public final LongPredicate success; + /** + * The predicate for counting failures. + */ public LongPredicate failure; + /** + * Create a new counted die mod with a specified success criteria. + * + * @param success The predicate for determining a success. + * @param dice The pool of dice to roll. + */ public CountDieMod(LongPredicate success, Die... dice) { this(success, null, dice); } + /** + * Create a new counted die mod with a specified success criteria. + * + * @param success The predicate for determining a success. + * @param failure The predicate for determining a failure. + * @param dice The pool of dice to roll. + */ public CountDieMod(LongPredicate success, LongPredicate failure, Die... dice) { super(); @@ -22,10 +49,12 @@ public class CountDieMod extends Die { this.dice = dice; } + @Override public long[] roll() { return new long[] { rollSingle() }; } + @Override public long rollSingle() { long count = 0; @@ -42,10 +71,12 @@ public class CountDieMod extends Die { /* :UnoptimizableDice */ + @Override public boolean canOptimize() { return false; } + @Override public long optimize() { throw new UnsupportedOperationException("Counted dice can't be optimized"); } -- cgit v1.2.3