pddl-workspace
Version:
23 lines • 1.32 kB
JavaScript
;
/* --------------------------------------------------------------------------------------------
* Copyright (c) Jan Dolejsi. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getObjectsInheritingFrom = exports.getTypesInheritingFromPlusSelf = void 0;
const util_1 = require("./utils/util");
function getTypesInheritingFromPlusSelf(type, typeInheritance) {
return [type].concat(typeInheritance.getSubtreePointingTo(type));
}
exports.getTypesInheritingFromPlusSelf = getTypesInheritingFromPlusSelf;
function getObjectsOfType(allObjects, type) {
const thisTypeObjects = allObjects.getTypeCaseInsensitive(type);
return thisTypeObjects ? thisTypeObjects.getObjects() : [];
}
function getObjectsInheritingFrom(allObjects, type, typeInheritance) {
const subTypes = getTypesInheritingFromPlusSelf(type, typeInheritance);
const subTypesObjects = subTypes.map(subType => getObjectsOfType(allObjects, subType));
return util_1.Util.flatMap(subTypesObjects);
}
exports.getObjectsInheritingFrom = getObjectsInheritingFrom;
//# sourceMappingURL=typeInheritance.js.map