X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FWalk.java;h=a92bcb8eaa6d875f243b3e74d76398e169c552d1;hb=a8478f5ddfbfbc8d910d09f27163cbd55752d3b6;hp=3d2346999e7c73deb178971d888fdf2efd7fa3b2;hpb=111166986ad83b54d0cae5c03c2304d23e332f29;p=sbp.git diff --git a/src/edu/berkeley/sbp/Walk.java b/src/edu/berkeley/sbp/Walk.java index 3d23469..a92bcb8 100644 --- a/src/edu/berkeley/sbp/Walk.java +++ b/src/edu/berkeley/sbp/Walk.java @@ -1,3 +1,5 @@ +// 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.*; @@ -16,7 +18,7 @@ abstract class Walk { public Walk() { this(null); } public Walk(Cache c) { this.c = c; } - public T sequence(Sequence s) { + public T walkSequence(Sequence s) { T ret = bottom(s); for(Position p = s.firstp(); p!=null && !p.isLast(); p = p.next()) ret = sequence(s, ret, walk(p.element())); @@ -34,7 +36,7 @@ abstract class Walk { protected T walk2(SequenceOrElement e) { if (e instanceof Atom) return walkAtom((Atom)e); - else if (e instanceof Sequence) return sequence((Sequence)e); + else if (e instanceof Sequence) return walkSequence((Sequence)e); else if (e instanceof Union) { T ret = bottom(e); for(Sequence s : (Union)e) { @@ -55,7 +57,7 @@ abstract class Walk { public final HashSet walk() { return walk(e); } public YieldSet(SequenceOrElement e, Cache c) { super(c); this.e = e; } public HashSet bottom(SequenceOrElement e) { return acc; } - public HashSet sequence(Sequence seq) { return bottom(seq); } + public HashSet walkSequence(Sequence seq) { return bottom(seq); } public HashSet walkAtom(Atom r) { c.atoms.put(e, c.atoms.get(e)==null ? r : c.atoms.get(e).union(r)); return super.walkAtom(r); @@ -93,7 +95,7 @@ abstract class Walk { static class First extends WalkTokenSet { public First(Topology cs, Walk.Cache cache) { super(cs, cache); } - public Topology sequence(Sequence seq) { + public Topology walkSequence(Sequence seq) { for(Position p = seq.firstp(); p!=null && !p.isLast(); p = p.next()) { walk(p.element()); if (!c.possiblyEpsilon(p.element())) break; @@ -107,9 +109,10 @@ abstract class Walk { private final HashSet all; private boolean eof = false; public boolean includesEof() { return eof; } - public Follow(Topology cs, SequenceOrElement me, HashSet all, Cache c) { super(cs, c); this.me = me; this.all = all; } + public Follow(Topology cs, SequenceOrElement me, HashSet all, Cache c) { + super(cs, c); this.me = me; this.all = all; } public Topology bottom(SequenceOrElement e) { return cs; } - public Topology sequence(Sequence seq) { return cs; } + public Topology walkSequence(Sequence seq) { return cs; } public Topology walkAtom(Atom r) { return walk((SequenceOrElement)r); } public Topology walk(SequenceOrElement e) { if (acc.contains(e)) return bottom(e);