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