Muster: Interpreter (Motivation)

(Wdhlg. Iterator)

enum Colour { Red, Green, Blue }
class Car { int wheels; Colour colour, }
class Store { 
  Collection<Car> contents; 
  Iterable<Car> all ();
}
soweit klar, aber wie macht man das besser:
class Store { ...
  Iterable<Car> more_than_5_wheels ();
  Iterable<Car> red ();  
  Iterable<Car> green_and_atmost_3_wheels ();
}



Johannes Waldmann 2011-07-07