"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimpleDependee = void 0;
/**
 * Simple implementation of {@link Dependee}.
 *
 * @public
 */
class SimpleDependee {
    constructor(computationName = "SimpleDependee") {
        this.computationName = computationName;
        this.dependents = new Set();
    }
    registerDependent(dependent) {
        if (this.dependents.has(dependent)) {
            return false;
        }
        this.dependents.add(dependent);
        return true;
    }
    removeDependent(dependent) {
        this.dependents.delete(dependent);
    }
    /**
     * Invalidates the dependents that have are dependent on this data.
     */
    invalidateDependents(token) {
        for (const dependent of this.dependents) {
            dependent.markInvalid(token);
        }
    }
    /**
     * @sealed
     */
    listDependents() {
        return this.dependents;
    }
}
exports.SimpleDependee = SimpleDependee;
//# sourceMappingURL=simpleDependee.js.map