"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParameterValueSet = void 0;
const internal_1 = require("../internal");
/**
 * @internal
 */
class ParameterValueSet {
    constructor(ctx, pc, values, wasSet) {
        // let bodyCode = () =>
        {
            this.pc = pc;
            this.values = values;
            this.wasSet = wasSet;
            this.ctx = ctx;
        }
        // return p.measure(bodyCode);
    }
    get length() {
        // let bodyCode = () =>
        {
            if (this.pc && this.pc.sequence) {
                return this.pc.sequence.length;
            }
            return 0;
        }
        // return p.measure(bodyCode);
    }
    indexOf(paramDef) {
        // let bodyCode = () =>
        {
            return this.pc.ordinals.get(paramDef);
        }
        // return p.measure(bodyCode);
    }
    fetchParameterAtIndex(i) {
        // let bodyCode = () =>
        {
            return this.pc.sequence[i];
        }
        // return p.measure(bodyCode);
    }
    fetchValue(i) {
        // let bodyCode = () =>
        {
            return this.values[i];
        }
        // return p.measure(bodyCode);
    }
    fetchValueString(resOpt, i) {
        // let bodyCode = () =>
        {
            return new internal_1.ParameterValue(this.ctx, this.pc.sequence[i], this.values[i]).fetchValueString(resOpt);
        }
        // return p.measure(bodyCode);
    }
    fetchParameterValueByName(pName) {
        // let bodyCode = () =>
        {
            const i = this.pc.fetchParameterIndex(pName);
            return new internal_1.ParameterValue(this.ctx, this.pc.sequence[i], this.values[i]);
        }
        // return p.measure(bodyCode);
    }
    setParameterValue(resOpt, pName, value) {
        // let bodyCode = () =>
        {
            const i = this.pc.fetchParameterIndex(pName);
            this.values[i] = internal_1.ParameterValue.fetchReplacementValue(resOpt, this.values[i], value, true);
            this.wasSet[i] = true;
        }
        // return p.measure(bodyCode);
    }
    copy() {
        // let bodyCode = () =>
        {
            const copyValues = this.values.slice(0);
            const copyWasSet = this.wasSet.slice(0);
            return new ParameterValueSet(this.ctx, this.pc, copyValues, copyWasSet);
        }
        // return p.measure(bodyCode);
    }
    spew(resOpt, to, indent) {
        // let bodyCode = () =>
        {
            const l = this.length;
            for (let i = 0; i < l; i++) {
                const pv = new internal_1.ParameterValue(this.ctx, this.pc.sequence[i], this.values[i]);
                pv.spew(resOpt, to, `${indent}-`);
            }
        }
        // return p.measure(bodyCode);
    }
}
exports.ParameterValueSet = ParameterValueSet;
//# sourceMappingURL=ParameterValueSet.js.map