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

Unified Diff: sky/engine/core/painting/Size.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
« sky/engine/core/painting/Rect.dart ('K') | « sky/engine/core/painting/Rect.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Size.dart
diff --git a/sky/engine/core/painting/Size.dart b/sky/engine/core/painting/Size.dart
index cf41608b8a9936efb4b5dee1837fd8d2d0d40457..5697086c319c9361d59a5c736e3956d5e571b96e 100644
--- a/sky/engine/core/painting/Size.dart
+++ b/sky/engine/core/painting/Size.dart
@@ -4,9 +4,22 @@
part of dart.sky;
+/// Holds a 2D floating-point size.
class Size {
double width;
double height;
- Point(this.width, this.height);
+ Size(this.width, this.height);
+
+ bool operator ==(other) {
+ if (!(other is Size)) return false;
+ return width == other.width && height == other.height;
+ }
+ int get hashCode {
+ int result = 373;
+ result = 37 * result + width.hashCode;
+ result = 37 * result + height.hashCode;
+ return result;
+ }
+ String toString() => "Size($width, $height)";
}
« sky/engine/core/painting/Rect.dart ('K') | « sky/engine/core/painting/Rect.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698