| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.source; | 4 library engine.source; |
| 5 | 5 |
| 6 import 'dart:uri'; | 6 import 'dart:uri'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'engine.dart' show AnalysisContext; |
| 8 | 9 |
| 9 /** | 10 /** |
| 10 * Instances of the class {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. | 11 * Instances of the class {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. |
| 11 * @coverage dart.engine.source | 12 * @coverage dart.engine.source |
| 12 */ | 13 */ |
| 13 class SourceFactory { | 14 class SourceFactory { |
| 14 /** | 15 /** |
| 16 * The analysis context that this source factory is associated with. |
| 17 */ |
| 18 AnalysisContext _context; |
| 19 /** |
| 15 * The resolvers used to resolve absolute URI's. | 20 * The resolvers used to resolve absolute URI's. |
| 16 */ | 21 */ |
| 17 List<UriResolver> _resolvers; | 22 List<UriResolver> _resolvers; |
| 18 /** | 23 /** |
| 19 * A cache of content used to override the default content of a source. | 24 * A cache of content used to override the default content of a source. |
| 20 */ | 25 */ |
| 21 ContentCache _contentCache; | 26 ContentCache _contentCache; |
| 22 /** | 27 /** |
| 23 * Initialize a newly created source factory. | 28 * Initialize a newly created source factory. |
| 24 * @param contentCache the cache holding content used to override the default
content of a source. | 29 * @param contentCache the cache holding content used to override the default
content of a source. |
| 25 * @param resolvers the resolvers used to resolve absolute URI's | 30 * @param resolvers the resolvers used to resolve absolute URI's |
| 26 */ | 31 */ |
| 27 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { | 32 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { |
| 28 _jtd_constructor_300_impl(contentCache2, resolvers2); | 33 _jtd_constructor_302_impl(contentCache2, resolvers2); |
| 29 } | 34 } |
| 30 _jtd_constructor_300_impl(ContentCache contentCache2, List<UriResolver> resolv
ers2) { | 35 _jtd_constructor_302_impl(ContentCache contentCache2, List<UriResolver> resolv
ers2) { |
| 31 this._contentCache = contentCache2; | 36 this._contentCache = contentCache2; |
| 32 this._resolvers = resolvers2; | 37 this._resolvers = resolvers2; |
| 33 } | 38 } |
| 34 /** | 39 /** |
| 35 * Initialize a newly created source factory. | 40 * Initialize a newly created source factory. |
| 36 * @param resolvers the resolvers used to resolve absolute URI's | 41 * @param resolvers the resolvers used to resolve absolute URI's |
| 37 */ | 42 */ |
| 38 SourceFactory.con2(List<UriResolver> resolvers) { | 43 SourceFactory.con2(List<UriResolver> resolvers) { |
| 39 _jtd_constructor_301_impl(resolvers); | 44 _jtd_constructor_303_impl(resolvers); |
| 40 } | 45 } |
| 41 _jtd_constructor_301_impl(List<UriResolver> resolvers) { | 46 _jtd_constructor_303_impl(List<UriResolver> resolvers) { |
| 42 _jtd_constructor_300_impl(new ContentCache(), resolvers); | 47 _jtd_constructor_302_impl(new ContentCache(), resolvers); |
| 43 } | 48 } |
| 44 /** | 49 /** |
| 45 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a | 50 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a |
| 46 * valid URI or if it is not an absolute URI. | 51 * valid URI or if it is not an absolute URI. |
| 47 * @param absoluteUri the absolute URI to be resolved | 52 * @param absoluteUri the absolute URI to be resolved |
| 48 * @return a source object representing the absolute URI | 53 * @return a source object representing the absolute URI |
| 49 */ | 54 */ |
| 50 Source forUri(String absoluteUri) { | 55 Source forUri(String absoluteUri) { |
| 51 try { | 56 try { |
| 52 Uri uri = new Uri(absoluteUri); | 57 Uri uri = new Uri(absoluteUri); |
| 53 if (uri.isAbsolute) { | 58 if (uri.isAbsolute) { |
| 54 return resolveUri2(null, uri); | 59 return resolveUri2(null, uri); |
| 55 } | 60 } |
| 56 } on URISyntaxException catch (exception) { | 61 } on URISyntaxException catch (exception) { |
| 57 } | 62 } |
| 58 return null; | 63 return null; |
| 59 } | 64 } |
| 60 /** | 65 /** |
| 61 * Return a source object that is equal to the source object used to obtain th
e given encoding, or{@code null} if the argument is not a valid encoding. | 66 * Return a source object that is equal to the source object used to obtain th
e given encoding, or{@code null} if the argument is not a valid encoding. |
| 62 * @param encoding the encoding of a source object | 67 * @param encoding the encoding of a source object |
| 63 * @return a source object that is described by the given encoding | 68 * @return a source object that is described by the given encoding |
| 64 * @see Source#getEncoding() | 69 * @see Source#getEncoding() |
| 65 */ | 70 */ |
| 66 Source fromEncoding(String encoding) => forUri(encoding); | 71 Source fromEncoding(String encoding) => forUri(encoding); |
| 67 /** | 72 /** |
| 73 * Return the analysis context that this source factory is associated with. |
| 74 * @return the analysis context that this source factory is associated with |
| 75 */ |
| 76 AnalysisContext get context => _context; |
| 77 /** |
| 68 * Return a source object representing the URI that results from resolving the
given (possibly | 78 * Return a source object representing the URI that results from resolving the
given (possibly |
| 69 * relative) contained URI against the URI associated with an existing source
object, or{@code null} if either the contained URI is invalid or if it cannot be
resolved against the | 79 * relative) contained URI against the URI associated with an existing source
object, or{@code null} if either the contained URI is invalid or if it cannot be
resolved against the |
| 70 * source object's URI. | 80 * source object's URI. |
| 71 * @param containingSource the source containing the given URI | 81 * @param containingSource the source containing the given URI |
| 72 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 82 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 73 * @return the source representing the contained URI | 83 * @return the source representing the contained URI |
| 74 */ | 84 */ |
| 75 Source resolveUri(Source containingSource, String containedUri) { | 85 Source resolveUri(Source containingSource, String containedUri) { |
| 76 try { | 86 try { |
| 77 return resolveUri2(containingSource, new Uri.fromComponents(path: containe
dUri)); | 87 return resolveUri2(containingSource, new Uri(containedUri)); |
| 78 } on URISyntaxException catch (exception) { | 88 } on URISyntaxException catch (exception) { |
| 79 return null; | 89 return null; |
| 80 } | 90 } |
| 81 } | 91 } |
| 82 /** | 92 /** |
| 83 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 93 * Set the contents of the given source to the given contents. This has the ef
fect of overriding |
| 84 * the default contents of the source. If the contents are {@code null} the ov
erride is removed so | 94 * the default contents of the source. If the contents are {@code null} the ov
erride is removed so |
| 85 * that the default contents will be returned. | 95 * that the default contents will be returned. |
| 86 * @param source the source whose contents are being overridden | 96 * @param source the source whose contents are being overridden |
| 87 * @param contents the new contents of the source | 97 * @param contents the new contents of the source |
| 88 */ | 98 */ |
| 89 void setContents(Source source, String contents) { | 99 void setContents(Source source, String contents) { |
| 90 _contentCache.setContents(source, contents); | 100 _contentCache.setContents(source, contents); |
| 91 } | 101 } |
| 92 /** | 102 /** |
| 103 * Set the analysis context that this source factory is associated with to the
given context. |
| 104 * <p> |
| 105 * <b>Note:</b> This method should only be invoked by{@link AnalysisContextImp
l#setSourceFactory(SourceFactory)} and is only public out of |
| 106 * necessity. |
| 107 * @param context the analysis context that this source factory is associated
with |
| 108 */ |
| 109 void set context(AnalysisContext context2) { |
| 110 this._context = context2; |
| 111 } |
| 112 /** |
| 93 * Return the contents of the given source, or {@code null} if this factory do
es not override the | 113 * Return the contents of the given source, or {@code null} if this factory do
es not override the |
| 94 * contents of the source. | 114 * contents of the source. |
| 95 * <p> | 115 * <p> |
| 96 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. | 116 * <b>Note:</b> This method is not intended to be used except by{@link FileBas
edSource#getContents(com.google.dart.engine.source.Source.ContentReceiver)}. |
| 97 * @param source the source whose content is to be returned | 117 * @param source the source whose content is to be returned |
| 98 * @return the contents of the given source | 118 * @return the contents of the given source |
| 99 */ | 119 */ |
| 100 String getContents(Source source) => _contentCache.getContents(source); | 120 String getContents(Source source) => _contentCache.getContents(source); |
| 101 /** | 121 /** |
| 102 * Return the modification stamp of the given source, or {@code null} if this
factory does not | 122 * Return the modification stamp of the given source, or {@code null} if this
factory does not |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 * this source | 187 * this source |
| 168 * @see Object#equals(Object) | 188 * @see Object#equals(Object) |
| 169 */ | 189 */ |
| 170 bool operator ==(Object object); | 190 bool operator ==(Object object); |
| 171 /** | 191 /** |
| 172 * Return {@code true} if this source exists. | 192 * Return {@code true} if this source exists. |
| 173 * @return {@code true} if this source exists | 193 * @return {@code true} if this source exists |
| 174 */ | 194 */ |
| 175 bool exists(); | 195 bool exists(); |
| 176 /** | 196 /** |
| 197 * Return the analysis context in which this source is defined. |
| 198 * @return the analysis context in which this source is defined |
| 199 */ |
| 200 AnalysisContext get context; |
| 201 /** |
| 177 * Get the contents of this source and pass it to the given receiver. Exactly
one of the methods | 202 * Get the contents of this source and pass it to the given receiver. Exactly
one of the methods |
| 178 * defined on the receiver will be invoked unless an exception is thrown. The
method that will be | 203 * defined on the receiver will be invoked unless an exception is thrown. The
method that will be |
| 179 * invoked depends on which of the possible representations of the contents is
the most efficient. | 204 * invoked depends on which of the possible representations of the contents is
the most efficient. |
| 180 * Whichever method is invoked, it will be invoked before this method returns. | 205 * Whichever method is invoked, it will be invoked before this method returns. |
| 181 * @param receiver the content receiver to which the content of this source wi
ll be passed | 206 * @param receiver the content receiver to which the content of this source wi
ll be passed |
| 182 * @throws Exception if the contents of this source could not be accessed | 207 * @throws Exception if the contents of this source could not be accessed |
| 183 */ | 208 */ |
| 184 void getContents(Source_ContentReceiver receiver); | 209 void getContents(Source_ContentReceiver receiver); |
| 185 /** | 210 /** |
| 186 * Return an encoded representation of this source that can be used to create
a source that is | 211 * Return an encoded representation of this source that can be used to create
a source that is |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 void setContents(Source source, String contents) { | 564 void setContents(Source source, String contents) { |
| 540 if (contents == null) { | 565 if (contents == null) { |
| 541 _contentMap.remove(source); | 566 _contentMap.remove(source); |
| 542 _stampMap.remove(source); | 567 _stampMap.remove(source); |
| 543 } else { | 568 } else { |
| 544 _contentMap[source] = contents; | 569 _contentMap[source] = contents; |
| 545 _stampMap[source] = JavaSystem.currentTimeMillis(); | 570 _stampMap[source] = JavaSystem.currentTimeMillis(); |
| 546 } | 571 } |
| 547 } | 572 } |
| 548 } | 573 } |
| OLD | NEW |