public static BestFoodHomeRangeFinder getInstance() { if (uniqueInstance == null) { uniqueInstance = new BestFoodHomeRangeFinder(); } return(uniqueInstance); }
public bool setHomeRangeCriteria(string type) { bool success = false; try { mLog.Debug("inside AnimalManger setHomeRangeCriteria " + "for " + type); switch (type) { case ("Food"): mLog.Debug("making a foodie"); mHomeRangeFinder = BestFoodHomeRangeFinder.getInstance(); break; case ("Risk"): mLog.Debug("making a risky"); mHomeRangeFinder = BestRiskHomeRangeFinder.getInstance(); break; case ("Closest"): mLog.Debug("making a closest"); mHomeRangeFinder = ClosestHomeRangeFinder.getInstance(); break; case ("Combo"): mLog.Debug("making a combo"); mHomeRangeFinder = BestComboHomeRangeFinder.getInstance(); break; default: throw new ArgumentException("Unexpected Home Range Criteria sent in type = " + type); } mLog.Debug("now looping and setting the animals"); foreach (Animal a in this.myAnimals) { a.HomeRangeFinder = mHomeRangeFinder; } //if we get this far everything worked out fine success = true; } catch (System.Exception ex) { #if (DEBUG) System.Windows.Forms.MessageBox.Show(ex.Message); #endif eLog.Debug(ex); } return(success); }