| 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 library analyzer.task.model; | 5 library analyzer.task.model; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:developer'; | 8 import 'dart:developer'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 10 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 * | 330 * |
| 331 * Clients may not extend, implement or mix-in this class. | 331 * Clients may not extend, implement or mix-in this class. |
| 332 */ | 332 */ |
| 333 abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> { | 333 abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> { |
| 334 /** | 334 /** |
| 335 * Initialize a newly created analysis result to have the given [name] and | 335 * Initialize a newly created analysis result to have the given [name] and |
| 336 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long | 336 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long |
| 337 * values associated with this result will remain in the cache. | 337 * values associated with this result will remain in the cache. |
| 338 */ | 338 */ |
| 339 factory ListResultDescriptor(String name, List<E> defaultValue, | 339 factory ListResultDescriptor(String name, List<E> defaultValue, |
| 340 {ResultCachingPolicy<List<E>> cachingPolicy}) = ListResultDescriptorImpl< | 340 {ResultCachingPolicy<List<E>> cachingPolicy}) = |
| 341 E>; | 341 ListResultDescriptorImpl<E>; |
| 342 | 342 |
| 343 @override | 343 @override |
| 344 ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false}); | 344 ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false}); |
| 345 } | 345 } |
| 346 | 346 |
| 347 /** | 347 /** |
| 348 * A description of an input to an [AnalysisTask] that can be used to compute | 348 * A description of an input to an [AnalysisTask] that can be used to compute |
| 349 * that input. | 349 * that input. |
| 350 * | 350 * |
| 351 * Clients may not extend, implement or mix-in this class. | 351 * Clients may not extend, implement or mix-in this class. |
| 352 */ | 352 */ |
| 353 abstract class ListTaskInput<E> implements TaskInput<List<E>> { | 353 abstract class ListTaskInput<E> implements TaskInput<List<E>> { |
| 354 /** | 354 /** |
| 355 * Return a task input that can be used to compute a flatten list whose | 355 * Return a task input that can be used to compute a flatten list whose |
| 356 * elements are combined [subListResult]'s associated with those elements. | 356 * elements are combined [subListResult]'s associated with those elements. |
| 357 */ | 357 */ |
| 358 ListTaskInput /*<V>*/ toFlattenListOf( | 358 ListTaskInput /*<V>*/ toFlattenListOf /*<V>*/ ( |
| 359 ListResultDescriptor /*<V>*/ subListResult); | 359 ListResultDescriptor /*<V>*/ subListResult); |
| 360 | 360 |
| 361 /** | 361 /** |
| 362 * Return a task input that can be used to compute a list whose elements are | 362 * Return a task input that can be used to compute a list whose elements are |
| 363 * the result of passing the elements of this input to the [mapper] function. | 363 * the result of passing the elements of this input to the [mapper] function. |
| 364 */ | 364 */ |
| 365 ListTaskInput /*<V>*/ toList(UnaryFunction<E, dynamic /*<V>*/ > mapper); | 365 ListTaskInput /*<V>*/ toList /*<V>*/ ( |
| 366 UnaryFunction<E, dynamic /*<=V>*/ > mapper); |
| 366 | 367 |
| 367 /** | 368 /** |
| 368 * Return a task input that can be used to compute a list whose elements are | 369 * Return a task input that can be used to compute a list whose elements are |
| 369 * [valueResult]'s associated with those elements. | 370 * [valueResult]'s associated with those elements. |
| 370 */ | 371 */ |
| 371 ListTaskInput /*<V>*/ toListOf(ResultDescriptor /*<V>*/ valueResult); | 372 ListTaskInput /*<V>*/ toListOf /*<V>*/ (ResultDescriptor /*<V>*/ valueResult); |
| 372 | 373 |
| 373 /** | 374 /** |
| 374 * Return a task input that can be used to compute a map whose keys are the | 375 * Return a task input that can be used to compute a map whose keys are the |
| 375 * elements of this input and whose values are the result of passing the | 376 * elements of this input and whose values are the result of passing the |
| 376 * corresponding key to the [mapper] function. | 377 * corresponding key to the [mapper] function. |
| 377 */ | 378 */ |
| 378 MapTaskInput<E, dynamic /*V*/ > toMap( | 379 MapTaskInput<E, dynamic /*=V*/ > toMap /*<V>*/ ( |
| 379 UnaryFunction<E, dynamic /*<V>*/ > mapper); | 380 UnaryFunction<E, dynamic /*=V*/ > mapper); |
| 380 | 381 |
| 381 /** | 382 /** |
| 382 * Return a task input that can be used to compute a map whose keys are the | 383 * Return a task input that can be used to compute a map whose keys are the |
| 383 * elements of this input and whose values are the [valueResult]'s associated | 384 * elements of this input and whose values are the [valueResult]'s associated |
| 384 * with those elements. | 385 * with those elements. |
| 385 */ | 386 */ |
| 386 MapTaskInput<AnalysisTarget, dynamic /*V*/ > toMapOf( | 387 MapTaskInput<AnalysisTarget, dynamic /*=V*/ > toMapOf /*<V>*/ ( |
| 387 ResultDescriptor /*<V>*/ valueResult); | 388 ResultDescriptor /*<V>*/ valueResult); |
| 388 } | 389 } |
| 389 | 390 |
| 390 /** | 391 /** |
| 391 * A description of an input with a [Map] based values. | 392 * A description of an input with a [Map] based values. |
| 392 * | 393 * |
| 393 * Clients may not extend, implement or mix-in this class. | 394 * Clients may not extend, implement or mix-in this class. |
| 394 */ | 395 */ |
| 395 abstract class MapTaskInput<K, V> implements TaskInput<Map<K, V>> { | 396 abstract class MapTaskInput<K, V> implements TaskInput<Map<K, V>> { |
| 396 /** | 397 /** |
| 397 * [V] must be a [List]. | 398 * [V] must be a [List]. |
| 398 * Return a task input that can be used to compute a list whose elements are | 399 * Return a task input that can be used to compute a list whose elements are |
| 399 * the result of passing keys [K] and the corresponding elements of [V] to | 400 * the result of passing keys [K] and the corresponding elements of [V] to |
| 400 * the [mapper] function. | 401 * the [mapper] function. |
| 401 */ | 402 */ |
| 402 TaskInput<List /*<E>*/ > toFlattenList( | 403 TaskInput<List /*<E>*/ > toFlattenList /*<E>*/ ( |
| 403 BinaryFunction<K, dynamic /*element of V*/, dynamic /*<E>*/ > mapper); | 404 BinaryFunction<K, dynamic /*element of V*/, dynamic /*=E*/ > mapper); |
| 404 } | 405 } |
| 405 | 406 |
| 406 /** | 407 /** |
| 407 * A policy object that can compute sizes of results and provide the maximum | 408 * A policy object that can compute sizes of results and provide the maximum |
| 408 * active and idle sizes that can be kept in the cache. | 409 * active and idle sizes that can be kept in the cache. |
| 409 * | 410 * |
| 410 * All the [ResultDescriptor]s with the same [ResultCachingPolicy] instance | 411 * All the [ResultDescriptor]s with the same [ResultCachingPolicy] instance |
| 411 * share the same total size in a cache. | 412 * share the same total size in a cache. |
| 412 * | 413 * |
| 413 * Clients may implement this class when implementing plugins. | 414 * Clients may implement this class when implementing plugins. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 abstract class TaskInput<V> { | 564 abstract class TaskInput<V> { |
| 564 /** | 565 /** |
| 565 * Create and return a builder that can be used to build this task input. | 566 * Create and return a builder that can be used to build this task input. |
| 566 */ | 567 */ |
| 567 TaskInputBuilder<V> createBuilder(); | 568 TaskInputBuilder<V> createBuilder(); |
| 568 | 569 |
| 569 /** | 570 /** |
| 570 * Return a task input that can be used to compute a list whose elements are | 571 * Return a task input that can be used to compute a list whose elements are |
| 571 * the result of passing the result of this input to the [mapper] function. | 572 * the result of passing the result of this input to the [mapper] function. |
| 572 */ | 573 */ |
| 573 ListTaskInput /*<E>*/ mappedToList(List /*<E>*/ mapper(V value)); | 574 ListTaskInput /*<E>*/ mappedToList /*<E>*/ (List /*<E>*/ mapper(V value)); |
| 574 } | 575 } |
| 575 | 576 |
| 576 /** | 577 /** |
| 577 * An object used to build the value associated with a single [TaskInput]. | 578 * An object used to build the value associated with a single [TaskInput]. |
| 578 * | 579 * |
| 579 * All builders work by requesting one or more results (each result being | 580 * All builders work by requesting one or more results (each result being |
| 580 * associated with a target). The interaction pattern is modeled after the class | 581 * associated with a target). The interaction pattern is modeled after the class |
| 581 * [Iterator], in which the method [moveNext] is invoked to move from one result | 582 * [Iterator], in which the method [moveNext] is invoked to move from one result |
| 582 * request to the next. The getters [currentResult] and [currentTarget] are used | 583 * request to the next. The getters [currentResult] and [currentTarget] are used |
| 583 * to get the result and target of the current request. The value of the result | 584 * to get the result and target of the current request. The value of the result |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 /** | 736 /** |
| 736 * A work should be done, but without any special urgency. | 737 * A work should be done, but without any special urgency. |
| 737 */ | 738 */ |
| 738 NORMAL, | 739 NORMAL, |
| 739 | 740 |
| 740 /** | 741 /** |
| 741 * Nothing to do. | 742 * Nothing to do. |
| 742 */ | 743 */ |
| 743 NONE | 744 NONE |
| 744 } | 745 } |
| OLD | NEW |