Example #1
0
		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 x)
 {
     try
     {
         return v.visit(x);
     }
     catch (VisitFailure) {}
     int childCount = x.getChildCount();
     for (int i = 0; i < childCount; i++)
     {
         pending.Enqueue(x.getChildAt(i));
     }
     if (pending.Count != 0)
     {
         IVisitable next = (IVisitable) pending.Dequeue();
         next = this.visit(next);
     }
     return x;
 }
Example #3
0
 // 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;
 }