org.acm.seguin.refactor.method
Class AddConstructor

java.lang.Object
  extended by org.acm.seguin.refactor.TransformAST
      extended by org.acm.seguin.refactor.method.AddConstructor

public class AddConstructor
extends TransformAST

A series of transformations taht adds a new constructor to a class. The constructor invokes the super classes's constructor. This object shares a lot in common with the AddNewMethod class, and combining these two objects can be considered for future refactorings.

Author:
Chris Seguin

Field Summary
protected  MethodSummary methodSummary
          The method we are updating
 
Constructor Summary
AddConstructor(MethodSummary init, java.lang.String name)
          Constructor for the AddConstructor object
 
Method Summary
protected  void addBody(net.sourceforge.jrefactory.ast.SimpleNode methodDecl, int index)
          Adds the body of the method
protected  int addExceptions(net.sourceforge.jrefactory.ast.SimpleNode methodDecl, int index)
          Adds the exceptions to the node
protected  void addReturn(net.sourceforge.jrefactory.ast.SimpleNode methodDecl, int index)
          Adds the return to the method declaration
protected  net.sourceforge.jrefactory.ast.ASTNameList createExceptions(java.util.Iterator iter)
          Creates the exceptions
protected  net.sourceforge.jrefactory.ast.ASTFormalParameters createParameters()
          Creates the parameters
protected  boolean isAbstract()
          Determines if the method is abstract
 void update(net.sourceforge.jrefactory.ast.SimpleNode root)
          Update the syntax tree
 
Methods inherited from class org.acm.seguin.refactor.TransformAST
copyModifiers
 
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 we are updating

Constructor Detail

AddConstructor

public AddConstructor(MethodSummary init,
                      java.lang.String name)
Constructor for the AddConstructor object

Parameters:
init - the method summary to add
Method Detail

update

public void update(net.sourceforge.jrefactory.ast.SimpleNode root)
Update the syntax tree

Specified by:
update in class TransformAST
Parameters:
root - the root of the syntax tree

isAbstract

protected boolean isAbstract()
Determines if the method is abstract

Returns:
true if the method is abstract

addReturn

protected void addReturn(net.sourceforge.jrefactory.ast.SimpleNode methodDecl,
                         int index)
Adds the return to the method declaration

Parameters:
methodDecl - The feature to be added to the Return attribute
index - The feature to be added to the Return attribute

createParameters

protected net.sourceforge.jrefactory.ast.ASTFormalParameters createParameters()
Creates the parameters

Returns:
Description of the Returned Value

createExceptions

protected net.sourceforge.jrefactory.ast.ASTNameList createExceptions(java.util.Iterator iter)
Creates the exceptions

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

addExceptions

protected int addExceptions(net.sourceforge.jrefactory.ast.SimpleNode methodDecl,
                            int index)
Adds the exceptions to the node

Parameters:
methodDecl - The feature to be added to the Exceptions attribute
index - The feature to be added to the Exceptions attribute
Returns:
Description of the Returned Value

addBody

protected void addBody(net.sourceforge.jrefactory.ast.SimpleNode methodDecl,
                       int index)
Adds the body of the method

Parameters:
methodDecl - The feature to be added to the Body attribute
index - The feature to be added to the Body attribute