* Get the type hierarchy for a class/interface * * @param nodeId - ID of the class/interface node * @returns Subgraph containing the type hierarchy
(nodeId: string)
| 410 | * @returns Subgraph containing the type hierarchy |
| 411 | */ |
| 412 | getTypeHierarchy(nodeId: string): Subgraph { |
| 413 | const focalNode = this.queries.getNodeById(nodeId); |
| 414 | if (!focalNode) { |
| 415 | return { nodes: new Map(), edges: [], roots: [] }; |
| 416 | } |
| 417 | |
| 418 | const nodes = new Map<string, Node>(); |
| 419 | const edges: Edge[] = []; |
| 420 | const visited = new Set<string>(); |
| 421 | |
| 422 | // Add focal node |
| 423 | nodes.set(focalNode.id, focalNode); |
| 424 | |
| 425 | // Get ancestors (what this extends/implements) |
| 426 | this.getTypeAncestors(nodeId, nodes, edges, visited); |
| 427 | |
| 428 | // Get descendants (what extends/implements this) |
| 429 | this.getTypeDescendants(nodeId, nodes, edges, visited); |
| 430 | |
| 431 | return { |
| 432 | nodes, |
| 433 | edges, |
| 434 | roots: [nodeId], |
| 435 | }; |
| 436 | } |
| 437 | |
| 438 | private getTypeAncestors( |
| 439 | nodeId: string, |
no test coverage detected