- public static final int LESS_THAN = -1;
- public static final int EQUAL_TO = 0;
- public static final int GREATER_THAN = 1;
-
- public int compareTo0(Reduction n) {
- if (targetPhase()==null && n.targetPhase()==null) return EQUAL_TO;
- if (targetPhase()==null) return LESS_THAN;
- if (n.targetPhase()==null) return GREATER_THAN;
- if (targetPhase().pos < n.targetPhase().pos) return LESS_THAN;
- if (targetPhase().pos > n.targetPhase().pos) return GREATER_THAN;
- return 0;
- }
- public int pos() { return targetPhase()==null ? 0 : targetPhase().pos; }
- public GSS.Phase targetPhase() { return node.phase(); }
-
- public static boolean canNeed(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();
- for(Sequence needer : him.needs()) {
- HashSet<Sequence> eq2 = new Walk.EquivalentTo(needer, cache).walk();
- if (eq2.contains(me)) return true;
- }
- return false;
- }
+ public void perform() { new Result(forest, parent, reduction, phase); }
+ public GSS.Phase parentPhase() { return parent.phase(); }
+ public Pos reduction() { return reduction; }
+ public GSS.Phase targetPhase() { return phase; }
+ public String toString() { return (parent.phase()==null ? 0 : parent.phase().pos) + ":"+reduction; }