Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.sky; | 5 part of dart.sky; |
| 6 | 6 |
| 7 class Point { | 7 class Point { |
|
sethladd
2015/05/27 22:19:49
If yall are adding comments, here's a good place t
Matt Perry
2015/05/28 17:05:54
Done.
| |
| 8 double x; | 8 double x; |
| 9 double y; | 9 double y; |
| 10 | 10 |
| 11 Point(this.x, this.y); | 11 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
| |
| 12 | |
| 13 bool operator ==(other) { | |
| 14 if (!(other is Point)) return false; | |
| 15 return x == other.x && y == other.y; | |
| 16 } | |
| 17 int get hashCode { | |
| 18 int result = 373; | |
| 19 result = 37 * result + x.hashCode; | |
| 20 result = 37 * result + y.hashCode; | |
| 21 return result; | |
| 22 } | |
| 23 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.
| |
| 24 return "Point($x, $y)"; | |
| 25 } | |
| 12 } | 26 } |
| 13 | |
| OLD | NEW |