#region inRange /// /// Tests if this point falls within range 0-Size /// Pre-Condition: Size is not null /// Post-Condition: true if both x and y of this are /// between 0 and their corresponding component in Size /// otherwise false /// /// upper bounds of range check /// True if within range, otherwise false public bool inRange(Point size) { #region Pre-condition try { Check.Require(size != null); } catch (Exception e) { Console.Write(e.Message); } #endregion #region Code bool result = (X >= 0 && Y >= 0 && X < size.X && Y < size.Y); #endregion #region Post-condition try { if (result) Check.Assert(x >= 0 && x < size.X && y >= 0 && y < size.Y); else Check.Assert(x < 0 || x >= size.X || y < 0 || y >= size.Y); } catch (Exception e) { Console.Write(e.Message); } #endregion return result; } #endregion