| OLD | NEW |
| 1 part of dart.math; | 1 part of dart.math; |
| 2 | 2 class Point<T extends num> {final T x; |
| 3 class Point<T extends num> { | 3 final T y; |
| 4 final T x; | 4 const Point(T x, T y) : this.x = x, this.y = y; |
| 5 final T y; | 5 String toString() => 'Point($x, $y)'; |
| 6 const Point(T x, T y) | 6 bool operator ==(other) { |
| 7 : this.x = x, | 7 if (other is! Point) return false; |
| 8 this.y = y; | 8 return x == other.x && y == other.y; |
| 9 String toString() => 'Point($x, $y)'; | |
| 10 bool operator ==(other) { | |
| 11 if (other is! Point) return false; | |
| 12 return x == other.x && y == other.y; | |
| 13 } | 9 } |
| 14 int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode); | 10 int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode); |
| 15 Point<T> operator +(Point<T> other) { | 11 Point<T> operator +(Point<T> other) { |
| 16 return new Point<T>(x + other.x, y + other.y); | 12 return new Point<T>(x + other.x, y + other.y); |
| 17 } | 13 } |
| 18 Point<T> operator -(Point<T> other) { | 14 Point<T> operator -(Point<T> other) { |
| 19 return new Point<T>(x - other.x, y - other.y); | 15 return new Point<T>(x - other.x, y - other.y); |
| 20 } | 16 } |
| 21 Point<T> operator *(num factor) { | 17 Point<T> operator *(num factor) { |
| 22 return new Point<T>(x * factor, y * factor); | 18 return new Point<T>(x * factor, y * factor); |
| 23 } | 19 } |
| 24 double get magnitude => sqrt(x * x + y * y); | 20 double get magnitude => sqrt(x * x + y * y); |
| 25 double distanceTo(Point<T> other) { | 21 double distanceTo(Point<T> other) { |
| 26 var dx = x - other.x; | 22 var dx = x - other.x; |
| 27 var dy = y - other.y; | 23 var dy = y - other.y; |
| 28 return sqrt(dx * dx + dy * dy); | 24 return sqrt(dx * dx + dy * dy); |
| 29 } | 25 } |
| 30 T squaredDistanceTo(Point<T> other) { | 26 T squaredDistanceTo(Point<T> other) { |
| 31 var dx = x - other.x; | 27 var dx = x - other.x; |
| 32 var dy = y - other.y; | 28 var dy = y - other.y; |
| 33 return ((__x0) => DDC$RT.cast(__x0, num, T, "CastGeneral", | 29 return ((__x0) => DDC$RT.cast(__x0, num, T, "CastGeneral", """line 86, column
12 of dart:math/point.dart: """, __x0 is T, false))(dx * dx + dy * dy); |
| 34 """line 86, column 12 of dart:math/point.dart: """, __x0 is T, | |
| 35 false))(dx * dx + dy * dy); | |
| 36 } | 30 } |
| 37 } | 31 } |
| OLD | NEW |