01: package org.incava.java;
02:
03: import java.util.*;
04: import net.sourceforge.pmd.ast.*;
05:
06: /**
07: * Miscellaneous routines for compilation units.
08: */
09: public class CompilationUnitUtil {
10: public static ASTPackageDeclaration getPackage(ASTCompilationUnit cu) {
11: return (ASTPackageDeclaration) SimpleNodeUtil.findChild(cu,
12: ASTPackageDeclaration.class);
13: }
14:
15: public static ASTImportDeclaration[] getImports(
16: ASTCompilationUnit cu) {
17: return (ASTImportDeclaration[]) SimpleNodeUtil.findChildren(cu,
18: ASTImportDeclaration.class);
19: }
20:
21: public static ASTTypeDeclaration[] getTypeDeclarations(
22: ASTCompilationUnit cu) {
23: return (ASTTypeDeclaration[]) SimpleNodeUtil.findChildren(cu,
24: ASTTypeDeclaration.class);
25: }
26:
27: }
|