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

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

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 2 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 | « packages/glob/lib/src/stream_pool.dart ('k') | packages/glob/pubspec.yaml » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 'package:path/path.dart' as p; 5 import 'package:path/path.dart' as p;
6 6
7 /// A range from [min] to [max], inclusive. 7 /// A range from [min] to [max], inclusive.
8 class Range { 8 class Range {
9 /// The minimum value included by the range. 9 /// The minimum value included by the range.
10 final int min; 10 final int min;
11 11
12 /// The maximum value included by the range. 12 /// The maximum value included by the range.
13 final int max; 13 final int max;
14 14
15 /// Whether this range covers only a single number. 15 /// Whether this range covers only a single number.
16 bool get isSingleton => min == max; 16 bool get isSingleton => min == max;
17 17
18 Range(this.min, this.max); 18 Range(this.min, this.max);
19 19
20 /// Returns a range that covers only [value]. 20 /// Returns a range that covers only [value].
21 Range.singleton(int value) 21 Range.singleton(int value) : this(value, value);
22 : this(value, value);
23 22
24 /// Whether [this] contains [value]. 23 /// Whether [this] contains [value].
25 bool contains(int value) => value >= min && value <= max; 24 bool contains(int value) => value >= min && value <= max;
26 25
27 bool operator==(Object other) => other is Range && 26 bool operator ==(Object other) =>
28 other.min == min && other.max == max; 27 other is Range && other.min == min && other.max == max;
29 28
30 int get hashCode => 3 * min + 7 * max; 29 int get hashCode => 3 * min + 7 * max;
31 } 30 }
32 31
33 /// An implementation of [Match] constructed by [Glob]s. 32 /// An implementation of [Match] constructed by [Glob]s.
34 class GlobMatch implements Match { 33 class GlobMatch implements Match {
35 final String input; 34 final String input;
36 final Pattern pattern; 35 final Pattern pattern;
37 final int start = 0; 36 final int start = 0;
38 37
(...skipping 28 matching lines...) Expand all
67 return path.replaceAll('\\', '/'); 66 return path.replaceAll('\\', '/');
68 } 67 }
69 68
70 /// Returns [path] which follows [context] converted to the POSIX format that 69 /// Returns [path] which follows [context] converted to the POSIX format that
71 /// globs match against. 70 /// globs match against.
72 String toPosixPath(p.Context context, String path) { 71 String toPosixPath(p.Context context, String path) {
73 if (context.style == p.Style.windows) return path.replaceAll('\\', '/'); 72 if (context.style == p.Style.windows) return path.replaceAll('\\', '/');
74 if (context.style == p.Style.url) return Uri.decodeFull(path); 73 if (context.style == p.Style.url) return Uri.decodeFull(path);
75 return path; 74 return path;
76 } 75 }
OLDNEW
« no previous file with comments | « packages/glob/lib/src/stream_pool.dart ('k') | packages/glob/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698