| 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 'dart:collection'; |
| 10 import 'java_core.dart'; | 11 import 'java_core.dart'; |
| 11 import 'scanner.dart' show Token; | 12 import 'scanner.dart' show Token; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * The class `BooleanArray` defines methods for operating on integers as if they
were arrays | 15 * The class `BooleanArray` defines methods for operating on integers as if they
were arrays |
| 15 * of booleans. These arrays can be indexed by either integers or by enumeration
constants. | 16 * of booleans. These arrays can be indexed by either integers or by enumeration
constants. |
| 16 */ | 17 */ |
| 17 class BooleanArray { | 18 class BooleanArray { |
| 18 /** | 19 /** |
| 19 * Return the value of the element at the given index. | 20 * Return the value of the element at the given index. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 * between the same pair of nodes. | 88 * between the same pair of nodes. |
| 88 * | 89 * |
| 89 * @param N the type of the nodes in the graph | 90 * @param N the type of the nodes in the graph |
| 90 */ | 91 */ |
| 91 class DirectedGraph<N> { | 92 class DirectedGraph<N> { |
| 92 /** | 93 /** |
| 93 * The table encoding the edges in the graph. An edge is represented by an ent
ry mapping the head | 94 * The table encoding the edges in the graph. An edge is represented by an ent
ry mapping the head |
| 94 * to a set of tails. Nodes that are not the head of any edge are represented
by an entry mapping | 95 * to a set of tails. Nodes that are not the head of any edge are represented
by an entry mapping |
| 95 * the node to an empty set of tails. | 96 * the node to an empty set of tails. |
| 96 */ | 97 */ |
| 97 Map<N, Set<N>> _edges = new Map<N, Set<N>>(); | 98 HashMap<N, Set<N>> _edges = new HashMap<N, Set<N>>(); |
| 98 | 99 |
| 99 /** | 100 /** |
| 100 * Add an edge from the given head node to the given tail node. Both nodes wil
l be a part of the | 101 * Add an edge from the given head node to the given tail node. Both nodes wil
l be a part of the |
| 101 * graph after this method is invoked, whether or not they were before. | 102 * graph after this method is invoked, whether or not they were before. |
| 102 * | 103 * |
| 103 * @param head the node at the head of the edge | 104 * @param head the node at the head of the edge |
| 104 * @param tail the node at the tail of the edge | 105 * @param tail the node at the tail of the edge |
| 105 */ | 106 */ |
| 106 void addEdge(N head, N tail) { | 107 void addEdge(N head, N tail) { |
| 107 // | 108 // |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 int _index = 0; | 349 int _index = 0; |
| 349 | 350 |
| 350 /** | 351 /** |
| 351 * The stack of nodes that are being visited in order to identify components. | 352 * The stack of nodes that are being visited in order to identify components. |
| 352 */ | 353 */ |
| 353 List<N> _stack = new List<N>(); | 354 List<N> _stack = new List<N>(); |
| 354 | 355 |
| 355 /** | 356 /** |
| 356 * A table mapping nodes to information about the nodes that is used by this a
lgorithm. | 357 * A table mapping nodes to information about the nodes that is used by this a
lgorithm. |
| 357 */ | 358 */ |
| 358 Map<N, DirectedGraph_NodeInfo<N>> _nodeMap = new Map<N, DirectedGraph_NodeInfo
<N>>(); | 359 HashMap<N, DirectedGraph_NodeInfo<N>> _nodeMap = new HashMap<N, DirectedGraph_
NodeInfo<N>>(); |
| 359 | 360 |
| 360 /** | 361 /** |
| 361 * A list of all strongly connected components found, in topological sort orde
r (each node in a | 362 * A list of all strongly connected components found, in topological sort orde
r (each node in a |
| 362 * strongly connected component only has edges that point to nodes in the same
component or | 363 * strongly connected component only has edges that point to nodes in the same
component or |
| 363 * earlier components). | 364 * earlier components). |
| 364 */ | 365 */ |
| 365 List<List<N>> _allComponents = new List<List<N>>(); | 366 List<List<N>> _allComponents = new List<List<N>>(); |
| 366 | 367 |
| 367 /** | 368 /** |
| 368 * Initialize a newly created finder. | 369 * Initialize a newly created finder. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 632 |
| 632 /** | 633 /** |
| 633 * Instances of the class `TokenMap` map one set of tokens to another set of tok
ens. | 634 * Instances of the class `TokenMap` map one set of tokens to another set of tok
ens. |
| 634 */ | 635 */ |
| 635 class TokenMap { | 636 class TokenMap { |
| 636 /** | 637 /** |
| 637 * A table mapping tokens to tokens. This should be replaced by a more perform
ant implementation. | 638 * A table mapping tokens to tokens. This should be replaced by a more perform
ant implementation. |
| 638 * One possibility is a pair of parallel arrays, with keys being sorted by the
ir offset and a | 639 * One possibility is a pair of parallel arrays, with keys being sorted by the
ir offset and a |
| 639 * cursor indicating where to start searching. | 640 * cursor indicating where to start searching. |
| 640 */ | 641 */ |
| 641 Map<Token, Token> _map = new Map<Token, Token>(); | 642 HashMap<Token, Token> _map = new HashMap<Token, Token>(); |
| 642 | 643 |
| 643 /** | 644 /** |
| 644 * Return the token that is mapped to the given token, or `null` if there is n
o token | 645 * Return the token that is mapped to the given token, or `null` if there is n
o token |
| 645 * corresponding to the given token. | 646 * corresponding to the given token. |
| 646 * | 647 * |
| 647 * @param key the token being mapped to another token | 648 * @param key the token being mapped to another token |
| 648 * @return the token that is mapped to the given token | 649 * @return the token that is mapped to the given token |
| 649 */ | 650 */ |
| 650 Token get(Token key) => _map[key]; | 651 Token get(Token key) => _map[key]; |
| 651 | 652 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 730 |
| 730 @override | 731 @override |
| 731 void set value(V newValue) { | 732 void set value(V newValue) { |
| 732 if (_currentKey == null) { | 733 if (_currentKey == null) { |
| 733 throw new NoSuchElementException(); | 734 throw new NoSuchElementException(); |
| 734 } | 735 } |
| 735 _currentValue = newValue; | 736 _currentValue = newValue; |
| 736 _map[_currentKey] = newValue; | 737 _map[_currentKey] = newValue; |
| 737 } | 738 } |
| 738 } | 739 } |
| OLD | NEW |