mahler
Version:
A automated task composer and HTN based planner for building autonomous system agents
28 lines • 848 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTaskApplicable = isTaskApplicable;
const path_1 = require("../path");
/**
* Identify if a task is applicable for a specific operation
*
* A task is applicable if the task operation as the operation op, and if the task path matches the operation
* path
*/
function isTaskApplicable(t, o) {
if (t.op !== '*' && t.op !== o.op) {
return false;
}
const taskParts = path_1.Path.split(t.lens);
const opParts = path_1.Path.split(o.path);
if (taskParts.length !== opParts.length) {
return false;
}
for (const tElem of taskParts) {
const oElem = opParts.shift();
if (!tElem.startsWith(':') && tElem !== oElem) {
return false;
}
}
return true;
}
//# sourceMappingURL=utils.js.map