| 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.utilities.collection; | 8 library engine.utilities.collection; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 329 } |
| 330 | 330 |
| 331 /** | 331 /** |
| 332 * Instances of the class `SccFinder` implement Tarjan's Algorithm for finding t
he strongly | 332 * Instances of the class `SccFinder` implement Tarjan's Algorithm for finding t
he strongly |
| 333 * connected components in a graph. | 333 * connected components in a graph. |
| 334 */ | 334 */ |
| 335 class DirectedGraph_SccFinder<N> { | 335 class DirectedGraph_SccFinder<N> { |
| 336 /** | 336 /** |
| 337 * The graph to work with. | 337 * The graph to work with. |
| 338 */ | 338 */ |
| 339 final DirectedGraph<N> _graph; | 339 DirectedGraph<N> _graph; |
| 340 | 340 |
| 341 /** | 341 /** |
| 342 * The index used to uniquely identify the depth of nodes. | 342 * The index used to uniquely identify the depth of nodes. |
| 343 */ | 343 */ |
| 344 int _index = 0; | 344 int _index = 0; |
| 345 | 345 |
| 346 /** | 346 /** |
| 347 * The stack of nodes that are being visited in order to identify components. | 347 * The stack of nodes that are being visited in order to identify components. |
| 348 */ | 348 */ |
| 349 List<N> _stack = new List<N>(); | 349 List<N> _stack = new List<N>(); |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * A table mapping nodes to information about the nodes that is used by this a
lgorithm. | 352 * A table mapping nodes to information about the nodes that is used by this a
lgorithm. |
| 353 */ | 353 */ |
| 354 Map<N, DirectedGraph_NodeInfo<N>> _nodeMap = new Map<N, DirectedGraph_NodeInfo
<N>>(); | 354 Map<N, DirectedGraph_NodeInfo<N>> _nodeMap = new Map<N, DirectedGraph_NodeInfo
<N>>(); |
| 355 | 355 |
| 356 /** | 356 /** |
| 357 * Initialize a newly created finder. | 357 * Initialize a newly created finder. |
| 358 */ | 358 */ |
| 359 DirectedGraph_SccFinder(this._graph) : super(); | 359 DirectedGraph_SccFinder(DirectedGraph<N> graph) : super() { |
| 360 this._graph = graph; |
| 361 } |
| 360 | 362 |
| 361 /** | 363 /** |
| 362 * Return a list containing the nodes that are part of the strongly connected
component that | 364 * Return a list containing the nodes that are part of the strongly connected
component that |
| 363 * contains the given node. | 365 * contains the given node. |
| 364 * | 366 * |
| 365 * @param node the node used to identify the strongly connected component to b
e returned | 367 * @param node the node used to identify the strongly connected component to b
e returned |
| 366 * @return the nodes that are part of the strongly connected component that co
ntains the given | 368 * @return the nodes that are part of the strongly connected component that co
ntains the given |
| 367 * node | 369 * node |
| 368 */ | 370 */ |
| 369 List<N> componentContaining(N node) => _strongConnect(node).component; | 371 List<N> componentContaining(N node) => _strongConnect(node).component; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 * @param list the list to which the elements are to be added | 449 * @param list the list to which the elements are to be added |
| 448 * @param elements the elements to be added to the list | 450 * @param elements the elements to be added to the list |
| 449 */ | 451 */ |
| 450 static void addAll(List list, List<Object> elements) { | 452 static void addAll(List list, List<Object> elements) { |
| 451 int count = elements.length; | 453 int count = elements.length; |
| 452 for (int i = 0; i < count; i++) { | 454 for (int i = 0; i < count; i++) { |
| 453 list.add(elements[i]); | 455 list.add(elements[i]); |
| 454 } | 456 } |
| 455 } | 457 } |
| 456 } | 458 } |
| OLD | NEW |