Пример #1
0
 public Boolean FoodSiteAvailable(FoodSite foodSite)
 {
     if (!this.mediatorMap.ContainsKey(foodSite))
     {
         return(true);
     }
     return(this.mediatorMap[foodSite].FoodSiteAvailable());
 }
Пример #2
0
 public Boolean TryVisitFoodSite(FoodSite foodSite, Blob b)
 {
     if (!this.mediatorMap.ContainsKey(foodSite))
     {
         this.mediatorMap.TryAdd(foodSite, new FoodSiteMediator(foodSite));
     }
     return(this.mediatorMap[foodSite].TryVisit(b));
 }
Пример #3
0
 private void PlaceFoodRandomly(int numFood)
 {
     for (int i = 0; i < numFood; i++)
     {
         FoodSite food = new FoodSite();
         food.SetPosition(new RadialPosition(rng.NextDouble(), 2 * Math.PI * rng.NextDouble()));
         this.food.Add(food);
     }
 }
Пример #4
0
        public override Boolean Equals(object obj)
        {
            if ((obj == null) || !this.GetType().Equals(obj.GetType()))
            {
                return(false);
            }
            FoodSite food = (FoodSite)obj;

            return(this.id == food.id);
        }
Пример #5
0
 internal Boolean FoodSiteAvailable(FoodSite foodSite)
 {
     ensureSimulationActive();
     return(this.mediatorStore.FoodSiteAvailable(foodSite));
 }
Пример #6
0
 internal Boolean TryVisitFoodSite(FoodSite foodSite, Blob b)
 {
     ensureSimulationActive();
     return(this.mediatorStore.TryVisitFoodSite(foodSite, b));
 }
Пример #7
0
 public FoodSiteMediator(FoodSite fs)
 {
     this.foodSite = fs;
     this.blobs    = new List <Blob>();
 }
Пример #8
0
 public AtFoodSiteState(Blob b, FoodSite foodSite) : base(b)
 {
     this.foodSite = foodSite;
 }