001package gudusoft.gsqlparser.ir.semantic; 002 003import java.util.ArrayList; 004import java.util.Collections; 005import java.util.List; 006 007/** 008 * Top-level Semantic IR container. Holds one {@link StatementGraph} per 009 * SQL statement (CTE bodies are emitted as their own statements before the 010 * outer one), plus a flat list of {@link LineageEdge}s spanning statements. 011 * 012 * <p><b>API status:</b> read-only traversal of analyzer-produced instances is 013 * part of Join Analysis Consumption Profile v1. The public constructor is a 014 * producer-oriented API and is not included in that consumption profile. 015 */ 016public final class SemanticProgram { 017 018 private final List<StatementGraph> statements; 019 private final List<LineageEdge> lineage; 020 021 public SemanticProgram(List<StatementGraph> statements, List<LineageEdge> lineage) { 022 if (statements == null) { 023 throw new IllegalArgumentException("statements must not be null"); 024 } 025 if (lineage == null) { 026 throw new IllegalArgumentException("lineage must not be null"); 027 } 028 this.statements = Collections.unmodifiableList(new ArrayList<>(statements)); 029 this.lineage = Collections.unmodifiableList(new ArrayList<>(lineage)); 030 } 031 032 public List<StatementGraph> getStatements() { 033 return statements; 034 } 035 036 public List<LineageEdge> getLineage() { 037 return lineage; 038 } 039}