ifc-expressions
Version:
Parsing and evaluation of IFC expressions
46 lines (45 loc) • 1.44 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextObjectType = void 0;
class ContextObjectType {
constructor(name, baseType, members) {
this.name = name;
this.baseType = baseType;
this.members = members;
}
static fromBuiltinDefinition(definition) {
return new ContextObjectType(definition.name, definition.type, definition.members);
}
getMemberDefinition(name) {
return this.members.get(name?.replace(/^\$/, "").toUpperCase());
}
getMemberDefinitions() {
return [...this.members.values()];
}
getName() {
return this.name;
}
isSuperTypeOf(other) {
return other.isSubTypeOf(this);
}
isSameTypeAs(other) {
return this === other || other.getName() === this.getName();
}
isSubTypeOf(other) {
return (this.baseType.isSameTypeAs(other) || this.baseType.isSubTypeOf(other));
}
overlapsWith(other) {
if (this.isSameTypeAs(other)) {
return true;
}
if (other instanceof ContextObjectType) {
return this.baseType.overlapsWith(other.baseType);
}
return this.baseType.overlapsWith(other);
}
isAssignableFrom(other) {
return this.isSameTypeAs(other) || this.isSuperTypeOf(other);
}
}
exports.ContextObjectType = ContextObjectType;
//# sourceMappingURL=ContextObjectType.js.map