| Index: pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/utilities/collection/BooleanArray.java b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
|
| similarity index 59%
|
| copy from editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/utilities/collection/BooleanArray.java
|
| copy to pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
|
| index fbd3aa84f070a399973213c0d0d9848476032ba0..9e33a1a0427480d289f6cafec0465a64e44ec3f3 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/utilities/collection/BooleanArray.java
|
| +++ b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
|
| @@ -1,71 +1,57 @@
|
| -/*
|
| - * Copyright (c) 2013, the Dart project authors.
|
| - *
|
| - * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
|
| - * in compliance with the License. You may obtain a copy of the License at
|
| - *
|
| - * http://www.eclipse.org/legal/epl-v10.html
|
| - *
|
| - * Unless required by applicable law or agreed to in writing, software distributed under the License
|
| - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
| - * or implied. See the License for the specific language governing permissions and limitations under
|
| - * the License.
|
| - */
|
| -package com.google.dart.engine.utilities.collection;
|
| -
|
| +// This code was auto-generated, is not intended to be edited, and is subject to
|
| +// significant change. Please see the README file for more information.
|
| +library engine.utilities.collection;
|
| +import 'java_core.dart';
|
| /**
|
| - * The class {@code BooleanArray} defines methods for operating on integers as if they were arrays
|
| + * 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.
|
| */
|
| -public final class BooleanArray {
|
| +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
|
| */
|
| - public static boolean get(int array, Enum<?> index) {
|
| - return get(array, index.ordinal());
|
| - }
|
| + static bool get(int array, Enum<Object> index) => get2(array, index.ordinal);
|
|
|
| /**
|
| * 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
|
| */
|
| - public static boolean get(int array, int index) {
|
| + static bool get2(int array, int index) {
|
| checkIndex(index);
|
| return (array & (1 << index)) > 0;
|
| }
|
|
|
| /**
|
| * 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
|
| */
|
| - public static int set(int array, Enum<?> index, boolean value) {
|
| - return set(array, index.ordinal(), value);
|
| - }
|
| + static int set(int array, Enum<Object> index, bool value) => set2(array, index.ordinal, value);
|
|
|
| /**
|
| * 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
|
| */
|
| - public static int set(int array, int index, boolean value) {
|
| + static int set2(int array, int index, bool value) {
|
| checkIndex(index);
|
| if (value) {
|
| return array | (1 << index);
|
| @@ -77,19 +63,30 @@ public final class BooleanArray {
|
| /**
|
| * 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
|
| */
|
| - private static void checkIndex(int index) {
|
| + static void checkIndex(int index) {
|
| if (index < 0 || index > 30) {
|
| - throw new IndexOutOfBoundsException("Index not between 0 and 30: " + index);
|
| + throw new RangeError("Index not between 0 and 30: ${index}");
|
| }
|
| }
|
| +}
|
| +/**
|
| + * The class `ListUtilities` defines utility methods useful for working with [List
|
| + ].
|
| + */
|
| +class ListUtilities {
|
|
|
| /**
|
| - * Prevent the creation of instances of this class.
|
| + * 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
|
| */
|
| - private BooleanArray() {
|
| - super();
|
| + static void addAll(List list, List<Object> elements) {
|
| + for (Object element in elements) {
|
| + list.add(element);
|
| + }
|
| }
|
| -}
|
| +}
|
|
|