org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite
Class RewriteEventStore

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite.RewriteEventStore

public final class RewriteEventStore
extends java.lang.Object

Stores all rewrite events, descriptions of events and knows which nodes are copy or move sources or tracked.


Nested Class Summary
static class RewriteEventStore.CopySourceInfo
           
static interface RewriteEventStore.INodePropertyMapper
          Interface that allows to override the way how children are accessed from a parent.
static class RewriteEventStore.PropertyLocation
           
 
Field Summary
static int BOTH
           
static int NEW
           
static int ORIGINAL
           
 
Constructor Summary
RewriteEventStore()
           
 
Method Summary
 void addEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, RewriteEvent event)
           
 void clear()
           
 RewriteEventStore.CopySourceInfo createRangeCopy(ASTNode parent, StructuralPropertyDescriptor childProperty, ASTNode first, ASTNode last, boolean isMove, ASTNode internalPlaceholder, ASTNode replacingNode, TextEditGroup editGroup)
           
 RewriteEvent findEvent(java.lang.Object value, int kind)
          Kind is either ORIGINAL, NEW, or BOTH
 java.util.List getChangedPropertieEvents(ASTNode parent)
           
 int getChangeKind(ASTNode node)
           
 java.util.Iterator getChangeRootIterator()
           
 RewriteEvent getEvent(ASTNode parent, StructuralPropertyDescriptor property)
           
 TextEditGroup getEventEditGroup(RewriteEvent event)
           
 ListRewriteEvent getListEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation)
           
 java.lang.Object getNewValue(ASTNode parent, StructuralPropertyDescriptor property)
           
 RewriteEventStore.CopySourceInfo[] getNodeCopySources(ASTNode node)
           
 NodeRewriteEvent getNodeEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation)
           
 java.lang.Object getOriginalValue(ASTNode parent, StructuralPropertyDescriptor property)
           
 RewriteEventStore.PropertyLocation getPropertyLocation(java.lang.Object value, int kind)
           
 TextEditGroup getTrackedNodeData(ASTNode node)
           
 boolean hasChangedProperties(ASTNode parent)
           
 RewriteEventStore.CopySourceInfo[] internalGetCopySources(java.util.List copySources, ASTNode node)
           
 boolean isInsertBoundToPrevious(ASTNode node)
           
static boolean isNewNode(ASTNode node)
           
 boolean isRangeCopyPlaceholder(ASTNode node)
           
 RewriteEventStore.CopySourceInfo markAsCopySource(ASTNode parent, StructuralPropertyDescriptor property, ASTNode node, boolean isMove)
           
 void markAsTracked(ASTNode node, TextEditGroup editGroup)
          Marks a node as tracked.
 void prepareMovedNodes(TargetSourceRangeComputer sourceRangeComputer)
           
 void revertMovedNodes()
           
 void setEventEditGroup(RewriteEvent event, TextEditGroup editGroup)
           
 void setInsertBoundToPrevious(ASTNode node)
           
 void setNodePropertyMapper(RewriteEventStore.INodePropertyMapper nodePropertyMapper)
          Override the default way how to access children from a parent node.
 void setTrackedNodeData(ASTNode node, TextEditGroup editGroup)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEW

public static final int NEW
See Also:
Constant Field Values

ORIGINAL

public static final int ORIGINAL
See Also:
Constant Field Values

BOTH

public static final int BOTH
See Also:
Constant Field Values
Constructor Detail

RewriteEventStore

public RewriteEventStore()
Method Detail

setNodePropertyMapper

public void setNodePropertyMapper(RewriteEventStore.INodePropertyMapper nodePropertyMapper)
Override the default way how to access children from a parent node.

Parameters:
nodePropertyMapper - The new INodePropertyMapper or null. to use the default.

clear

public void clear()

addEvent

public void addEvent(ASTNode parent,
                     StructuralPropertyDescriptor childProperty,
                     RewriteEvent event)

getEvent

public RewriteEvent getEvent(ASTNode parent,
                             StructuralPropertyDescriptor property)

getNodeEvent

public NodeRewriteEvent getNodeEvent(ASTNode parent,
                                     StructuralPropertyDescriptor childProperty,
                                     boolean forceCreation)

getListEvent

public ListRewriteEvent getListEvent(ASTNode parent,
                                     StructuralPropertyDescriptor childProperty,
                                     boolean forceCreation)

getChangeRootIterator

public java.util.Iterator getChangeRootIterator()

hasChangedProperties

public boolean hasChangedProperties(ASTNode parent)

getPropertyLocation

public RewriteEventStore.PropertyLocation getPropertyLocation(java.lang.Object value,
                                                              int kind)

findEvent

public RewriteEvent findEvent(java.lang.Object value,
                              int kind)
Kind is either ORIGINAL, NEW, or BOTH

Parameters:
value -
kind -
Returns:
Returns the event with the given value of null.

getOriginalValue

public java.lang.Object getOriginalValue(ASTNode parent,
                                         StructuralPropertyDescriptor property)

getNewValue

public java.lang.Object getNewValue(ASTNode parent,
                                    StructuralPropertyDescriptor property)

getChangedPropertieEvents

public java.util.List getChangedPropertieEvents(ASTNode parent)

getChangeKind

public int getChangeKind(ASTNode node)

getEventEditGroup

public TextEditGroup getEventEditGroup(RewriteEvent event)

setEventEditGroup

public void setEventEditGroup(RewriteEvent event,
                              TextEditGroup editGroup)

getTrackedNodeData

public final TextEditGroup getTrackedNodeData(ASTNode node)

setTrackedNodeData

public void setTrackedNodeData(ASTNode node,
                               TextEditGroup editGroup)

markAsTracked

public final void markAsTracked(ASTNode node,
                                TextEditGroup editGroup)
Marks a node as tracked. The edits added to the group editGroup can be used to get the position of the node after the rewrite operation.

Parameters:
node - The node to track
editGroup - Collects the range markers describing the node position.

markAsCopySource

public final RewriteEventStore.CopySourceInfo markAsCopySource(ASTNode parent,
                                                               StructuralPropertyDescriptor property,
                                                               ASTNode node,
                                                               boolean isMove)

isRangeCopyPlaceholder

public final boolean isRangeCopyPlaceholder(ASTNode node)

createRangeCopy

public final RewriteEventStore.CopySourceInfo createRangeCopy(ASTNode parent,
                                                              StructuralPropertyDescriptor childProperty,
                                                              ASTNode first,
                                                              ASTNode last,
                                                              boolean isMove,
                                                              ASTNode internalPlaceholder,
                                                              ASTNode replacingNode,
                                                              TextEditGroup editGroup)

getNodeCopySources

public RewriteEventStore.CopySourceInfo[] getNodeCopySources(ASTNode node)

internalGetCopySources

public RewriteEventStore.CopySourceInfo[] internalGetCopySources(java.util.List copySources,
                                                                 ASTNode node)

prepareMovedNodes

public void prepareMovedNodes(TargetSourceRangeComputer sourceRangeComputer)

revertMovedNodes

public void revertMovedNodes()

isInsertBoundToPrevious

public boolean isInsertBoundToPrevious(ASTNode node)

setInsertBoundToPrevious

public void setInsertBoundToPrevious(ASTNode node)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isNewNode

public static boolean isNewNode(ASTNode node)