From 78d9c539e25f16fd15f06c2b2c48c0ad37a21540 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 28 Mar 2016 08:44:54 -0400 Subject: Imported dice stuff from general utils into dedicated project --- dice-lang/src/bjc/utils/dice/ScalarDie.java | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 dice-lang/src/bjc/utils/dice/ScalarDie.java (limited to 'dice-lang/src/bjc/utils/dice/ScalarDie.java') diff --git a/dice-lang/src/bjc/utils/dice/ScalarDie.java b/dice-lang/src/bjc/utils/dice/ScalarDie.java new file mode 100644 index 0000000..4ed99b9 --- /dev/null +++ b/dice-lang/src/bjc/utils/dice/ScalarDie.java @@ -0,0 +1,45 @@ +package bjc.utils.dice; + +/** + * A die that represents a static number + * + * @author ben + * + */ +public class ScalarDie implements IDiceExpression { + /** + * The represented number + */ + private int num; + + /** + * Create a dice with the specified number + * + * @param num + * The number used for the dice + */ + public ScalarDie(int num) { + this.num = num; + } + + /* + * (non-Javadoc) + * + * @see bjc.utils.dice.IDiceExpression#roll() + */ + @Override + public int roll() { + return num; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return Integer.toString(num); + } + +} -- cgit v1.2.3