static void Main(string[] args) { Point2D p = new Point2D(); p.X = 100; p.Y = 100; Point2D o = new Point2D(); o.X = 100; o.Y = 100; int result = p.CompareTo(o); Console.WriteLine(result); // Point2DClass q = new Point2DClass(); q.X = 100; q.Y = 100; Point2DClass w = new Point2DClass(); w.X = 100; w.Y = 100; result = q.CompareTo(w); Console.WriteLine(result); }
public bool Contains(Point2D point) { var current = this.root; var depth = 0; while (current != null) { if (point.CompareTo(current.Point) == 0) { return(true); } int compare = this.CompareByDimension(current, point, depth); if (compare < 0) { current = current.Left; } else if (compare > 0) { current = current.Right; } depth++; } return(false); }
public MapTile GetMapTile(Point2D p) { if (p.CompareTo(this) == false) { return(null); } return(GetMapTile(p.X, p.Y)); }
public void CompareToTest() { Point2D target = new Point2D(); // TODO: 初始化为适当的值 object other = null; // TODO: 初始化为适当的值 int expected = 0; // TODO: 初始化为适当的值 int actual; actual = target.CompareTo(other); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public MapTile GetMapTile( Point2D p ) { if( p.CompareTo( this ) == false ) return null; return GetMapTile( p.X, p.Y ); }