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 abstract class OffsetBase { | 7 abstract class OffsetBase { |
8 const OffsetBase(this._dx, this._dy); | 8 const OffsetBase(this._dx, this._dy); |
9 | 9 |
10 final double _dx; | 10 final double _dx; |
11 final double _dy; | 11 final double _dy; |
12 | 12 |
13 bool get isInfinite => _dx >= double.INFINITY || _dy >= double.INFINITY; | 13 bool get isInfinite => _dx >= double.INFINITY || _dy >= double.INFINITY; |
14 | 14 |
| 15 bool operator <(OffsetBase other) => _dx < other._dx && _dy < other._dy; |
| 16 bool operator <=(OffsetBase other) => _dx <= other._dx && _dy <= other._dy; |
| 17 bool operator >(OffsetBase other) => _dx > other._dx && _dy > other._dy; |
| 18 bool operator >=(OffsetBase other) => _dx > other._dx && _dy >= other._dy; |
| 19 |
15 bool operator ==(other) { | 20 bool operator ==(other) { |
16 return other is OffsetBase && | 21 return other is OffsetBase && |
17 other.runtimeType == runtimeType && | 22 other.runtimeType == runtimeType && |
18 other._dx == _dx && | 23 other._dx == _dx && |
19 other._dy == _dy; | 24 other._dy == _dy; |
20 } | 25 } |
21 | 26 |
22 int get hashCode { | 27 int get hashCode { |
23 int result = 373; | 28 int result = 373; |
24 result = 37 * result + _dx.hashCode; | 29 result = 37 * result + _dx.hashCode; |
25 result = 37 * result + _dy.hashCode; | 30 result = 37 * result + _dy.hashCode; |
26 return result; | 31 return result; |
27 } | 32 } |
28 } | 33 } |
OLD | NEW |