<commit_before>////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
//
// 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.
//
////////////////////////////////////////////////////////////////////////////

/**
 * Abstract base class containing methods shared by {@link Realm.List} and {@link Realm.Results}.
 *
 * A Realm Collection is a homogenous sequence of values of any of the types
 * that can be stored as properties of Realm objects. A collection can be
 * accessed in any of the ways that a normal Javascript Array can, including
 * subscripting, enumerating with `for-of` and so on.
 *
 * A Collection always reflect the current state of the Realm. The one exception to this is
 * when using `for...in` or `for...of` enumeration, which will always enumerate over the
 * objects which matched the query when the enumeration is begun, even if some of them are
 * deleted or modified to be excluded by the filter during the enumeration.
 *
 * @memberof Realm
 * @since 0.11.0
 */
class Collection {
    /**
     * The number of values in the collection.
     * @type {number}
     * @readonly
     */
    get length() {}

    /**
     * The {@linkplain Realm~PropertyType type} of values in the collection.
     * @type {string}
     * @readonly
     * @since 2.0.0
     */
    get type() {}

    /**
     * Whether `null` is a valid value for the collection.
     * @type {boolean}
     * @readonly
     * @since 2.0.0
     */
    get optional() {}

    /**
     * Checks if this collection has not been deleted and is part of a valid Realm.
     * @returns {boolean} indicating if the collection can be safely accessed.
     * @since 0.14.0
     */
    isValid() {}

    /**
     * Checks if this collection is empty.
     * @returns {boolean} indicating if the collection is empty or not.
     * @since 2.7.0
     */
    isEmpty() {}

    /**
     * Returns new _Results_ that represent this collection being filtered by the provided query.
     *
     * @param {string} query - Query used to filter objects from the collection.
     * @param {...any} [arg] - Each subsequent argument is used by the placeholders
     *   (e.g. `$0`, `$1`, `$2`, …) in the query.
     * @throws {Error} If the query or any other argument passed into this method is invalid.
     * @returns {Realm.Results<T>} filtered according to the provided query.
     *
     * This is currently only supported for collections of Realm Objects.
     *
     * See {@tutorial query-language} for details about the query language.
     * @example
     * let merlots = wines.filtered('variety == "Merlot" && vintage <= $0', maxYear);
     */
    filtered(query, ...arg) {}

    /**
     * Returns new _Results_ that represent a sorted view of this collection.
     *
     * A collection of Realm Objects can be sorted on one or more properties of
     * those objects, or of properties of objects linked to by those objects.
     * To sort by a single property, simply pass the name of that property to
     * `sorted()`, optionally followed by a boolean indicating if the sort should be reversed.
     * For more than one property, you must pass an array of
     * {@linkplain Realm.Collection~SortDescriptor sort descriptors} which list
     * which properties to sort on.
     *
     * Collections of other types sort on the values themselves rather than
     * properties of the values, and so no property name or sort descriptors
     * should be supplied.
     *
     * @example
     * // Sort wines by age
     * wines.sorted('age')
     * @example
     * // Sort wines by price in descending order, then sort ties by age in
     * // ascending order
     * wines.sorted([['price', false], ['age'])
     * @example
     * // Sort a list of numbers in ascending order
     * let sortedPrices = wine.pricesSeen.sort()
     * @example
     * // Sort people by how expensive their favorite wine is
     * people.sort("favoriteWine.price")
     *
     * @param {string|Realm.Collection~SortDescriptor[]} [descriptor] - The property name(s) to sort the collection on.
     * @param {boolean} [reverse=false] - Sort in descending order rather than ascended.
     *   May not be supplied if `descriptor` is an array of sort descriptors.
     * @throws {Error} If a specified property does not exist.
     * @returns {Realm.Results<T>} sorted according to the arguments passed in.
     */
    sorted(descriptor, reverse) {}

    /**
     * Create a frozen snapshot of the collection.
     *
     * Values added to and removed from the original collection will not be
     * reflected in the _Results_ returned by this method, including if the
     * values of properties are changed to make them match or not match any
     * filters applied.
     *
     * This is **not** a _deep_ snapshot. Realm objects contained in this
     * snapshot will continue to update as changes are made to them, and if
     * they are deleted from the Realm they will be replaced by `null` at the
     * respective indices.<commit_msg>Fixing doc error<commit_after>////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
//
// 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.
//
////////////////////////////////////////////////////////////////////////////

/**
 * Abstract base class containing methods shared by {@link Realm.List} and {@link Realm.Results}.
 *
 * A Realm Collection is a homogenous sequence of values of any of the types
 * that can be stored as properties of Realm objects. A collection can be
 * accessed in any of the ways that a normal Javascript Array can, including
 * subscripting, enumerating with `for-of` and so on.
 *
 * A Collection always reflect the current state of the Realm. The one exception to this is
 * when using `for...in` or `for...of` enumeration, which will always enumerate over the
 * objects which matched the query when the enumeration is begun, even if some of them are
 * deleted or modified to be excluded by the filter during the enumeration.
 *
 * @memberof Realm
 * @since 0.11.0
 */
class Collection {
    /**
     * The number of values in the collection.
     * @type {number}
     * @readonly
     */
    get length() {}

    /**
     * The {@linkplain Realm~PropertyType type} of values in the collection.
     * @type {string}
     * @readonly
     * @since 2.0.0
     */
    get type() {}

    /**
     * Whether `null` is a valid value for the collection.
     * @type {boolean}
     * @readonly
     * @since 2.0.0
     */
    get optional() {}

    /**
     * Checks if this collection has not been deleted and is part of a valid Realm.
     * @returns {boolean} indicating if the collection can be safely accessed.
     * @since 0.14.0
     */
    isValid() {}

    /**
     * Checks if this collection is empty.
     * @returns {boolean} indicating if the collection is empty or not.
     * @since 2.7.0
     */
    isEmpty() {}

    /**
     * Returns new _Results_ that represent this collection being filtered by the provided query.
     *
     * @param {string} query - Query used to filter objects from the collection.
     * @param {...any} [arg] - Each subsequent argument is used by the placeholders
     *   (e.g. `$0`, `$1`, `$2`, …) in the query.
     * @throws {Error} If the query or any other argument passed into this method is invalid.
     * @returns {Realm.Results<T>} filtered according to the provided query.
     *
     * This is currently only supported for collections of Realm Objects.
     *
     * See {@tutorial query-language} for details about the query language.
     * @example
     * let merlots = wines.filtered('variety == "Merlot" && vintage <= $0', maxYear);
     */
    filtered(query, ...arg) {}

    /**
     * Returns new _Results_ that represent a sorted view of this collection.
     *
     * A collection of Realm Objects can be sorted on one or more properties of
     * those objects, or of properties of objects linked to by those objects.
     * To sort by a single property, simply pass the name of that property to
     * `sorted()`, optionally followed by a boolean indicating if the sort should be reversed.
     * For more than one property, you must pass an array of
     * {@linkplain Realm.Collection~SortDescriptor sort descriptors} which list
     * which properties to sort on.
     *
     * Collections of other types sort on the values themselves rather than
     * properties of the values, and so no property name or sort descriptors
     * should be supplied.
     *
     * @example
     * // Sort wines by age
     * wines.sorted('age')
     * @example
     * // Sort wines by price in descending order, then sort ties by age in
     * // ascending order
     * wines.sorted([['price', false], ['age']])
     * @example
     * // Sort a list of numbers in ascending order
     * let sortedPrices = wine.pricesSeen.sort()
     * @example
     * // Sort people by how expensive their favorite wine is
     * people.sort("favoriteWine.price")
     *
     * @param {string|Realm.Collection~SortDescriptor[]} [descriptor] - The property name(s) to sort the collection on.
     * @param {boolean} [reverse=false] - Sort in descending order rather than ascended.
     *   May not be supplied if `descriptor` is an array of sort descriptors.
     * @throws {Error} If a specified property does not exist.
     * @returns {Realm.Results<T>} sorted according to the arguments passed in.
     */
    sorted(descriptor, reverse) {}

    /**
     * Create a frozen snapshot of the collection.
     *
     * Values added to and removed from the original collection will not be
     * reflected in the _Results_ returned by this method, including if the
     * values of properties are changed to make them match or not match any
     * filters applied.
     *
     * This is **not** a _deep_ snapshot. Realm objects contained in this
     * snapshot will continue to update as changes are made to them, and if
     * they are deleted from the Realm they will be replaced by `null` at the
     * respective indices.
{'fraction_non_alphanumeric': 0.11406672678088368, 'fraction_numerical': 0.005229936880072137, 'mean_word_length': 2.4199814986123958, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4181781', 'n_tokens_mistral': 2912, 'n_tokens_neox': 2815, 'n_words': 1377}