org.electrocodeogram.cpc.core.api.provider.track
Class CPCDocumentEvent

java.lang.Object
  extended by org.electrocodeogram.cpc.core.api.provider.track.CPCDocumentEvent

public class CPCDocumentEvent
extends java.lang.Object

A CPCDocumentEvent is similar to a DocumentEvent. However, it describes only those parts of a DocumentEvent which were located inside the corresponding clone.

I.e. depending on the IPositionUpdateStrategyProvider, a modification which only partly overlaps with a clone might not become part of the clone. The corresponding CPCDocumentEvent would therefore differ from the DocumentEvent. It would only specify the removal of characters from the clone, not the addition of new content (which didn't become part of the clone).

It is the responsibility of the IPositionUpdateStrategyProvider to create CPCDocumentEvents which match its internal position updating strategies.

Author:
vw
See Also:
IPositionUpdateStrategyProvider

Field Summary
 int fLength
           
 int fOffset
           
 java.lang.String fText
           
 
Constructor Summary
CPCDocumentEvent(int offset, int length, java.lang.String text)
          Creates a new CPCDocumentEvent.
 
Method Summary
 int getLength()
          Retrieves the number of removed characters which were part of the clone.
 int getOffset()
          Retrieves the relative position to beginning of clone.
 java.lang.String getText()
          Retrieves the newly inserted text which became part of the clone.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fOffset

public int fOffset
See Also:
getOffset()

fLength

public int fLength
See Also:
getLength()

fText

public java.lang.String fText
See Also:
getText()
Constructor Detail

CPCDocumentEvent

public CPCDocumentEvent(int offset,
                        int length,
                        java.lang.String text)
Creates a new CPCDocumentEvent.

Parameters:
offset - relative position to beginning of clone, always >= 0.
length - number of removed characters which were part of the clone, always >= 0.
text - newly inserted text which became part of the clone, may be NULL.
Method Detail

getOffset

public int getOffset()
Retrieves the relative position to beginning of clone.

Returns:
relative position to beginning of clone, always >= 0.

getLength

public int getLength()
Retrieves the number of removed characters which were part of the clone.

Returns:
number of removed characters which were part of the clone, always >= 0.

getText

public java.lang.String getText()
Retrieves the newly inserted text which became part of the clone.

Returns:
newly inserted text which became part of the clone, may be NULL.

toString

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