| OLD | NEW |
| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source; | 8 library engine.source; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| 11 import 'dart:collection'; | 11 import 'dart:collection'; |
| 12 | 12 |
| 13 import 'engine.dart'; | 13 import 'engine.dart'; |
| 14 import 'java_core.dart'; | 14 import 'java_core.dart'; |
| 15 import 'java_engine.dart'; | 15 import 'java_engine.dart'; |
| 16 import 'sdk.dart' show DartSdk; | 16 import 'sdk.dart' show DartSdk; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * A function that is used to handle [ContentCache] entries. |
| 20 */ |
| 21 typedef void ContentCacheVisitor(Source source, int stamp, String contents); |
| 22 |
| 23 /** |
| 19 * Instances of class `ContentCache` hold content used to override the default c
ontent of a | 24 * Instances of class `ContentCache` hold content used to override the default c
ontent of a |
| 20 * [Source]. | 25 * [Source]. |
| 21 */ | 26 */ |
| 22 class ContentCache { | 27 class ContentCache { |
| 23 /** | 28 /** |
| 24 * A table mapping sources to the contents of those sources. This is used to o
verride the default | 29 * A table mapping sources to the contents of those sources. This is used to o
verride the default |
| 25 * contents of a source. | 30 * contents of a source. |
| 26 */ | 31 */ |
| 27 HashMap<Source, String> _contentMap = new HashMap<Source, String>(); | 32 HashMap<Source, String> _contentMap = new HashMap<Source, String>(); |
| 28 | 33 |
| 29 /** | 34 /** |
| 30 * A table mapping sources to the modification stamps of those sources. This i
s used when the | 35 * A table mapping sources to the modification stamps of those sources. This i
s used when the |
| 31 * default contents of a source has been overridden. | 36 * default contents of a source has been overridden. |
| 32 */ | 37 */ |
| 33 HashMap<Source, int> _stampMap = new HashMap<Source, int>(); | 38 HashMap<Source, int> _stampMap = new HashMap<Source, int>(); |
| 34 | 39 |
| 35 /** | 40 /** |
| 41 * Visit all entries of this cache. |
| 42 */ |
| 43 void accept(ContentCacheVisitor visitor) { |
| 44 _contentMap.forEach((Source source, String contents) { |
| 45 int stamp = _stampMap[source]; |
| 46 visitor(source, stamp, contents); |
| 47 }); |
| 48 } |
| 49 |
| 50 /** |
| 36 * Return the contents of the given source, or `null` if this cache does not o
verride the | 51 * Return the contents of the given source, or `null` if this cache does not o
verride the |
| 37 * contents of the source. | 52 * contents of the source. |
| 38 * | 53 * |
| 39 * <b>Note:</b> This method is not intended to be used except by | 54 * <b>Note:</b> This method is not intended to be used except by |
| 40 * [AnalysisContext.getContents]. | 55 * [AnalysisContext.getContents]. |
| 41 * | 56 * |
| 42 * @param source the source whose content is to be returned | 57 * @param source the source whose content is to be returned |
| 43 * @return the contents of the given source | 58 * @return the contents of the given source |
| 44 */ | 59 */ |
| 45 String getContents(Source source) => _contentMap[source]; | 60 String getContents(Source source) => _contentMap[source]; |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 969 |
| 955 /** | 970 /** |
| 956 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 971 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
| 957 * be computed. | 972 * be computed. |
| 958 * | 973 * |
| 959 * @param source the source to get URI for | 974 * @param source the source to get URI for |
| 960 * @return the absolute URI representing the given source | 975 * @return the absolute URI representing the given source |
| 961 */ | 976 */ |
| 962 Uri restoreAbsolute(Source source) => null; | 977 Uri restoreAbsolute(Source source) => null; |
| 963 } | 978 } |
| OLD | NEW |