astcentric.structure.transformation
Class CreateNode

java.lang.Object
  extended by astcentric.structure.transformation.AbstractTransformation
      extended by astcentric.structure.transformation.CreateNode
All Implemented Interfaces:
Transformation

public class CreateNode
extends AbstractTransformation

Transformation which creates a new plain Node in an AST.


Field Summary
 
Fields inherited from class astcentric.structure.transformation.AbstractTransformation
_ast
 
Constructor Summary
CreateNode(AST ast, Node parent, int childIndex)
          Creates an instance for the specified AST, parent node, and child index.
 
Method Summary
 void transform(ScratchPad scratchPad, Feedback feedback)
          Performs the transformation.
 void undo()
          Reverts the transformation performed by the transform method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateNode

public CreateNode(AST ast,
                  Node parent,
                  int childIndex)
Creates an instance for the specified AST, parent node, and child index.

Parameters:
ast - A non-null unsealed AST object.
parent - The parent node. Can be null if the root should be created.
childIndex - Index of the child to be created.
Method Detail

transform

public void transform(ScratchPad scratchPad,
                      Feedback feedback)
Description copied from interface: Transformation
Performs the transformation.

Parameters:
scratchPad - Scratch pad for objects needed between different transformations (e.g. copy-paste). Can be null if not needed. Implementations who need a scratch pad should throw an IllegalArgumentException if missing.
feedback - Call-back object for user feedback. Can be null.

undo

public void undo()
Description copied from interface: Transformation
Reverts the transformation performed by the transform method. After undoing the states of AST and ScratchPad have to be the same as before invoking transform().