private Pos reduction;
private GSS.Phase phase;
private Forest forest;
- private Node parent;
+ private Node pred;
- public Reduction(Node parent, Pos reduction, Forest forest, GSS.Phase target) {
+ public Reduction(Node pred, Pos reduction, Forest forest, GSS.Phase target) {
this.reduction = reduction;
this.forest = forest;
this.phase = target;
- this.parent = parent;
+ this.pred = pred;
target.addReduction(this);
}
public int compareTo(Reduction r) {
- 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;
+ if (pred.phase()!=null || r.pred.phase()!=null) {
+ if (pred.phase()==null) return 1;
+ if (r.pred.phase()==null) return -1;
+ if (pred.phase().pos < r.pred.phase().pos) return 1;
+ if (pred.phase().pos > r.pred.phase().pos) return -1;
}
/*
int master = Parser.mastercache.comparePositions(reduction(), r.reduction());
return 1;
}
- public void perform() { new Result(forest, parent, reduction, phase); }
- public GSS.Phase parentPhase() { return parent.phase(); }
+ public void perform() {
+ if (reduction==null) return;
+ phase.newNodeFromReduction(forest, reduction, pred);
+ }
+ public GSS.Phase predPhase() { return pred.phase(); }
public Pos reduction() { return reduction; }
public GSS.Phase targetPhase() { return phase; }
- public String toString() { return (parent.phase()==null ? 0 : parent.phase().pos) + ":"+reduction; }
+ public String toString() { return (pred.phase()==null ? 0 : pred.phase().pos) + ":"+reduction; }
}