Newer
Older

Grand Francois
committed
private _value: string;
private _isNumericalFlag: boolean;

Grand Francois
committed

Grand Francois
committed
}
get isNumerical(): boolean {
this.updateNumericalFlag();

Grand Francois
committed
}
/**
* nécessaire car si on surcharge un des accesseurs, il faut surcharger les 2 (merci Microsoft)
*/
get value() {

Grand Francois
committed
}
set value(v: string) {
this._isNumericalFlag = undefined;
this._value = v;
this.updateNumericalFlag();

Grand Francois
committed
}
get numericalValue(): number {
throw new Error("invalid NumericalString '" + this._value + "' value");

Grand Francois
committed
return +this.value;
}
get uncheckedValueString(): string {
if (this._value !== undefined) {
return this._value;

Grand Francois
committed
return "";
}

Grand Francois
committed
return this._value + (this.isNumerical ? " [numerical]" : " [NOT numerical]");

Grand Francois
committed
}
if (this.isNumericalFlag === undefined) {
this._isNumericalFlag = false;
if (this._value !== undefined) {
this._isNumericalFlag = String(this.value).trim() !== "" && !isNaN(+this.value);