示例#1
0
 public object visit(fruit f)
 {
     if (f.Calories < min.Calories)
     {
         min = f;
     }
     return(f.nextitem.accept(this));
 }
示例#2
0
 public object visit(fruit f)
 {
     if (state != "fruit")
     {
         return(false);
     }
     else
     {
         return(f.nextitem.accept(this));
     }
 }
示例#3
0
 public object visit(fruit f)
 {
     Console.WriteLine("I'm eating the fruit " + f);
     cals += f.Calories;
     if (cals < max)
     {
         return(f.nextitem.accept(this));
     }
     else
     {
         return(cals);
     }
 }
示例#4
0
 public object visit(fruit f)
 {
     foodSum += f.Calories;
     return(f.nextitem.accept(this));
 }