checkpoint
[sbp.git] / src / edu / berkeley / sbp / Sequence.java
index 1d56343..975b2b1 100644 (file)
@@ -19,8 +19,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
 
     final Position          firstp;
 
-    public Atom follow = null;
-    public final Atom follow() { return follow; }
+    Atom follow = null;
 
     // Static Constructors //////////////////////////////////////////////////////////////////////////////
 
@@ -63,6 +62,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
 
     public Sequence and(Sequence s) { Sequence ret = dup(); ret.needs.add(s); return ret; }
     public Sequence not(Sequence s) { Sequence ret = dup(); ret.hates.add(s); s.hated.add(ret); return ret; }
+    public Sequence followedBy(Atom a) { Sequence ret = dup(); ret.follow = a; return ret; }
 
     public Iterable<Sequence> needs() { return needs; }
     public Iterable<Sequence> hates() { return hates; }
@@ -90,7 +90,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
     // Position //////////////////////////////////////////////////////////////////////////////
 
     /** the imaginary position before or after an element of a sequence; corresponds to an "LR item" */
-    public class Position implements IntegerMappable {
+    class Position implements IntegerMappable {
 
         private Forest zero = null;
         public Forest zero() {