| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'version_range.dart'; | 5 import 'version_range.dart'; | 
| 6 | 6 | 
| 7 /// Returns whether [range1] is immediately next to, but not overlapping, | 7 /// Returns whether [range1] is immediately next to, but not overlapping, | 
| 8 /// [range2]. | 8 /// [range2]. | 
| 9 bool areAdjacent(VersionRange range1, VersionRange range2) { | 9 bool areAdjacent(VersionRange range1, VersionRange range2) { | 
| 10   if (range1.max != range2.min) return false; | 10   if (range1.max != range2.min) return false; | 
| 11 | 11 | 
| 12   return (range1.includeMax && !range2.includeMin) || | 12   return (range1.includeMax && !range2.includeMin) || | 
| 13       (!range1.includeMax && range2.includeMin); | 13       (!range1.includeMax && range2.includeMin); | 
| 14 } | 14 } | 
| 15 | 15 | 
| 16 /// A [Comparator] that compares the maximum versions of [range1] and [range2]. | 16 /// A [Comparator] that compares the maximum versions of [range1] and [range2]. | 
| 17 int compareMax(VersionRange range1, VersionRange range2) { | 17 int compareMax(VersionRange range1, VersionRange range2) { | 
| 18   if (range1.max < range2.max) return -1; | 18   if (range1.max == null) { | 
| 19   if (range1.max > range2.max) return 1; | 19     if (range2.max == null) return 0; | 
|  | 20     return 1; | 
|  | 21   } else if (range2.max == null) { | 
|  | 22     return -1; | 
|  | 23   } | 
| 20 | 24 | 
| 21   if (!range1.includeMax && range2.includeMax) return -1; | 25   var result = range1.max.compareTo(range2.max); | 
| 22   if (range1.includeMax && !range2.includeMax) return 1; | 26   if (result != 0) return result; | 
|  | 27   if (range1.includeMax != range2.includeMax) return range1.includeMax ? 1 : -1; | 
| 23   return 0; | 28   return 0; | 
| 24 } | 29 } | 
| OLD | NEW | 
|---|