001package gudusoft.gsqlparser.lineage2.contract;
002
003/**
004 * Contract {@code SourceLocation} (lineage2-contract.md ยง6): 1-based,
005 * half-open {@code [start, end)} coordinates, absolute within the unit
006 * (the Semantic IR {@code SourceSpan} convention).
007 *
008 * <p>Internal API: not part of the public gsqlparser surface.
009 */
010public final class SourceLocation {
011
012    private final String artifactLocator;
013    private final int statementIndex;
014    private final int startLine;
015    private final int startCol;
016    private final int endLine;
017    private final int endCol;
018
019    public SourceLocation(String artifactLocator, int statementIndex,
020                          int startLine, int startCol, int endLine, int endCol) {
021        if (artifactLocator == null) {
022            throw new IllegalArgumentException("artifactLocator must not be null");
023        }
024        this.artifactLocator = artifactLocator;
025        this.statementIndex = statementIndex;
026        this.startLine = startLine;
027        this.startCol = startCol;
028        this.endLine = endLine;
029        this.endCol = endCol;
030    }
031
032    public String getArtifactLocator() {
033        return artifactLocator;
034    }
035
036    public int getStatementIndex() {
037        return statementIndex;
038    }
039
040    public int getStartLine() {
041        return startLine;
042    }
043
044    public int getStartCol() {
045        return startCol;
046    }
047
048    public int getEndLine() {
049        return endLine;
050    }
051
052    public int getEndCol() {
053        return endCol;
054    }
055}