org.acm.seguin.refactor.method
Class PushDownMethodRefactoring

java.lang.Object
  extended by org.acm.seguin.refactor.Refactoring
      extended by org.acm.seguin.refactor.method.PushDownMethodRefactoring

public class PushDownMethodRefactoring
extends Refactoring

Performs the push down method refactoring

Author:
Chris Seguin

Field Summary
protected  java.lang.String method
          The name of the method
protected  MethodSummary methodSummary
          the method that is being moved around
protected  java.lang.String[] params
           
 
Fields inherited from class org.acm.seguin.refactor.Refactoring
ADD_CHILD, ADD_PARENT, EXTRACT_INTERFACE, EXTRACT_METHOD, MOVE_METHOD, PUSH_DOWN_FIELD, PUSH_DOWN_METHOD, PUSH_UP_ABSTRACT_METHOD, PUSH_UP_FIELD, PUSH_UP_METHOD, REMOVE_CLASS, RENAME_CLASS, RENAME_FIELD, RENAME_METHOD, RENAME_PARAMETER, REPACKAGE
 
Constructor Summary
protected PushDownMethodRefactoring()
          Constructor for the PushDownMethodRefactoring object
 
Method Summary
 void addChild(TypeSummary type)
          Adds a feature to the Child attribute of the PushDownMethodRefactoring object
protected  void addMethodToDest(ComplexTransform transform, RemoveMethodTransform rft, net.sourceforge.jrefactory.ast.SimpleNode methodDecl, TypeSummary dest)
          Adds the method to the destination class
protected  void checkDestination(TypeSummary dest)
          Description of the Method
 java.lang.String getDescription()
          Gets the description of the refactoring
protected  FileSummary getFileSummary(Summary current)
          Gets the package summary for the specific object
 int getID()
          Gets the ID attribute of the PushDownMethodRefactoring object
protected  PackageSummary getPackage(Summary current)
          Gets the package summary for the specific object
protected  boolean isInJavaLang(net.sourceforge.jrefactory.ast.ASTName type)
          Determines if the specified type is in java.lang package
protected  boolean isInJavaLang(TypeSummary type)
          Determines if the specified type is in java.lang package
protected  void preconditions()
          This specifies the preconditions for applying the refactoring
protected  void removeMethod(TypeSummary source, ComplexTransform transform, RemoveMethodTransform rft)
          Description of the Method
 void setClass(java.lang.String packageName, java.lang.String className)
          Sets the Class attribute of the MethodRefactoring object
 void setClass(TypeSummary init)
          Sets the Class attribute of the MethodRefactoring object
 void setMethod(MethodSummary value)
          Sets the Method attribute of the PushUpMethodRefactoring object
 void setMethod(java.lang.String methodName)
          Sets the Method attribute of the MethodRefactoring object
 void setParams(java.lang.String[] params)
          Sets the types of the Parameters of the method of the MethodRefactoring object
protected  void transform()
          Moves the method to the parent class
protected  net.sourceforge.jrefactory.ast.ASTMethodDeclaration updateMethod(net.sourceforge.jrefactory.ast.SimpleNode methodDecl)
          Description of the Method
 
Methods inherited from class org.acm.seguin.refactor.Refactoring
checkDestinationFile, getComplexTransform, run, setComplexTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodSummary

protected MethodSummary methodSummary
the method that is being moved around


method

protected java.lang.String method
The name of the method


params

protected java.lang.String[] params
Constructor Detail

PushDownMethodRefactoring

protected PushDownMethodRefactoring()
Constructor for the PushDownMethodRefactoring object

Method Detail

getDescription

public java.lang.String getDescription()
Gets the description of the refactoring

Specified by:
getDescription in class Refactoring
Returns:
the description

getID

public int getID()
Gets the ID attribute of the PushDownMethodRefactoring object

Specified by:
getID in class Refactoring
Returns:
The ID value

addChild

public void addChild(TypeSummary type)
Adds a feature to the Child attribute of the PushDownMethodRefactoring object

Parameters:
type - The feature to be added to the Child attribute

preconditions

protected void preconditions()
                      throws RefactoringException
This specifies the preconditions for applying the refactoring

Specified by:
preconditions in class Refactoring
Throws:
RefactoringException - Description of Exception

transform

protected void transform()
Moves the method to the parent class

Specified by:
transform in class Refactoring

removeMethod

protected void removeMethod(TypeSummary source,
                            ComplexTransform transform,
                            RemoveMethodTransform rft)
Description of the Method

Parameters:
source - Description of Parameter
transform - Description of Parameter
rft - Description of Parameter

setMethod

public void setMethod(MethodSummary value)
Sets the Method attribute of the PushUpMethodRefactoring object

Parameters:
value - The new Method value

checkDestination

protected void checkDestination(TypeSummary dest)
                         throws RefactoringException
Description of the Method

Parameters:
dest - Description of Parameter
Throws:
RefactoringException - Description of Exception

updateMethod

protected net.sourceforge.jrefactory.ast.ASTMethodDeclaration updateMethod(net.sourceforge.jrefactory.ast.SimpleNode methodDecl)
Description of the Method

Parameters:
methodDecl - Description of Parameter
Returns:
Description of the Returned Value

addMethodToDest

protected void addMethodToDest(ComplexTransform transform,
                               RemoveMethodTransform rft,
                               net.sourceforge.jrefactory.ast.SimpleNode methodDecl,
                               TypeSummary dest)
Adds the method to the destination class

Parameters:
transform - The feature to be added to the MethodToDest attribute
rft - The feature to be added to the MethodToDest attribute
methodDecl - The feature to be added to the MethodToDest attribute
dest - The feature to be added to the MethodToDest attribute

setClass

public void setClass(java.lang.String packageName,
                     java.lang.String className)
Sets the Class attribute of the MethodRefactoring object

Parameters:
packageName - the package name
className - the class name

setClass

public void setClass(TypeSummary init)
Sets the Class attribute of the MethodRefactoring object

Parameters:
init - The new Class value

setMethod

public void setMethod(java.lang.String methodName)
Sets the Method attribute of the MethodRefactoring object

Parameters:
methodName - The new Method value

setParams

public void setParams(java.lang.String[] params)
Sets the types of the Parameters of the method of the MethodRefactoring object

Parameters:
params - The new Parameter types

isInJavaLang

protected boolean isInJavaLang(net.sourceforge.jrefactory.ast.ASTName type)
Determines if the specified type is in java.lang package

Parameters:
type - the type
Returns:
true if it is in the package

isInJavaLang

protected boolean isInJavaLang(TypeSummary type)
Determines if the specified type is in java.lang package

Parameters:
type - the type
Returns:
true if it is in the package

getPackage

protected PackageSummary getPackage(Summary current)
Gets the package summary for the specific object

Parameters:
current - the summary
Returns:
the package summary

getFileSummary

protected FileSummary getFileSummary(Summary current)
Gets the package summary for the specific object

Parameters:
current - the summary
Returns:
the package summary