Class DifferenceElementCalculator
- java.lang.Object
-
- com.github.javaparser.printer.lexicalpreservation.DifferenceElementCalculator
-
class DifferenceElementCalculator extends java.lang.Object
-
-
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 int
considerRemoval(CsmElement removedElement, int originalIndex, java.util.List<DifferenceElement> elements)
private static void
considerRemoval(NodeText nodeTextForChild, java.util.List<DifferenceElement> elements)
private static long
cost(java.util.List<DifferenceElement> elements)
private static java.util.Map<Node,java.lang.Integer>
findChildrenPositions(LexicalDifferenceCalculator.CalculatedSyntaxModel calculatedSyntaxModel)
Find the positions of all the given children.(package private) static boolean
matching(CsmElement a, CsmElement b)
(package private) static void
removeIndentationElements(java.util.List<DifferenceElement> elements)
Remove from the difference all the elements related to indentation.private static boolean
replacement(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.Map<Node,java.lang.Integer> 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.
-
-