| 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 library engine.utilities.collection; | 3 library engine.utilities.collection; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'scanner.dart' show Token; |
| 5 /** | 6 /** |
| 6 * The class `BooleanArray` defines methods for operating on integers as if they
were arrays | 7 * The class `BooleanArray` defines methods for operating on integers as if they
were arrays |
| 7 * of booleans. These arrays can be indexed by either integers or by enumeration
constants. | 8 * of booleans. These arrays can be indexed by either integers or by enumeration
constants. |
| 8 */ | 9 */ |
| 9 class BooleanArray { | 10 class BooleanArray { |
| 10 | 11 |
| 11 /** | 12 /** |
| 12 * Return the value of the element at the given index. | 13 * Return the value of the element at the given index. |
| 13 * | 14 * |
| 14 * @param array the array being accessed | 15 * @param array the array being accessed |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 * | 67 * |
| 67 * @throws IndexOutOfBoundsException if the index is not between zero (0) and
31, inclusive | 68 * @throws IndexOutOfBoundsException if the index is not between zero (0) and
31, inclusive |
| 68 */ | 69 */ |
| 69 static void checkIndex(int index) { | 70 static void checkIndex(int index) { |
| 70 if (index < 0 || index > 30) { | 71 if (index < 0 || index > 30) { |
| 71 throw new RangeError("Index not between 0 and 30: ${index}"); | 72 throw new RangeError("Index not between 0 and 30: ${index}"); |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 /** | 76 /** |
| 77 * Instances of the class `TokenMap` map one set of tokens to another set of tok
ens. |
| 78 */ |
| 79 class TokenMap { |
| 80 |
| 81 /** |
| 82 * A table mapping tokens to tokens. This should be replaced by a more perform
ant implementation. |
| 83 * One possibility is a pair of parallel arrays, with keys being sorted by the
ir offset and a |
| 84 * cursor indicating where to start searching. |
| 85 */ |
| 86 Map<Token, Token> _map = new Map<Token, Token>(); |
| 87 |
| 88 /** |
| 89 * Return the token that is mapped to the given token, or `null` if there is n
o token |
| 90 * corresponding to the given token. |
| 91 * |
| 92 * @param key the token being mapped to another token |
| 93 * @return the token that is mapped to the given token |
| 94 */ |
| 95 Token get(Token key) => _map[key]; |
| 96 |
| 97 /** |
| 98 * Map the key to the value. |
| 99 * |
| 100 * @param key the token being mapped to the value |
| 101 * @param value the token to which the key will be mapped |
| 102 */ |
| 103 void put(Token key, Token value) { |
| 104 _map[key] = value; |
| 105 } |
| 106 } |
| 107 /** |
| 76 * The class `ListUtilities` defines utility methods useful for working with [Li
st | 108 * The class `ListUtilities` defines utility methods useful for working with [Li
st |
| 77 ]. | 109 ]. |
| 78 */ | 110 */ |
| 79 class ListUtilities { | 111 class ListUtilities { |
| 80 | 112 |
| 81 /** | 113 /** |
| 82 * Add all of the elements in the given array to the given list. | 114 * Add all of the elements in the given array to the given list. |
| 83 * | 115 * |
| 84 * @param list the list to which the elements are to be added | 116 * @param list the list to which the elements are to be added |
| 85 * @param elements the elements to be added to the list | 117 * @param elements the elements to be added to the list |
| 86 */ | 118 */ |
| 87 static void addAll(List list, List<Object> elements) { | 119 static void addAll(List list, List<Object> elements) { |
| 88 for (Object element in elements) { | 120 for (Object element in elements) { |
| 89 list.add(element); | 121 list.add(element); |
| 90 } | 122 } |
| 91 } | 123 } |
| 92 } | 124 } |
| OLD | NEW |