Class DifferenceElementCalculator
- java.lang.Object
-
- com.github.javaparser.printer.lexicalpreservation.DifferenceElementCalculator
-
class DifferenceElementCalculator extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDifferenceElementCalculator.ChildPositionInfo
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.List<DifferenceElement>>cache
-
Constructor Summary
Constructors Constructor Description DifferenceElementCalculator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.List<DifferenceElement>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 java.util.List<DifferenceElement>calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)private java.util.List<DifferenceElement>calculateImpl2(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)private intconsiderRemoval(CsmElement removedElement, int originalIndex, java.util.List<DifferenceElement> elements)private voidconsiderRemoval(NodeText nodeTextForChild, java.util.List<DifferenceElement> elements)private longcost(java.util.List<DifferenceElement> elements)private java.util.List<DifferenceElementCalculator.ChildPositionInfo>findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)Find the positions of all the given children.(package private) static booleanmatching(CsmElement a, CsmElement b)(package private) static voidremoveIndentationElements(java.util.List<DifferenceElement> elements)Remove from the difference all the elements related to indentation.private booleanreplacement(CsmElement a, CsmElement b)
-
-
-
Field Detail
-
cache
private java.util.Map<java.lang.String,java.util.List<DifferenceElement>> cache
-
-
Method Detail
-
matching
static boolean matching(CsmElement a, CsmElement b)
-
removeIndentationElements
static void removeIndentationElements(java.util.List<DifferenceElement> elements)
Remove from the difference all the elements related to indentation. This is mainly intended for test purposes.
-
replacement
private boolean replacement(CsmElement a, CsmElement b)
-
findChildrenPositions
private java.util.List<DifferenceElementCalculator.ChildPositionInfo> findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)
Find the positions of all the given children.
-
calculate
java.util.List<DifferenceElement> 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.
-
considerRemoval
private void considerRemoval(NodeText nodeTextForChild, java.util.List<DifferenceElement> elements)
-
considerRemoval
private int considerRemoval(CsmElement removedElement, int originalIndex, java.util.List<DifferenceElement> elements)
-
calculateImpl
private java.util.List<DifferenceElement> calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)
-
calculateImpl2
private java.util.List<DifferenceElement> calculateImpl2(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)
-
cost
private long cost(java.util.List<DifferenceElement> elements)
-
-