/*!
 * @author electricessence / https://github.com/electricessence/
 * Licensing: MIT https://github.com/electricessence/TypeScript.NET-Core/blob/master/LICENSE.md
 */
import DisposableBase from "../Disposable/DisposableBase";
import ICollection from "./ICollection";
import { FiniteIEnumerator } from "./Enumeration/IEnumerator";
import IEnumerateEach from "./Enumeration/IEnumerateEach";
import { ActionWithIndex, EqualityComparison, PredicateWithIndex } from "../FunctionTypes";
import ArrayLikeWritable from "./Array/ArrayLikeWritable";
import FiniteEnumerableOrEnumerator from "./Enumeration/FiniteEnumerableOrEnumerator";
export declare abstract class CollectionBase<T> extends DisposableBase implements ICollection<T>, IEnumerateEach<T> {
    protected _equalityComparer: EqualityComparison<T>;
    protected constructor(source?: FiniteEnumerableOrEnumerator<T>, _equalityComparer?: EqualityComparison<T>);
    get isEndless(): false;
    protected abstract getCount(): number;
    get count(): number;
    protected getIsReadOnly(): boolean;
    get isReadOnly(): boolean;
    protected assertModifiable(): true | never;
    protected _version: number;
    protected assertVersion(version: number): true | never;
    private _modifiedCount;
    private _updateRecursion;
    protected _onModified(): void;
    protected _signalModification(increment?: boolean): boolean;
    protected _incrementModified(): void;
    get isUpdating(): boolean;
    /**
     * Takes a closure that if returning true will propagate an update signal.
     * Multiple update operations can be occurring at once or recursively and the onModified signal will only occur once they're done.
     * @param closure
     * @returns {boolean}
     */
    handleUpdate(closure?: () => boolean): boolean;
    protected abstract _addInternal(entry: T): boolean;
    /**
     * Adds an entry to the collection.
     * @param entry
     */
    add(entry: T): this;
    protected abstract _removeInternal(entry: T, max?: number): number;
    /**
     * Removes entries from the collection allowing for a limit.
     * For example if the collection not a distinct set, more than one entry could be removed.
     * @param entry The entry to remove.
     * @param max Limit of entries to remove.  Will remove all matches if no max specified.
     * @returns {number} The number of entries removed.
     */
    remove(entry: T, max?: number): number;
    protected abstract _clearInternal(): number;
    /**
     * Clears the contents of the collection resulting in a count of zero.
     * @returns {number}
     */
    clear(): number;
    protected _onDispose(): void;
    protected _importEntries(entries: FiniteEnumerableOrEnumerator<T> | null | undefined): number;
    /**
     * Safely imports any array enumerator, or enumerable.
     * @param entries
     * @returns {number}
     */
    importEntries(entries: FiniteEnumerableOrEnumerator<T>): number;
    /**
     * Returns a enumerator for this collection.
     */
    abstract getEnumerator(): FiniteIEnumerator<T>;
    /**
     * Returns an array filtered by the provided predicate.
     * Provided for similarity to JS Array.
     * @param predicate
     * @returns {[]}
     */
    filter(predicate: PredicateWithIndex<T>): T[];
    /**
     * Returns true the first time predicate returns true.  Otherwise false.
     * Useful for searching through a collection.
     * @param predicate
     * @returns {any}
     */
    any(predicate?: PredicateWithIndex<T>): boolean;
    /**
     * Returns true the first time predicate returns true.  Otherwise false.
     * See '.any(predicate)'.  As this method is just just included to have similarity with a JS Array.
     * @param predicate
     * @returns {any}
     */
    some(predicate?: PredicateWithIndex<T>): boolean;
    /**
     * Returns true if the equality comparer resolves true on any element in the collection.
     * @param entry
     * @returns {boolean}
     */
    contains(entry: T): boolean;
    /**
     * Special implementation of 'forEach': If the action returns 'false' the enumeration will stop.
     * @param action
     * @param useCopy
     */
    forEach(action: ActionWithIndex<T>, useCopy?: boolean): number;
    forEach(action: PredicateWithIndex<T>, useCopy?: boolean): number;
    /**
     * Copies all values to numerically indexable object.
     * @param target
     * @param index
     * @returns {TTarget}
     */
    copyTo<TTarget extends ArrayLikeWritable<T>>(target: TTarget, index?: number): TTarget;
    /**
     * Returns an array of the collection contents.
     * @returns {any[]|Array}
     */
    toArray(): T[];
}
export default CollectionBase;
