示例#1
0
 public void AddInumerator(INumerator numerator)
 {
     if (numerator != null)
     {
         inums.Add(numerator);
     }
     if (inums.Count == 1)
     {
         Index = 0;
     }
 }
示例#2
0
        static void Main(string[] args)
        {
            var hands    = new HandHeldInventory(new Sword(), new Shield());
            var knapsack = new KnapsackInventory(new List <Item>(new Item[] {
                new Apple(),
                new Medicine(),
                new Potion(),
                new SpellBook(),
                new Wand()
            }));

            INumerable inventory = knapsack;
            INumerator numerator = inventory.GetNumerator();

            while (!numerator.IsDone())
            {
                Console.WriteLine(numerator.CurrentItem().ToString().Split('.').Last());
                numerator.Next();
            }
        }
示例#3
0
 public VehicleFilter(INumerator prev, ISet <VehicleType> vehicles) : base(prev)
 {
     this.vehicles = vehicles;
 }
示例#4
0
 public PopulationFilter(INumerator prev, int population) : base(prev)
 {
     MinPopulation = population;
 }
示例#5
0
 public RestaiurantFilter(INumerator prev, bool Restaurant = false) : base(prev)
 {
     this.Restaurant = Restaurant;
 }
示例#6
0
 public AbstractDecorator(INumerator prev)
 {
     previous = prev;
 }