Class LexicalPreservingPrinter.Observer
java.lang.Object
com.github.javaparser.ast.observer.PropagatingAstObserver
com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter.Observer
- All Implemented Interfaces:
AstObserver
- Enclosing class:
LexicalPreservingPrinter
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.javaparser.ast.observer.AstObserver
AstObserver.ListChangeType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
concreteListChange
(NodeList<?> changedList, AstObserver.ListChangeType type, int index, Node nodeAddedOrRemoved) void
concreteListReplacement
(NodeList<?> changedList, int index, Node oldValue, Node newValue) void
concretePropertyChange
(Node observedNode, ObservableProperty property, Object oldValue, Object newValue) private List
<ChildTextElement> findChildTextElementForComment
(Comment oldValue, NodeText nodeText) private List
<TokenTextElement> findTokenTextElementForComment
(Comment oldValue, NodeText nodeText) private void
fixIndentOfAddedNode
(NodeText nodeText, int index) This method inserts new space tokens at the givenindex
.private int
getIndexOfComment
(Comment oldValue, NodeText nodeText) private boolean
isCompleteLine
(List<TextElement> elements, int index) private boolean
isEqualRange
(Optional<Range> range1, Optional<Range> range2) private boolean
isSameComment
(Comment childValue, Comment oldValue) private TokenTextElement
makeCommentToken
(Comment newComment) private void
removeAllExtraCharacters
(List<TextElement> elements, int index) private void
private void
private List
<ChildTextElement> selectMatchingChildElements
(Comment oldValue, NodeText nodeText) Methods inherited from class com.github.javaparser.ast.observer.PropagatingAstObserver
listChange, listReplacement, parentChange, propertyChange, transformInPropagatingObserver
-
Constructor Details
-
Observer
private Observer()
-
-
Method Details
-
concretePropertyChange
public void concretePropertyChange(Node observedNode, ObservableProperty property, Object oldValue, Object newValue) - Overrides:
concretePropertyChange
in classPropagatingAstObserver
-
isCompleteLine
-
removeAllExtraCharacters
-
removeAllExtraCharactersBeforePosition
-
removeAllExtraCharactersStartingFrom
-
makeCommentToken
-
getIndexOfComment
-
findChildTextElementForComment
-
selectMatchingChildElements
-
isSameComment
-
findTokenTextElementForComment
-
isEqualRange
-
fixIndentOfAddedNode
This method inserts new space tokens at the givenindex
. If a new comment is added to the token list at the position followingindex
, the new comment and the node will have the same indent.- Parameters:
nodeText
- The text of the nodeindex
- The position at which the analysis should start
-
concreteListChange
public void concreteListChange(NodeList<?> changedList, AstObserver.ListChangeType type, int index, Node nodeAddedOrRemoved) - Overrides:
concreteListChange
in classPropagatingAstObserver
-
concreteListReplacement
public void concreteListReplacement(NodeList<?> changedList, int index, Node oldValue, Node newValue) - Overrides:
concreteListReplacement
in classPropagatingAstObserver
-