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

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: 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 9fc7082e707bb0c3dc50d944b3848430d42b1c39..60c9c5af66ae22b9df89dc37f6ba32fbf30c94a2 100644
--- a/sky/engine/core/painting/Point.dart
+++ b/sky/engine/core/painting/Point.dart
@@ -9,5 +9,18 @@ class Point {
double y;
Point(this.x, this.y);
sethladd 2015/05/27 22:19:49 did you want to throw if x or y are null?
Matt Perry 2015/05/28 17:05:54 Good question... not sure what behavior I want her
-}
+ 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() {
sethladd 2015/05/27 22:19:49 not sure about your project's style, but this coul
Matt Perry 2015/05/28 17:05:54 Done.
+ return "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