/** * This class counts the number of variables appearing in the given formula. * */ class VariableCounter extends TUCombinerFloatAdd { Float apply(Variable v) { System.out.println("in apply Variable; return 1"); return 1.0f; } static Float countVariables(Object o){ return traverse(o, new VariableCounter()); } }