package net.sf.jasperreports.engine.design;

import net.sf.jasperreports.engine.JRExpression;

public class JRDefaultCompilationSourceCode implements JRCompilationSourceCode {
  private final String sourceCode;
  
  private final JRExpression[] lineExpressions;
  
  public JRDefaultCompilationSourceCode(String sourceCode, JRExpression[] lineExpressions) {
    this.sourceCode = sourceCode;
    this.lineExpressions = lineExpressions;
  }
  
  public String getCode() {
    return this.sourceCode;
  }
  
  public JRExpression getExpressionAtLine(int line) {
    if (this.lineExpressions == null || line <= 0 || line > this.lineExpressions.length)
      return null; 
    return this.lineExpressions[line - 1];
  }
}
