summaryrefslogtreecommitdiff
path: root/RGens/src/main/java/bjc/rgens/newparser/RuleCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'RGens/src/main/java/bjc/rgens/newparser/RuleCase.java')
-rw-r--r--RGens/src/main/java/bjc/rgens/newparser/RuleCase.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/RGens/src/main/java/bjc/rgens/newparser/RuleCase.java b/RGens/src/main/java/bjc/rgens/newparser/RuleCase.java
index c22aa98..4ec0d2d 100644
--- a/RGens/src/main/java/bjc/rgens/newparser/RuleCase.java
+++ b/RGens/src/main/java/bjc/rgens/newparser/RuleCase.java
@@ -2,6 +2,11 @@ package bjc.rgens.newparser;
import bjc.utils.funcdata.IList;
+/*
+ * @NOTE
+ * If at some point we add new case types, they should go into subclasses,
+ * not into this class.
+ */
/**
* A case in a rule in a randomized grammar.
*
@@ -12,18 +17,13 @@ public class RuleCase {
* The possible types of a case.
*
* @author EVE
- *
*/
public static enum CaseType {
- /**
- * A normal case, composed from a list of elementList.
- */
+ /** A normal case, composed from a list of elementList. */
NORMAL,
}
- /**
- * The type of this case.
- */
+ /** The type of this case. */
public final CaseType type;
/**
@@ -41,16 +41,15 @@ public class RuleCase {
* Create a new case of the specified type.
*
* @param typ
- * The type of case to create.
+ * The type of case to create.
*
* @throws IllegalArgumentException
- * If the type requires parameters.
+ * If the type requires parameters.
*/
public RuleCase(CaseType typ) {
switch (typ) {
case NORMAL:
throw new IllegalArgumentException("This type requires an element list parameter");
-
default:
break;
}
@@ -63,19 +62,18 @@ public class RuleCase {
* parameter.
*
* @param typ
- * The type of case to create.
+ * The type of case to create.
*
* @param elements
- * The element list parameter of the case.
+ * The element list parameter of the case.
*
* @throws IllegalArgumentException
- * If this type doesn't take a element list parameter.
+ * If this type doesn't take a element list parameter.
*/
public RuleCase(CaseType typ, IList<CaseElement> elements) {
switch (typ) {
case NORMAL:
break;
-
default:
throw new IllegalArgumentException("This type doesn't have a element list parameter");
}
@@ -88,8 +86,9 @@ public class RuleCase {
/**
* Get the element list value of this type.
*
- * @return The element list value of this case, or null if this type
- * doesn't have one.
+ * @return
+ * The element list value of this case, or null if this type
+ * doesn't have one.
*/
public IList<CaseElement> getElements() {
return elementList;