public class CodeSnipitLocater extends Object
NodeComparator.| Constructor and Description |
|---|
CodeSnipitLocater() |
| Modifier and Type | Method and Description |
|---|---|
LinkedHashMap<CodeSnipitLocation,CodeSnipitLocation> |
locate(com.github.javaparser.ast.CompilationUnit existingCode,
com.github.javaparser.ast.Node newCode)
Receives two
CompilationUnits and determines the location of a package, imports, fields, constructors, methods or inner classes. |
protected LinkedHashMap<CodeSnipitLocation,CodeSnipitLocation> |
recursiveLocator(List<com.github.javaparser.ast.Node> existingNodes,
List<com.github.javaparser.ast.Node> insertNodes)
Calculates the insertion locations for the insertNodes within the existingNodes.
|
public LinkedHashMap<CodeSnipitLocation,CodeSnipitLocation> locate(com.github.javaparser.ast.CompilationUnit existingCode, com.github.javaparser.ast.Node newCode)
CompilationUnits and determines the location of a package, imports, fields, constructors, methods or inner classes. This method will
retain the order of Nodes in both existing and new code. It can therefore happen that not all nodes are ordered according to the NodeComparator if
the inserted code was also not ordered like that.existingCode - CompilationUnit representing the existing classnewCode - CompilationUnit representing the code to be addedLinkedHashMap with as keys a CodeSnipitLocation of code to be added and as value a CodeSnipitLocation where in the
existing class the code should be added. The map is ordered on increasing insert locations (map values).protected LinkedHashMap<CodeSnipitLocation,CodeSnipitLocation> recursiveLocator(List<com.github.javaparser.ast.Node> existingNodes, List<com.github.javaparser.ast.Node> insertNodes)
existingNodes - The nodes from the existing class. May not be empty.insertNodes - The nodes from the class to be inserted. May not be empty.Copyright © 2019. All rights reserved.