org.acm.seguin.refactor.type
Class RenameClassVisitor

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.RenameClassVisitor
All Implemented Interfaces:
SummaryVisitor
Direct Known Subclasses:
RemoveClassVisitor

public class RenameClassVisitor
extends TypeChangeVisitor

Renames a class from one name to another.

Author:
Chris Seguin

Field Summary
protected  java.lang.String newClassName
          Description of the Field
protected  java.lang.String oldClassName
          Description of the Field
protected  java.lang.String packageName
          Description of the Field
 
Constructor Summary
RenameClassVisitor(java.lang.String packageName, java.lang.String oldClass, java.lang.String newClass, java.io.File base, ComplexTransform complex)
          Determine if anything in this tree references these classes.
 
Method Summary
protected  void addRenamingTransforms(ComplexTransform refactoring, FileSummary node, java.lang.String className)
          Gets the RenamingTransform
protected  void alreadyImportsType(ComplexTransform refactoring, net.sourceforge.jrefactory.ast.ASTName oldOne, FileSummary node, TypeSummary importedType)
          We are performing the transformation on a refactoring that already has that type imported from another class
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  net.sourceforge.jrefactory.ast.ASTName getNewName()
          Gets the new name
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
 

Field Detail

packageName

protected java.lang.String packageName
Description of the Field


oldClassName

protected java.lang.String oldClassName
Description of the Field


newClassName

protected java.lang.String newClassName
Description of the Field

Constructor Detail

RenameClassVisitor

public RenameClassVisitor(java.lang.String packageName,
                          java.lang.String oldClass,
                          java.lang.String newClass,
                          java.io.File base,
                          ComplexTransform complex)
Determine if anything in this tree references these classes.

Parameters:
base - the base directory
packageName - Description of Parameter
oldClass - Description of Parameter
newClass - Description of Parameter
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

getNewName

protected net.sourceforge.jrefactory.ast.ASTName getNewName()
Gets the new name

Returns:
an ASTName containing the new name

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

alreadyImportsType

protected void alreadyImportsType(ComplexTransform refactoring,
                                  net.sourceforge.jrefactory.ast.ASTName oldOne,
                                  FileSummary node,
                                  TypeSummary importedType)
We are performing the transformation on a refactoring that already has that type imported from another class

Parameters:
refactoring - the complex transformation
oldOne - the old class name
node - the file that is being changed
importedType - the type that we are supposedly importing