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

Side by Side Diff: lib/src/utils.dart

Issue 1581853003: Get rid of all the library tags. (Closed) Base URL: git@github.com:dart-lang/pub_semver@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « lib/src/patterns.dart ('k') | lib/src/version.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library pub_semver.src.utils;
6
7 import 'version_range.dart'; 5 import 'version_range.dart';
8 6
9 /// Returns whether [range1] is immediately next to, but not overlapping, 7 /// Returns whether [range1] is immediately next to, but not overlapping,
10 /// [range2]. 8 /// [range2].
11 bool areAdjacent(VersionRange range1, VersionRange range2) { 9 bool areAdjacent(VersionRange range1, VersionRange range2) {
12 if (range1.max != range2.min) return false; 10 if (range1.max != range2.min) return false;
13 11
14 return (range1.includeMax && !range2.includeMin) || 12 return (range1.includeMax && !range2.includeMin) ||
15 (!range1.includeMax && range2.includeMin); 13 (!range1.includeMax && range2.includeMin);
16 } 14 }
17 15
18 /// A [Comparator] that compares the maximum versions of [range1] and [range2]. 16 /// A [Comparator] that compares the maximum versions of [range1] and [range2].
19 int compareMax(VersionRange range1, VersionRange range2) { 17 int compareMax(VersionRange range1, VersionRange range2) {
20 if (range1.max < range2.max) return -1; 18 if (range1.max < range2.max) return -1;
21 if (range1.max > range2.max) return 1; 19 if (range1.max > range2.max) return 1;
22 20
23 if (!range1.includeMax && range2.includeMax) return -1; 21 if (!range1.includeMax && range2.includeMax) return -1;
24 if (range1.includeMax && !range2.includeMax) return 1; 22 if (range1.includeMax && !range2.includeMax) return 1;
25 return 0; 23 return 0;
26 } 24 }
OLDNEW
« no previous file with comments | « lib/src/patterns.dart ('k') | lib/src/version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698