Package ghidra.program.database.code
Class StringDiff
- java.lang.Object
-
- ghidra.program.database.code.StringDiff
-
public class StringDiff extends java.lang.Object
Container object that holds a start and end position within a string. A list of StringDiffs is used to keep track of changes made to a string.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
text
String being inserted.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringDiff
allTextReplaced(java.lang.String newText)
Construct a new StringDiff with pos1 and pos2 are initialized to -1boolean
equals(java.lang.Object obj)
int
hashCode()
static StringDiff
restore(java.lang.String text, int start, int end)
static StringDiff
textDeleted(int start, int end)
Construct a new StringDiff that indicates text was deleted from pos1 to pos2static StringDiff
textInserted(java.lang.String newText, int start)
Construct a new StringDiff that indicates that insertData was inserted at the given positionjava.lang.String
toString()
-
-
-
Method Detail
-
allTextReplaced
public static StringDiff allTextReplaced(java.lang.String newText)
Construct a new StringDiff with pos1 and pos2 are initialized to -1- Parameters:
newText
- string- Returns:
- the new diff
-
textDeleted
public static StringDiff textDeleted(int start, int end)
Construct a new StringDiff that indicates text was deleted from pos1 to pos2- Parameters:
start
- position 1 for the diffend
- position 2 for the diff- Returns:
- the new diff
-
textInserted
public static StringDiff textInserted(java.lang.String newText, int start)
Construct a new StringDiff that indicates that insertData was inserted at the given position- Parameters:
newText
- inserted stringstart
- position where the text was inserted- Returns:
- the new diff
-
restore
public static StringDiff restore(java.lang.String text, int start, int end)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-