FileDocCategorySizeDatePackage
SourceOrderDeclScanner.javaAPI DocJava SE 5 API6174Fri Aug 26 14:55:16 BST 2005com.sun.mirror.util

SourceOrderDeclScanner

public class SourceOrderDeclScanner extends DeclarationScanner
A visitor for declarations that scans declarations contained within the given declaration in source code order. For example, when visiting a class, the methods, fields, constructors, and nested types of the class are also visited. To control the processing done on a declaration, users of this class pass in their own visitors for pre and post processing. The preprocessing visitor is called before the contained declarations are scanned; the postprocessing visitor is called after the contained declarations are scanned.
author
Joseph D. Darcy
author
Scott Seligman
version
1.5 04/09/16
since
1.5

Fields Summary
static final Comparator
comparator
Constructors Summary
SourceOrderDeclScanner(DeclarationVisitor pre, DeclarationVisitor post)


        
	super(pre, post);
    
Methods Summary
public voidvisitClassDeclaration(com.sun.mirror.declaration.ClassDeclaration d)
Visits a class declaration.

param
d the declaration to visit

	d.accept(pre);

	SortedSet<Declaration> decls = new 
	    TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;

	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
	    decls.add(tpDecl);
	}
	
	for(FieldDeclaration fieldDecl: d.getFields()) {
	    decls.add(fieldDecl);
	}
	
	for(MethodDeclaration methodDecl: d.getMethods()) {
	    decls.add(methodDecl);
	}
	
	for(TypeDeclaration typeDecl: d.getNestedTypes()) {
	    decls.add(typeDecl);
	}

	for(ConstructorDeclaration ctorDecl: d.getConstructors()) {
	    decls.add(ctorDecl);
	}

	for(Declaration decl: decls )
	    decl.accept(this);

	d.accept(post);
    
public voidvisitExecutableDeclaration(com.sun.mirror.declaration.ExecutableDeclaration d)

	d.accept(pre);

	SortedSet<Declaration> decls = new 
	    TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
	
	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters())
	    decls.add(tpDecl);

	for(ParameterDeclaration pDecl: d.getParameters())
	    decls.add(pDecl);

	for(Declaration decl: decls )
	    decl.accept(this);

	d.accept(post);
    
public voidvisitTypeDeclaration(com.sun.mirror.declaration.TypeDeclaration d)
Visits a type declaration.

param
d the declaration to visit

	d.accept(pre);

	SortedSet<Declaration> decls = new 
	    TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;

	for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
	    decls.add(tpDecl);
	}
	
	for(FieldDeclaration fieldDecl: d.getFields()) {
	    decls.add(fieldDecl);
	}
	
	for(MethodDeclaration methodDecl: d.getMethods()) {
	    decls.add(methodDecl);
	}
	
	for(TypeDeclaration typeDecl: d.getNestedTypes()) {
	    decls.add(typeDecl);
	}

	for(Declaration decl: decls )
	    decl.accept(this);

	d.accept(post);