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