summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/rgens/parser/ConfigSet.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2019-08-28 19:50:36 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2019-08-28 19:50:36 -0300
commit1914335b9505b0086a0aeed0997c566e0e5ceca3 (patch)
tree9ab2b53aa18f945c1693d503b555fef8a1032fc5 /src/main/java/bjc/rgens/parser/ConfigSet.java
parentb7193cf955e7b2d2474d728c4087bc36597f0c7f (diff)
Add additional comments & such
Diffstat (limited to 'src/main/java/bjc/rgens/parser/ConfigSet.java')
-rw-r--r--src/main/java/bjc/rgens/parser/ConfigSet.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/bjc/rgens/parser/ConfigSet.java b/src/main/java/bjc/rgens/parser/ConfigSet.java
index 8d7c63e..0ed8167 100644
--- a/src/main/java/bjc/rgens/parser/ConfigSet.java
+++ b/src/main/java/bjc/rgens/parser/ConfigSet.java
@@ -5,23 +5,65 @@ import java.util.Map;
import bjc.rgens.parser.templates.GrammarTemplate;
+/**
+ * Represents a collection of grammar sets, templates and subcollections of the same
+ * that are logically grouped together.
+ *
+ * In many cases, there will be a one-to-one mapping between grammar sets and
+ * config sets, but that doesn't have to be the case. In addition, the config
+ * set provides a convenient place to set the non-grammar objects that are
+ * defined via config files, such as templates, or Markov generators.
+ *
+ * @author Ben Culkin
+ */
public class ConfigSet {
+ // @NOTE Should these fields be public, or do we want to create accessor
+ // methods for them, since at least grammars have some extra stuff that
+ // needs to be done when they are associated/unassociated with a config
+ // set.
+ /*
+ * Represents all of the grammar sets that are mapped into this config
+ * set.
+ */
public final Map<String, RGrammarSet> grammars;
+
+ /*
+ * Represents all of the templates that are mapped into this config set.
+ */
public final Map<String, GrammarTemplate> templates;
+
+ /*
+ * Represents all of the sub-configurations that are mapped into this
+ * config set.
+ */
public final Map<String, ConfigSet> subconfigs;
+ /**
+ * Create a new blank config set.
+ */
public ConfigSet() {
grammars = new HashMap<>();
templates = new HashMap<>();
subconfigs = new HashMap<>();
}
+ /**
+ * Create a grammar set with the given name in this config set.
+ *
+ * @param name
+ * The name of the grammar set to create.
+ *
+ * @return The grammar set, properly bound and initialized for this
+ * config set.
+ */
public RGrammarSet createGSet(String name) {
RGrammarSet st = new RGrammarSet();
+ // Init. the properties of the grammar set
st.belongsTo = this;
st.name = name;
+ // Add it to ourselves
grammars.put(name, st);
return st;