| Index: packages/analyzer/lib/src/generated/utilities_collection.dart
|
| diff --git a/packages/analyzer/lib/src/generated/utilities_collection.dart b/packages/analyzer/lib/src/generated/utilities_collection.dart
|
| index 0d2afe8a49890538ee17d82b6f86bae5c47426ea..b1c5e884fb4925114540e47eda56590a7fd57505 100644
|
| --- a/packages/analyzer/lib/src/generated/utilities_collection.dart
|
| +++ b/packages/analyzer/lib/src/generated/utilities_collection.dart
|
| @@ -2,26 +2,44 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library engine.utilities.collection;
|
| +library analyzer.src.generated.utilities_collection;
|
|
|
| -import "dart:math" as math;
|
| import 'dart:collection';
|
| +import "dart:math" as math;
|
| +
|
| +import 'package:analyzer/dart/ast/token.dart';
|
| +import 'package:analyzer/src/generated/java_core.dart';
|
| +
|
| +/**
|
| + * Returns `true` if a and b contain equal elements in the same order.
|
| + */
|
| +bool listsEqual(List a, List b) {
|
| + // TODO(rnystrom): package:collection also implements this, and analyzer
|
| + // already transitively depends on that package. Consider using it instead.
|
| + if (identical(a, b)) {
|
| + return true;
|
| + }
|
| +
|
| + if (a.length != b.length) {
|
| + return false;
|
| + }
|
| +
|
| + for (int i = 0; i < a.length; i++) {
|
| + if (a[i] != b[i]) {
|
| + return false;
|
| + }
|
| + }
|
|
|
| -import 'java_core.dart';
|
| -import 'scanner.dart' show Token;
|
| + return true;
|
| +}
|
|
|
| /**
|
| - * The class `BooleanArray` defines methods for operating on integers as if they were arrays
|
| - * of booleans. These arrays can be indexed by either integers or by enumeration constants.
|
| + * Methods for operating on integers as if they were arrays of booleans. These
|
| + * arrays can be indexed by either integers or by enumeration constants.
|
| */
|
| class BooleanArray {
|
| /**
|
| - * Return the value of the element at the given index.
|
| - *
|
| - * @param array the array being accessed
|
| - * @param index the index of the element being accessed
|
| - * @return the value of the element at the given index
|
| - * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
|
| + * Return the value of the element of the given [array] at the given [index].
|
| */
|
| static bool get(int array, int index) {
|
| _checkIndex(index);
|
| @@ -30,22 +48,13 @@ class BooleanArray {
|
|
|
| /**
|
| * Return the value of the element at the given index.
|
| - *
|
| - * @param array the array being accessed
|
| - * @param index the index of the element being accessed
|
| - * @return the value of the element at the given index
|
| - * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
|
| */
|
| + @deprecated
|
| static bool getEnum(int array, Enum index) => get(array, index.ordinal);
|
|
|
| /**
|
| - * Set the value of the element at the given index to the given value.
|
| - *
|
| - * @param array the array being modified
|
| - * @param index the index of the element being set
|
| - * @param value the value to be assigned to the element
|
| - * @return the updated value of the array
|
| - * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
|
| + * Set the value of the element of the given [array] at the given [index] to
|
| + * the given [value].
|
| */
|
| static int set(int array, int index, bool value) {
|
| _checkIndex(index);
|
| @@ -58,21 +67,14 @@ class BooleanArray {
|
|
|
| /**
|
| * Set the value of the element at the given index to the given value.
|
| - *
|
| - * @param array the array being modified
|
| - * @param index the index of the element being set
|
| - * @param value the value to be assigned to the element
|
| - * @return the updated value of the array
|
| - * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
|
| */
|
| + @deprecated
|
| static int setEnum(int array, Enum index, bool value) =>
|
| set(array, index.ordinal, value);
|
|
|
| /**
|
| - * Throw an exception if the index is not within the bounds allowed for an integer-encoded array
|
| - * of boolean values.
|
| - *
|
| - * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
|
| + * Throw an exception if the index is not within the bounds allowed for an
|
| + * integer-encoded array of boolean values.
|
| */
|
| static void _checkIndex(int index) {
|
| if (index < 0 || index > 30) {
|
| @@ -180,7 +182,7 @@ class DirectedGraph<N> {
|
| */
|
| List<N> findCycleContaining(N node) {
|
| if (node == null) {
|
| - throw new IllegalArgumentException();
|
| + throw new ArgumentError();
|
| }
|
| DirectedGraph_SccFinder<N> finder = new DirectedGraph_SccFinder<N>(this);
|
| return finder.componentContaining(node);
|
| @@ -465,25 +467,6 @@ class DirectedGraph_SccFinder<N> {
|
| }
|
| }
|
|
|
| -/**
|
| - * The class `ListUtilities` defines utility methods useful for working with [List
|
| - ].
|
| - */
|
| -class ListUtilities {
|
| - /**
|
| - * Add all of the elements in the given array to the given list.
|
| - *
|
| - * @param list the list to which the elements are to be added
|
| - * @param elements the elements to be added to the list
|
| - */
|
| - static void addAll(List list, List<Object> elements) {
|
| - int count = elements.length;
|
| - for (int i = 0; i < count; i++) {
|
| - list.add(elements[i]);
|
| - }
|
| - }
|
| -}
|
| -
|
| /**
|
| * The interface `MapIterator` defines the behavior of objects that iterate over the entries
|
| * in a map.
|
| @@ -566,7 +549,7 @@ class MultipleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| K get key {
|
| if (_currentIterator == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| return _currentIterator.key;
|
| }
|
| @@ -574,7 +557,7 @@ class MultipleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| V get value {
|
| if (_currentIterator == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| return _currentIterator.value;
|
| }
|
| @@ -582,7 +565,7 @@ class MultipleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| void set value(V newValue) {
|
| if (_currentIterator == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| _currentIterator.value = newValue;
|
| }
|
| @@ -668,7 +651,7 @@ class SingleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| K get key {
|
| if (_currentKey == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| return _currentKey;
|
| }
|
| @@ -676,7 +659,7 @@ class SingleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| V get value {
|
| if (_currentKey == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| if (_currentValue == null) {
|
| _currentValue = _map[_currentKey];
|
| @@ -687,7 +670,7 @@ class SingleMapIterator<K, V> implements MapIterator<K, V> {
|
| @override
|
| void set value(V newValue) {
|
| if (_currentKey == null) {
|
| - throw new NoSuchElementException();
|
| + throw new StateError('No element');
|
| }
|
| _currentValue = newValue;
|
| _map[_currentKey] = newValue;
|
|
|