001: /*
002: * Author: Chris Seguin
003: *
004: * This software has been developed under the copyleft
005: * rules of the GNU General Public License. Please
006: * consult the GNU General Public License for more
007: * details about use and distribution of this software.
008: */
009: package org.acm.seguin.refactor.method;
010:
011: import net.sourceforge.jrefactory.ast.SimpleNode;
012: import org.acm.seguin.refactor.TransformAST;
013: import org.acm.seguin.summary.MethodSummary;
014: import org.acm.seguin.summary.ParameterSummary;
015:
016: /**
017: * Transformation responsible for renaming the parameter
018: *
019: *@author Chris Seguin
020: */
021: class RenameParameterTransform extends TransformAST {
022: private String newName;
023: private ParameterSummary param;
024: private MethodSummary method;
025: private boolean rightTree;
026:
027: /**
028: * Constructor for the RenameParameterTransform object
029: */
030: public RenameParameterTransform() {
031: newName = null;
032: param = null;
033: method = null;
034: }
035:
036: /**
037: * Sets the NewName attribute of the RenameParameterTransform object
038: *
039: *@param value The new NewName value
040: */
041: public void setNewName(String value) {
042: newName = value;
043: }
044:
045: /**
046: * Sets the ParameterSummary attribute of the RenameParameterTransform
047: * object
048: *
049: *@param value The new ParameterSummary value
050: */
051: public void setParameter(ParameterSummary value) {
052: param = value;
053: }
054:
055: /**
056: * Sets the MethodSummary attribute of the RenameParameterTransform object
057: *
058: *@param value The new MethodSummary value
059: */
060: public void setMethod(MethodSummary value) {
061: method = value;
062: }
063:
064: /**
065: * Sets the RightTree attribute of the RenameParameterTransform object
066: *
067: *@param value The new RightTree value
068: */
069: public void setRightTree(boolean value) {
070: rightTree = value;
071: }
072:
073: /**
074: * Gets the Method attribute of the RenameParameterTransform object
075: *
076: *@return The Method value
077: */
078: public MethodSummary getMethod() {
079: return method;
080: }
081:
082: /**
083: * Gets the Parameter attribute of the RenameParameterTransform object
084: *
085: *@return The Parameter value
086: */
087: public ParameterSummary getParameter() {
088: return param;
089: }
090:
091: /**
092: * Gets the NewName attribute of the RenameParameterTransform object
093: *
094: *@return The NewName value
095: */
096: public String getNewName() {
097: return newName;
098: }
099:
100: /**
101: * Gets the RightTree attribute of the RenameParameterTransform object
102: *
103: *@return The RightTree value
104: */
105: public boolean isRightTree() {
106: return rightTree;
107: }
108:
109: /**
110: * Updates the name of the parameter
111: *
112: *@param root the tree to update
113: */
114: public void update(SimpleNode root) {
115: rightTree = false;
116: root.jjtAccept(new RenameParameterVisitor(method), this);
117: }
118: }
|