MCPcopy
hub / github.com/antonycourtney/tad / getTreeQuery

Method getTreeQuery

packages/aggtree/src/aggtree.ts:252–287  ·  view source on GitHub ↗
(openPaths: PathTree)

Source from the content-addressed store, hash-verified

250 */
251
252 getTreeQuery(openPaths: PathTree): QueryExp {
253 const maxDepth = this.pivotColumns.length + 1;
254 let resQuery = null;
255
256 if (this.rootQuery) {
257 resQuery = this.rootQuery;
258
259 for (let i = 0; i < maxDepth; i++) {
260 resQuery = resQuery.extend("_sortVal_" + i, constVal(0));
261 }
262
263 resQuery = addPathCols(resQuery, 0, maxDepth);
264 }
265
266 const openRoot = this.applyPath([]); // immediate children of root
267
268 if (resQuery) {
269 resQuery = resQuery.concat(openRoot);
270 } else {
271 resQuery = openRoot;
272 }
273
274 for (let path of openPaths.iter()) {
275 let subQuery = this.applyPath(path);
276 resQuery = resQuery.concat(subQuery);
277 }
278
279 const sortArg: [string, boolean][] = [];
280
281 for (let i = 0; i < maxDepth - 1; i++) {
282 sortArg.push(["_path" + i, true]);
283 }
284
285 resQuery = resQuery.sort(sortArg);
286 return resQuery;
287 }
288 /*
289 * get query for full tree state from a set of openPaths, joined with
290 * relevant sort queries based on pivot depth, and with appropriate

Callers 4

getSortedTreeQueryMethod · 0.95
aggtree.test.tsFile · 0.80
basic.test.tsFile · 0.80
basic.test.tsFile · 0.80

Calls 7

applyPathMethod · 0.95
constValFunction · 0.85
addPathColsFunction · 0.85
concatMethod · 0.80
iterMethod · 0.80
sortMethod · 0.80
extendMethod · 0.45

Tested by

no test coverage detected