return ret;
}
+ public Sequence sequence(Object o, boolean lame) {
+ return new PreSequence((Element[])Reflection.lub((Object[])o), null).buildSequence(null, lame, false);
+ }
public Object walk(Tree<String> tree) {
String head = tree.head();
if (tree.numChildren()==0) return super.walk(tree);
else if ("++".equals(head)) return Repeat.maximal1((Element)walk(tree.child(0)));
else if ("?".equals(head)) return Repeat.maybe((Element)walk(tree.child(0)));
else if ("!".equals(head)) { Element e = (Element)walk(tree.child(0)); dropAll.add(e); return e; }
- else if ("&".equals(head))
- return ((Sequence)walk(tree,0)).and(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
- else if ("&~".equals(head))
- return ((Sequence)walk(tree,0)).not(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false));
+ else if ("&".equals(head)) return ((Sequence)walk(tree,0)).and(sequence(walk(tree, 1), true));
+ else if ("&~".equals(head)) return ((Sequence)walk(tree,0)).not(sequence(walk(tree, 1), true));
else if ("epsilon".equals(head)) return Union.epsilon;
else if ("()".equals(head)) return Union.epsilon;
else if (")".equals(head)) return SELF;
else if ("psy".equals(head)) return (PreSequence)walk(tree, 0);
else if ("->".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.noFollow = (Element)walk(tree, 1); return p; }
else if ("/".equals(head)) return ((PreSequence)walk(tree, 0)).sparse((Element)walk(tree, 1));
- else if ("~".equals(head))
- return new Hack(new Atom.Invert(new Atom.Infer((Element)walk(tree, 0))));
+ else if ("~".equals(head)) return new Hack(new Atom.Invert(new Atom.Infer((Element)walk(tree, 0))));
else if ("ps".equals(head)) return new PreSequence((Element[])walk(tree, 0));
else if ("qprod".equals(head)) {
String s = string(tree.child(0));
package edu.berkeley.sbp.util;
import java.util.*;
+/** a Map that knows how to apply an Invokable to all its elements */
public interface VisitableMap<K,V> {
+
+ /** invokes <tt>ivbc</tt> on each element of this map, passing constant arguments <tt>b</tt> and <tt>c</tt> */
public <B,C> void invoke(K k, Invokable<V,B,C> ivbc, B b, C c);
+
+ /** returns true iff this map contains some value <tt>v</tt> for key <tt>k</tt> */
public boolean contains(K k);
+
}