public Exp replace(Exp olde, Exp newe) { // System.out.println("Exps: "+exps); if (equals(olde)) return newe; Exp e; for (int i = 0; i < exps.size(); i++) { e = exps.get(i); if (e.equals(olde)) exps.set(i, newe); else exps.set(i, e.replace(olde, newe)); e = exps.get(i); if (e == null) return null; } return this; }