import '../../assert/js/assert.js';
import '../../globals.js';
import dot from './dot.js';
import Range from './Range.js';
class RangeWithValue extends Range {
    /**
     * @param min - the minimum value of the range
     * @param max - the maximum value of the range
     * @param defaultValue - default value inside the range
     */
    constructor(min, max, defaultValue) {
        super(min, max);
        assert && assert(defaultValue !== undefined, 'default value is required');
        assert && assert(defaultValue >= min && defaultValue <= max, `defaultValue is out of range: ${defaultValue}`);
        this._defaultValue = defaultValue;
    }
    /**
     * Getter for defaultValue
     */
    getDefaultValue() {
        return this._defaultValue;
    }
    get defaultValue() {
        return this.getDefaultValue();
    }
    /**
     * Setter for min
     */
    setMin(min) {
        assert && assert(this._defaultValue >= min, `min must be <= defaultValue: ${min}`);
        super.setMin(min);
    }
    /**
     * Setter for max
     */
    setMax(max) {
        assert && assert(this._defaultValue <= max, `max must be >= defaultValue: ${max}`);
        super.setMax(max);
    }
    /**
     * Setter for min and max
     */
    setMinMax(min, max) {
        assert && assert(this._defaultValue >= min, `min must be <= defaultValue: ${min}`);
        assert && assert(this._defaultValue <= max, `max must be >= defaultValue: ${max}`);
        // REVIEW: Same as setMinMax in Range.ts, returning a value in a setter seems odd...
        return super.setMinMax(min, max);
    }
    /**
     * Converts the attributes of this range to a string
     */
    toString() {
        return `[RangeWithValue (min:${this.min} max:${this.max} defaultValue:${this._defaultValue})]`;
    }
    /**
     * Determines if this RangeWithValue is equal to some object.
     */
    equals(object) {
        return (this.constructor === object.constructor) &&
            (this._defaultValue === object.defaultValue) &&
            super.equals(object);
    }
}
dot.register('RangeWithValue', RangeWithValue);
export default RangeWithValue;
//# sourceMappingURL=RangeWithValue.js.map