- int ret = compareTo0(r);
- if (ret != 0) return -1 * ret;
- return (position.ord - r.position.ord);
- }
-
- private static boolean isRightNullable(Walk.Cache c, Position p) {
- if (p.isLast()) return true;
- if (!c.possiblyEpsilon(p.element())) return false;
- return isRightNullable(c, p.next());
- }
-
- public static boolean canKill(Walk.Cache cache, Position mep, Position himp) {
- if (!isRightNullable(cache, mep)) return false;
- if (!isRightNullable(cache, himp)) return false;
- Sequence me = mep.owner();
- Sequence him = himp.owner();
- Boolean b = me.canKill.get(him);
- if (b!=null) return b;
- for(Sequence killer : him.hates()) {
- HashSet<Sequence> eq2 = new Walk.EquivalentTo(killer, cache).walk();
- if (eq2.contains(me)) { me.canKill.put(him, true); return true; }
+ if (parent.phase()!=null || r.parent.phase()!=null) {
+ if (parent.phase()==null) return 1;
+ if (r.parent.phase()==null) return -1;
+ if (parent.phase().pos < r.parent.phase().pos) return 1;
+ if (parent.phase().pos > r.parent.phase().pos) return -1;