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
-
Constructor Summary
Constructors Constructor Description DifferenceElementCalculator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static 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 static java.util.List<DifferenceElement>calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)private static intconsiderRemoval(CsmElement removedElement, int originalIndex, java.util.List<DifferenceElement> elements)private static voidconsiderRemoval(NodeText nodeTextForChild, java.util.List<DifferenceElement> elements)private static longcost(java.util.List<DifferenceElement> elements)private static 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 static booleanreplacement(CsmElement a, CsmElement b)
-
-
-
Method Detail
-
matching
static boolean matching(CsmElement a, CsmElement b)
-
replacement
private static boolean replacement(CsmElement a, CsmElement b)
-
findChildrenPositions
private static java.util.List<DifferenceElementCalculator.ChildPositionInfo> findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)
Find the positions of all the given children.
-
calculate
static 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 static void considerRemoval(NodeText nodeTextForChild, java.util.List<DifferenceElement> elements)
-
considerRemoval
private static int considerRemoval(CsmElement removedElement, int originalIndex, java.util.List<DifferenceElement> elements)
-
calculateImpl
private static java.util.List<DifferenceElement> calculateImpl(LexicalDifferenceCalculator.CalculatedSyntaxModel original, LexicalDifferenceCalculator.CalculatedSyntaxModel after)
-
cost
private static long cost(java.util.List<DifferenceElement> elements)
-
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.
-
-