rename edu.berkeley.sbp.Cache to Grammar
[sbp.git] / src / edu / berkeley / sbp / Grammar.java
similarity index 93%
rename from src/edu/berkeley/sbp/Cache.java
rename to src/edu/berkeley/sbp/Grammar.java
index c600454..9b332d8 100644 (file)
@@ -1,15 +1,22 @@
 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
 
 package edu.berkeley.sbp;
 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
 
 package edu.berkeley.sbp;
-import edu.berkeley.sbp.*;
 import edu.berkeley.sbp.util.*;
 import edu.berkeley.sbp.Sequence.Position;
 import java.io.*;
 import java.util.*;
 import edu.berkeley.sbp.util.*;
 import edu.berkeley.sbp.Sequence.Position;
 import java.io.*;
 import java.util.*;
-import java.lang.reflect.*;
-import java.lang.ref.*;
 
 
-abstract class Cache<Token> {
+/**
+ *  A collection of Elements and Sequences which only reference each other.
+ *
+ *  All analyses are done at the Grammar level, since a given
+ *  Element/Sequence can appear in multiple Grammars.  Some of these
+ *  analyses depend on which elements *reference* a given element,
+ *  rather than which elements *are referenced by* a given element.
+ *
+ *  This class is package-private because it is likely to change often.
+ */
+abstract class Grammar<Token> {
     protected Union rootUnion;
 
     public HashMap<Sequence, Topology> follow = new HashMap<Sequence, Topology>();
     protected Union rootUnion;
 
     public HashMap<Sequence, Topology> follow = new HashMap<Sequence, Topology>();
@@ -18,7 +25,7 @@ abstract class Cache<Token> {
     public HashSet<SequenceOrElement> all = new HashSet<SequenceOrElement>();
 
     abstract Topology<Token> emptyTopology();
     public HashSet<SequenceOrElement> all = new HashSet<SequenceOrElement>();
 
     abstract Topology<Token> emptyTopology();
-    public Cache(Union root) {
+    public Grammar(Union root) {
         this.rootUnion = root;
         if (root != null)
             for(Sequence s : root)
         this.rootUnion = root;
         if (root != null)
             for(Sequence s : root)