public class Difference
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Difference.Added |
(package private) static interface |
Difference.DifferenceElement |
private static class |
Difference.Kept |
private static class |
Difference.Removed |
private static class |
Difference.Reshuffled
Elements in a CsmMix have been reshuffled.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<Difference.DifferenceElement> |
elements |
private static int |
STANDARD_INDENTATION_SIZE |
Modifier | Constructor and Description |
---|---|
private |
Difference(java.util.List<Difference.DifferenceElement> elements) |
Modifier and Type | Method and Description |
---|---|
private int |
adjustIndentation(java.util.List<TokenTextElement> indentation,
NodeText nodeText,
int nodeTextIndex,
boolean followedByUnindent) |
(package private) void |
apply(NodeText nodeText,
Node node)
Node that we have calculate the Difference we can apply to a concrete NodeText, modifying it according
to the difference (adding and removing the elements provided).
|
(package private) static Difference |
calculate(LexicalDifferenceCalculator.CalculatedSyntaxModel original,
LexicalDifferenceCalculator.CalculatedSyntaxModel after)
Calculate the Difference between two CalculatedSyntaxModel elements, determining which elements were kept,
which were added and which were removed.
|
private static Difference |
calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original,
LexicalDifferenceCalculator.CalculatedSyntaxModel after) |
private int |
considerCleaningTheLine(NodeText nodeText,
int nodeTextIndex) |
private int |
considerEnforcingIndentation(NodeText nodeText,
int nodeTextIndex)
If we are at the beginning of a line, with just spaces or tabs before us we should force the space to be
the same as the indentation.
|
private long |
cost() |
private static java.util.Map<Node,java.lang.Integer> |
findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)
Find the positions of all the given children.
|
private int |
findIndexOfCorrespondingNodeTextElement(CsmElement csmElement,
NodeText nodeText,
int startIndex,
java.util.Set<java.lang.Integer> usedIndexes,
Node node) |
java.util.List<Difference.DifferenceElement> |
getElements() |
private java.util.List<TextElement> |
indentationBlock() |
private boolean |
isAfterLBrace(NodeText nodeText,
int nodeTextIndex) |
private boolean |
isAReplacement(int diffIndex) |
private boolean |
isPrimitiveType(TextElement textElement) |
private static boolean |
matching(CsmElement a,
CsmElement b) |
private java.util.List<TextElement> |
processIndentation(java.util.List<TokenTextElement> indentation,
java.util.List<TextElement> prevElements) |
(package private) void |
removeIndentationElements()
Remove from the difference all the elements related to indentation.
|
private static boolean |
replacement(CsmElement a,
CsmElement b) |
java.lang.String |
toString() |
private TextElement |
toTextElement(LexicalPreservingPrinter lpp,
CsmElement csmElement) |
private static final int STANDARD_INDENTATION_SIZE
private final java.util.List<Difference.DifferenceElement> elements
private Difference(java.util.List<Difference.DifferenceElement> elements)
private static boolean matching(CsmElement a, CsmElement b)
private static boolean replacement(CsmElement a, CsmElement b)
private static java.util.Map<Node,java.lang.Integer> findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)
static Difference calculate(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)
private static Difference calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)
private TextElement toTextElement(LexicalPreservingPrinter lpp, CsmElement csmElement)
private java.util.List<TextElement> processIndentation(java.util.List<TokenTextElement> indentation, java.util.List<TextElement> prevElements)
private java.util.List<TextElement> indentationBlock()
private int considerCleaningTheLine(NodeText nodeText, int nodeTextIndex)
private boolean isAfterLBrace(NodeText nodeText, int nodeTextIndex)
private int considerEnforcingIndentation(NodeText nodeText, int nodeTextIndex)
void apply(NodeText nodeText, Node node)
private int findIndexOfCorrespondingNodeTextElement(CsmElement csmElement, NodeText nodeText, int startIndex, java.util.Set<java.lang.Integer> usedIndexes, Node node)
private int adjustIndentation(java.util.List<TokenTextElement> indentation, NodeText nodeText, int nodeTextIndex, boolean followedByUnindent)
private boolean isAReplacement(int diffIndex)
private boolean isPrimitiveType(TextElement textElement)
private long cost()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<Difference.DifferenceElement> getElements()
void removeIndentationElements()