protected IPointList makePointList(EligibleHomeSites inEhs) { IPointList pl = null; mLog.Debug("inside make point list going to make " + inEhs.SiteCount.ToString() + " points"); try { pl = new IPointList(); IPoint p = null; for (int i = 0; i < inEhs.SiteCount - 1; i++) { p.X = inEhs.getSite(i).X; p.Y = inEhs.getSite(1).Y; pl.add(p); } mLog.Debug("actuall made " + pl.Count().ToString() + " points"); } catch (System.Exception ex) { #if (DEBUG) System.Windows.Forms.MessageBox.Show(ex.Message); #endif eLog.Debug(ex); } return(pl); }
protected IPoint getHomeRangeCenter(EligibleHomeSites inEhs) { double luckyNumber = rn.getUniformRandomNum(); IPoint p = null; int i = 0; try { mLog.Debug("inside getHomeRangeCenter "); mLog.Debug("the roll of the dice is " + luckyNumber.ToString()); logValues(inEhs); //should set up some sort of binary search but wtf over budget already. while (luckyNumber >= inEhs.getSite(i++).Rank) { mLog.Debug("current site rank is " + inEhs.getSite(i).Rank.ToString()); } //since the index is auto incremented we are one past after the comparison //so we need to go back 1 to get the correct point //if it was the first one in the list then we can not go back any further if (i > 0) { i--; } p = new PointClass(); p.X = inEhs.getSite(i).X; p.Y = inEhs.getSite(i).Y; mLog.Debug("site we chose has a rank of " + inEhs.getSite(i).Rank.ToString()); } catch (System.Exception ex) { #if (DEBUG) System.Windows.Forms.MessageBox.Show(ex.Message); #endif eLog.Debug(ex); } return(p); }
private void logValues(EligibleHomeSites inEhs) { EligibleHomeSite eh; for (int i = 0; i < inEhs.SiteCount; i++) { eh = inEhs.getSite(i); mLog.Debug("site number " + i.ToString()); mLog.Debug("site is eligible = " + eh.SuitableSite.ToString()); mLog.Debug("X = " + eh.X.ToString() + " Y+ " + eh.Y.ToString()); mLog.Debug("rank is " + eh.Rank.ToString()); } }