summaryrefslogtreecommitdiff
path: root/dice/src/example
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2021-03-13 10:13:01 -0500
committerBen Culkin <scorpress@gmail.com>2021-03-13 10:13:01 -0500
commitee6a9305a1009e6f1e3e99d5de3cfba5305a5d1b (patch)
tree814ed2184dbc7c10eff387103e5b5b63cfb2e74f /dice/src/example
parent7efb7b9e997e0977c8343718cd8b5149805ea57b (diff)
Update documentation
Also, did the same thing for Die I did for DiePool, where I moved the specific classes to the same file as the interface.
Diffstat (limited to 'dice/src/example')
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/commands/HelpCommand.java5
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/commands/LiteralCommand.java16
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/commands/PolyhedralDieCommand.java6
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/commands/RollCommand.java6
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/commands/ShowBindingsCommand.java6
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/statements/IntegerStatementValue.java12
-rw-r--r--dice/src/example/java/bjc/dicelang/neodice/statements/VoidStatementValue.java4
7 files changed, 53 insertions, 2 deletions
diff --git a/dice/src/example/java/bjc/dicelang/neodice/commands/HelpCommand.java b/dice/src/example/java/bjc/dicelang/neodice/commands/HelpCommand.java
index 705745e..c10db4e 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/commands/HelpCommand.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/commands/HelpCommand.java
@@ -7,6 +7,11 @@ import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
+/**
+ * Diebox help command. Unimplemented as of yet.
+ * @author Ben Culkin
+ *
+ */
public class HelpCommand implements Command {
@Override
public StatementValue execute(Iterator<String> words, DieBoxCLI state) {
diff --git a/dice/src/example/java/bjc/dicelang/neodice/commands/LiteralCommand.java b/dice/src/example/java/bjc/dicelang/neodice/commands/LiteralCommand.java
index 9b42b42..b781ae9 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/commands/LiteralCommand.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/commands/LiteralCommand.java
@@ -5,12 +5,28 @@ import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
+/**
+ * A command that produces a literal statement value.
+ *
+ * This command will always produce the same statement value, so passing any sort
+ * of mutable statement value to it is asking to be hurt.
+ *
+ * @author Ben Culkin
+ *
+ */
public class LiteralCommand implements Command {
private final StatementValue value;
private final String shortHelp;
private final String longHelp;
+ /**
+ * Create a new command producing a literal statement value.
+ *
+ * @param value The value this command returns.
+ * @param shortHelp The short-help (summary) for this command.
+ * @param longHelp The long-help (description) for this command.
+ */
public LiteralCommand(StatementValue value, String shortHelp, String longHelp) {
this.value = value;
diff --git a/dice/src/example/java/bjc/dicelang/neodice/commands/PolyhedralDieCommand.java b/dice/src/example/java/bjc/dicelang/neodice/commands/PolyhedralDieCommand.java
index aad2a24..e0f66b1 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/commands/PolyhedralDieCommand.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/commands/PolyhedralDieCommand.java
@@ -7,6 +7,12 @@ import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
+/**
+ * A command that produces a polyhedral die.
+ *
+ * @author Ben Culkin
+ *
+ */
public class PolyhedralDieCommand implements Command {
@Override
public StatementValue execute(Iterator<String> words, DieBoxCLI state) {
diff --git a/dice/src/example/java/bjc/dicelang/neodice/commands/RollCommand.java b/dice/src/example/java/bjc/dicelang/neodice/commands/RollCommand.java
index eb8beda..cec7c48 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/commands/RollCommand.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/commands/RollCommand.java
@@ -7,6 +7,12 @@ import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
+/**
+ * A command that rolls a die or die-pool.
+ *
+ * @author Ben Culkin
+ *
+ */
public class RollCommand implements Command {
@Override
public StatementValue execute(Iterator<String> words, DieBoxCLI state) {
diff --git a/dice/src/example/java/bjc/dicelang/neodice/commands/ShowBindingsCommand.java b/dice/src/example/java/bjc/dicelang/neodice/commands/ShowBindingsCommand.java
index fe2ac89..75811b6 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/commands/ShowBindingsCommand.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/commands/ShowBindingsCommand.java
@@ -7,6 +7,12 @@ import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
+/**
+ * A command that shows all of the currently bound variables.
+ *
+ * @author Ben Culkin
+ *
+ */
public class ShowBindingsCommand implements Command {
@Override
public StatementValue execute(Iterator<String> words, DieBoxCLI state) {
diff --git a/dice/src/example/java/bjc/dicelang/neodice/statements/IntegerStatementValue.java b/dice/src/example/java/bjc/dicelang/neodice/statements/IntegerStatementValue.java
index 91e45b6..88508d2 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/statements/IntegerStatementValue.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/statements/IntegerStatementValue.java
@@ -2,9 +2,19 @@ package bjc.dicelang.neodice.statements;
import static bjc.dicelang.neodice.statements.StatementValue.Type.*;
+/**
+ * Statement value that represents an integer.
+ * @author Ben Culkin
+ *
+ */
public class IntegerStatementValue extends StatementValue {
- public final int value;
+ /** The integer value. */
+ public final int value;
+ /**
+ * Create an integer statement value.
+ * @param value The int to use as the value.
+ */
public IntegerStatementValue(int value) {
super(INTEGER);
diff --git a/dice/src/example/java/bjc/dicelang/neodice/statements/VoidStatementValue.java b/dice/src/example/java/bjc/dicelang/neodice/statements/VoidStatementValue.java
index 7e437e7..a71d49c 100644
--- a/dice/src/example/java/bjc/dicelang/neodice/statements/VoidStatementValue.java
+++ b/dice/src/example/java/bjc/dicelang/neodice/statements/VoidStatementValue.java
@@ -3,11 +3,13 @@ package bjc.dicelang.neodice.statements;
import static bjc.dicelang.neodice.statements.StatementValue.Type.*;
/**
+ * The statement value of the null type.
* @author Ben Culkin
*
*/
public class VoidStatementValue extends StatementValue {
- public static final VoidStatementValue VOID_INST = new VoidStatementValue();
+ /** The singular instance of the null value. */
+ public static final VoidStatementValue VOID_INST = new VoidStatementValue();
private VoidStatementValue() {
super(VOID);