public Visitable visit(Visitable any) throws VisitFailure { int childCount = any.getChildCount(); Visitable result = any; int successCount = 0; for (int i = 0; i < childCount; i++) { try { result = result.setChildAt(i, v.visit(any.getChildAt(i))); successCount++; } catch (VisitFailure f) { } } if (successCount == 0) { failure.setMessage( "Some: None of the " + childCount + " arguments of " + any + " succeeded."); throw failure; } return result; }