Exemple #1
0
 public HeavyObject GetHeavyObject(FlyWeightObject key)
 {
     if (repository.TryGetValue(key, out HeavyObject heavyObj))
     {
         return(heavyObj);
     }
     else
     {
         repository.Add(key, new HeavyObject(key));
         return(repository[key]);
     }
 }
Exemple #2
0
 public HeavyObject(FlyWeightObject flyObject)
 {
     this.flyObject = flyObject;
     this.Value     = Math.Pow(flyObject.Base, flyObject.Power);
 }