| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A utility class for representing two-dimensional sizes. | 6 * A utility class for representing two-dimensional sizes. |
| 7 */ | 7 */ |
| 8 class Size { | 8 class Size { |
| 9 num width; | 9 num width; |
| 10 num height; | 10 num height; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 * Returns the shorter of the two dimensions in the size. | 76 * Returns the shorter of the two dimensions in the size. |
| 77 */ | 77 */ |
| 78 num getShortest() { | 78 num getShortest() { |
| 79 return min(width, height); | 79 return min(width, height); |
| 80 } | 80 } |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Returns true if the size has zero area, false if both dimensions | 83 * Returns true if the size has zero area, false if both dimensions |
| 84 * are non-zero numbers. | 84 * are non-zero numbers. |
| 85 */ | 85 */ |
| 86 bool isEmpty() { | 86 bool get isEmpty { |
| 87 return area() == 0; | 87 return area() == 0; |
| 88 } | 88 } |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Returns the perimeter of the size (width + height) * 2. | 91 * Returns the perimeter of the size (width + height) * 2. |
| 92 */ | 92 */ |
| 93 num perimeter() { | 93 num perimeter() { |
| 94 return (width + height) * 2; | 94 return (width + height) * 2; |
| 95 } | 95 } |
| 96 | 96 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 /** | 131 /** |
| 132 * Returns a nice string representing size. | 132 * Returns a nice string representing size. |
| 133 * Returns in the form (50 x 73). | 133 * Returns in the form (50 x 73). |
| 134 */ | 134 */ |
| 135 String toString() { | 135 String toString() { |
| 136 return "(${width} x ${height})"; | 136 return "(${width} x ${height})"; |
| 137 } | 137 } |
| 138 } | 138 } |
| OLD | NEW |