Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: sky/engine/core/painting/Point.dart

Issue 1154213005: Add operator==, hashCode, and toString for Rect and Point dart classes. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: nits Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/engine/core/painting/Rect.dart » ('j') | sky/engine/core/painting/Rect.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Point.dart
diff --git a/sky/engine/core/painting/Point.dart b/sky/engine/core/painting/Point.dart
index 856f3360fdfc0c2addab930972c4bea341c6920b..82d2875e3b82c72a145429c439229f2d92c3839d 100644
--- a/sky/engine/core/painting/Point.dart
+++ b/sky/engine/core/painting/Point.dart
@@ -4,9 +4,22 @@
part of dart.sky;
+/// Holds 2 floating-point coordinates.
class Point {
double x;
double y;
Point(this.x, this.y);
+
+ bool operator ==(other) {
+ if (!(other is Point)) return false;
+ return x == other.x && y == other.y;
+ }
+ int get hashCode {
+ int result = 373;
+ result = 37 * result + x.hashCode;
+ result = 37 * result + y.hashCode;
+ return result;
+ }
+ String toString() => "Point($x, $y)";
}
« no previous file with comments | « no previous file | sky/engine/core/painting/Rect.dart » ('j') | sky/engine/core/painting/Rect.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698