1 package polyglot.ast; 2 3 import polyglot.types.ImportTable; 4 import polyglot.frontend.Source; 5 import java.util.List; 6 7 /** 8 * A <code>SourceFile</code> is an immutable representations of a Java 9 * language source file. It consists of a package name, a list of 10 * <code>Import</code>s, and a list of <code>GlobalDecl</code>s. 11 */ 12 public interface SourceFile extends Node 13 { 14 /** Get the source's declared package. */ 15 PackageNode package_(); 16 17 /** Set the source's declared package. */ 18 SourceFile package_(PackageNode package_); 19 20 /** Get the source's declared imports. 21 * @return A list of {@link polyglot.ast.Import Import}. 22 */ 23 List imports(); 24 25 /** Set the source's declared imports. 26 * @param imports A list of {@link polyglot.ast.Import Import}. 27 */ 28 SourceFile imports(List imports); 29 30 /** Get the source's top-level declarations. 31 * @return A list of {@link polyglot.ast.TopLevelDecl TopLevelDecl}. 32 */ 33 List decls(); 34 35 /** Set the source's top-level declarations. 36 * @param decls A list of {@link polyglot.ast.TopLevelDecl TopLevelDecl}. 37 */ 38 SourceFile decls(List decls); 39 40 /** Get the source's import table. */ 41 ImportTable importTable(); 42 43 /** Set the source's import table. */ 44 SourceFile importTable(ImportTable importTable); 45 46 /** Get the source file. */ 47 Source source(); 48 49 /** Set the source file. */ 50 SourceFile source(Source source); 51 } 52