// 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 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>();
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)