OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 schedule; | 5 library schedule; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 /// Returns a detailed representation of the queue as a tree of tasks. If | 464 /// Returns a detailed representation of the queue as a tree of tasks. If |
465 /// [highlight] is passed, that task is specially highlighted. | 465 /// [highlight] is passed, that task is specially highlighted. |
466 /// | 466 /// |
467 /// [highlight] must be a task in this queue. | 467 /// [highlight] must be a task in this queue. |
468 String generateTree([Task highlight]) { | 468 String generateTree([Task highlight]) { |
469 assert(highlight == null || highlight.queue == this); | 469 assert(highlight == null || highlight.queue == this); |
470 return _contents.map((task) { | 470 return _contents.map((task) { |
471 var lines = task.toString().split("\n"); | 471 var lines = task.toString().split("\n"); |
472 var firstLine = task == highlight ? | 472 var firstLine = task == highlight ? |
473 "> ${lines.first}" : "* ${lines.first}"; | 473 "> ${lines.first}" : "* ${lines.first}"; |
474 lines = [firstLine]..addAll(lines.skip(1).map((line) => "| $line")); | 474 lines = new List.from(lines.skip(1).map((line) => "| $line")); |
| 475 lines.insertRange(0, 1, firstLine); |
475 return lines.join("\n"); | 476 return lines.join("\n"); |
476 }).join("\n"); | 477 }).join("\n"); |
477 } | 478 } |
478 } | 479 } |
OLD | NEW |