import edu.neu.ccs.demeterf.*; /** * This class will calculate the total weight of the CSP Formula * */ //public class HeightCalculator extends TUCombiner, Augmentor //{ class Height extends IDba{ int update(Node n, int i){ System.out.println(" height increased " + (i+1)); return i+1; } int combine(Node t, int d, int l, int r){ return Math.max(l,r); } // int combine(Empty l){ return 0; } int combine(Object n, int i){ return i; } int combine(Tree n, int i){ return i; } int combine(Tree t) { System.out.println("never ========================="); return 0; } static int height (Object o) { return new Traversal(new Height()). traverse(o,0); } } class Height2 extends IDb{ int combine(Node t, int d, int l, int r){ int n= Math.max(l,r) + 1; System.out.println(" height increased " + n); return n;} int combine(Empty l){ return 0; } int combine(Noise n, int i){ return i; } int combine(Tree t) { System.out.println("never ========================="); return 0; } static int height (Object o) { return new Traversal(new Height2()). traverse(o); } }