<commit_before>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// 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.

part of dart2js.util;

/**
 * The expensive set is a data structure useful for tracking down
 * excessive memory usage due to large sets. It acts as an ordinary
 * hash set, but it uses 10 times more memory (by default).
 */
class ExpensiveSet<E> extends IterableBase<E> implements Set<E> {

  final List _sets;

  ExpensiveSet([int copies = 10]) : _sets = new List(copies) {
    assert(copies > 0);
    for (int i = 0; i < _sets.length; i++) {
      _sets[i] = new Set<E>();
    }
  }

  int get length => _sets[0].length;
  bool get isEmpty => _sets[0].isEmpty;
  bool get isNotEmpty => _sets[0].isNotEmpty;

  Iterator<E> get iterator => _sets[0].iterator;

  bool contains(Object object) => _sets[0].contains(object);
  E lookup(Object object) => _sets[0].lookup(object);

  void forEach(void action(E element)) {
    _sets[0].forEach(action);
  }

  void add(E element) {
    for (int i = 0; i < _sets.length; i++) {
      _sets[i].add(element);
    }
  }

  void addAll(Iterable<E> objects) {
    for (E each in objects) {
      add(each);
    }
  }

  bool remove(Object object) {
    bool result = _sets[0].remove(object);
    for (int i = 1; i < _sets.length; i++) {
      _sets[i].remove(object);
    }
    return result;
  }

  void clear() {
    for (int i = 0; i < _sets.length; i++) {<commit_msg>Make ExpensiveSet.add return a bool.<commit_after>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// 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.

part of dart2js.util;

/**
 * The expensive set is a data structure useful for tracking down
 * excessive memory usage due to large sets. It acts as an ordinary
 * hash set, but it uses 10 times more memory (by default).
 */
class ExpensiveSet<E> extends IterableBase<E> implements Set<E> {

  final List _sets;

  ExpensiveSet([int copies = 10]) : _sets = new List(copies) {
    assert(copies > 0);
    for (int i = 0; i < _sets.length; i++) {
      _sets[i] = new Set<E>();
    }
  }

  int get length => _sets[0].length;
  bool get isEmpty => _sets[0].isEmpty;
  bool get isNotEmpty => _sets[0].isNotEmpty;

  Iterator<E> get iterator => _sets[0].iterator;

  bool contains(Object object) => _sets[0].contains(object);
  E lookup(Object object) => _sets[0].lookup(object);

  void forEach(void action(E element)) {
    _sets[0].forEach(action);
  }

  bool add(E element) {
    bool result = _sets[0].add(element);
    for (int i = 1; i < _sets.length; i++) {
      _sets[i].add(element);
    }
    return result;
  }

  void addAll(Iterable<E> objects) {
    for (E each in objects) {
      add(each);
    }
  }

  bool remove(Object object) {
    bool result = _sets[0].remove(object);
    for (int i = 1; i < _sets.length; i++) {
      _sets[i].remove(object);
    }
    return result;
  }

  void clear() {
    for (int i = 0; i < _sets.length; i++) {
{'fraction_non_alphanumeric': 0.13451215661509314, 'fraction_numerical': 0.01420903062835491, 'mean_word_length': 3.0408163265306123, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6720343', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1045, 'n_words': 359}