ifc-expressions
Version:
Parsing and evaluation of IFC expressions
38 lines (37 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumericValue = void 0;
const decimal_js_1 = require("decimal.js");
const Types_js_1 = require("../type/Types.js");
class NumericValue {
constructor(value) {
if (decimal_js_1.Decimal.isDecimal(value)) {
this.numericValue = value;
}
this.numericValue = new decimal_js_1.Decimal(value);
}
static of(value) {
return new NumericValue(value);
}
getValue() {
return this.numericValue;
}
getType() {
return Types_js_1.Type.NUMERIC;
}
static isNumericValueType(arg) {
return decimal_js_1.Decimal.isDecimal(arg.numericValue);
}
equals(other) {
return (NumericValue.isNumericValueType(other) &&
this.numericValue.eq(other.numericValue));
}
toString() {
return this.numericValue.toString();
}
compareTo(other) {
return this.numericValue.comparedTo(other.numericValue);
}
}
exports.NumericValue = NumericValue;
//# sourceMappingURL=NumericValue.js.map