Commit 153349e0 authored by Grand Francois's avatar Grand Francois
Browse files

classe ParamValues : ajout d'une méthode check() de vérification des membres en fonction du mode

Showing with 32 additions and 0 deletions
+32 -0
......@@ -51,6 +51,7 @@ export class ParamValueIterator implements IterableIterator<number> {
private _config: number;
constructor(prm: ParamValues, reverse: boolean = false) {
prm.check();
this._param = prm;
this.reset(reverse)
}
......@@ -246,6 +247,37 @@ export class ParamValues {
throw new Error(`ParamValues : mode de valeurs ${ParamValueMode[expected]} incorrect`);
}
public check() {
switch (this._valueMode) {
case ParamValueMode.SINGLE:
if (!this._singleValue.isDefined)
throw new Error(`ParamValues : valeur fixe non définie`);
break;
case ParamValueMode.MINMAX:
if (this._minValue == undefined)
throw new Error(`ParamValues : valeur min non définie`);
if (this._maxValue == undefined)
throw new Error(`ParamValues : valeur max non définie`);
if (this._stepValue == undefined)
throw new Error(`ParamValues : valeur du pas non définie`);
if (this._minValue > this._maxValue)
throw new Error(`ParamValues : min > max`);
break;
case ParamValueMode.LISTE:
if (this._valueList == undefined)
throw new Error(`ParamValues : liste de valeurs non définie`);
break;
case ParamValueMode.CALCUL:
break;
default:
throw new Error(`ParamValues : mode de valeurs ${ParamValueMode[this._valueMode]} incorrect`);
}
}
public get singleValue() {
return this._singleValue.value;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment