X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=e18f5efc5ca56271fa6e225e75e0bf07d7062cbd;hp=a5149f2d094ef3dee1b4712f7bc67713eeb9650c;hb=242a8711e98cbd3ed6d05271bf910fde38e9be9a;hpb=87f214f3da9f43c3ab93923313845c372f9a96be diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index a5149f2..e18f5ef 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -35,11 +35,11 @@ public abstract class Sequence extends Element implements Iterable { //////////////////////////////////////////////////////////////////////////////// - public Topology noFollow() { return null; } + public Element noFollow = null; + public final Topology noFollow() { return noFollow==null ? null : noFollow.toAtom(); } Topology toAtom() { - if (elements.length>1) throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this); - if (elements.length==0) return null; + if (elements.length!=1) throw new RuntimeException("cannot invoke toAtom() on a Sequence with " + elements.length + " elements: " + this); return elements[0].toAtom(); }