org.acm.seguin.refactor.type
Class MoveClassVisitor

java.lang.Object
  extended by org.acm.seguin.summary.TraversalVisitor
      extended by org.acm.seguin.refactor.type.TypeChangeVisitor
          extended by org.acm.seguin.refactor.type.MoveClassVisitor
All Implemented Interfaces:
SummaryVisitor

public class MoveClassVisitor
extends TypeChangeVisitor

Scans through the summary objects to create a list of files that reference a particular class.

Author:
Chris Seguin

Constructor Summary
MoveClassVisitor(java.lang.String oldPackage, java.lang.String newPackage, java.io.File base, ComplexTransform complex)
          Determine if anything in this tree references these classes.
 
Method Summary
protected  void add(java.lang.String newClassName)
          Set the class name.
protected  void addRenamingTransforms(ComplexTransform refactoring, FileSummary node, java.lang.String className)
          Gets the RenamingTransform
protected  java.util.LinkedList getAppropriateClasses(FileSummary node)
          Gets the AppropriateClasses attribute of the TypeChangeVisitor object
protected  java.lang.String getCurrentPackage()
          Return the current package
protected  TransformAST getFileSpecificTransform(FileSummary summary)
          Gets the File Specific Transform
protected  java.io.File getNewFile(FileSummary node)
          Gets the reference to the file where the refactored output should be sent
protected  AddImportTransform getNewImports(FileSummary node, java.lang.String className)
          Gets the New Imports transform
protected  RemoveImportTransform getRemoveImportTransform(ImportSummary node)
          Gets the Remove Imports transform
 
Methods inherited from class org.acm.seguin.refactor.type.TypeChangeVisitor
getState, preconditions, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class org.acm.seguin.summary.TraversalVisitor
visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveClassVisitor

public MoveClassVisitor(java.lang.String oldPackage,
                        java.lang.String newPackage,
                        java.io.File base,
                        ComplexTransform complex)
Determine if anything in this tree references these classes.

Parameters:
oldPackage - the name of the old package
newPackage - the name of the new package
base - the base directory
complex - Description of Parameter
Method Detail

getFileSpecificTransform

protected TransformAST getFileSpecificTransform(FileSummary summary)
Gets the File Specific Transform

Specified by:
getFileSpecificTransform in class TypeChangeVisitor
Parameters:
summary - Gets a file specific transform
Returns:
The FileSpecificTransform value

getNewImports

protected AddImportTransform getNewImports(FileSummary node,
                                           java.lang.String className)
Gets the New Imports transform

Specified by:
getNewImports in class TypeChangeVisitor
Parameters:
node - the file summary
className - the name of the class that is changing
Returns:
The NewImports value

getRemoveImportTransform

protected RemoveImportTransform getRemoveImportTransform(ImportSummary node)
Gets the Remove Imports transform

Specified by:
getRemoveImportTransform in class TypeChangeVisitor
Parameters:
node - the import summary
Returns:
The transform

getAppropriateClasses

protected java.util.LinkedList getAppropriateClasses(FileSummary node)
Gets the AppropriateClasses attribute of the TypeChangeVisitor object

Specified by:
getAppropriateClasses in class TypeChangeVisitor
Parameters:
node - Description of Parameter
Returns:
The AppropriateClasses value

getNewFile

protected java.io.File getNewFile(FileSummary node)
Gets the reference to the file where the refactored output should be sent

Specified by:
getNewFile in class TypeChangeVisitor
Parameters:
node - the files summary
Returns:
The NewFile value

getCurrentPackage

protected java.lang.String getCurrentPackage()
Return the current package

Specified by:
getCurrentPackage in class TypeChangeVisitor
Returns:
the current package of the class

addRenamingTransforms

protected void addRenamingTransforms(ComplexTransform refactoring,
                                     FileSummary node,
                                     java.lang.String className)
Gets the RenamingTransform

Specified by:
addRenamingTransforms in class TypeChangeVisitor
Parameters:
refactoring - the refactoring
node - the file summary to reference
className - the name of the class that is changing

add

protected void add(java.lang.String newClassName)
Set the class name. Allows sub classes of this to reuse themselves for different classes in the same package.

Parameters:
newClassName - the new class name