(openPaths: PathTree)
| 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 |
no test coverage detected