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
private static class LexicalPreservingPrinter.Observer extends PropagatingAstObserver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.javaparser.ast.observer.AstObserver
AstObserver.ListChangeType
-
-
Constructor Summary
Constructors Modifier Constructor Description privateObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconcreteListChange(NodeList<?> changedList, AstObserver.ListChangeType type, int index, Node nodeAddedOrRemoved)voidconcreteListReplacement(NodeList<?> changedList, int index, Node oldValue, Node newValue)voidconcretePropertyChange(Node observedNode, ObservableProperty property, java.lang.Object oldValue, java.lang.Object newValue)private java.util.List<ChildTextElement>findChildTextElementForComment(Comment oldValue, NodeText nodeText)private java.util.List<TokenTextElement>findTokenTextElementForComment(Comment oldValue, NodeText nodeText)private voidfixIndentOfAddedNode(NodeText nodeText, int index)This method inserts new space tokens at the givenindex.private intgetIndexOfComment(Comment oldValue, NodeText nodeText)private booleanisCompleteLine(java.util.List<TextElement> elements, int index)private booleanisSameComment(Comment childValue, Comment oldValue)private TokenTextElementmakeCommentToken(Comment newComment)private voidremoveAllExtraCharacters(java.util.List<TextElement> elements, int index)private voidremoveAllExtraCharactersBeforePosition(java.util.ListIterator<TextElement> iterator)private voidremoveAllExtraCharactersStartingFrom(java.util.ListIterator<TextElement> iterator)private java.util.List<ChildTextElement>selectMatchingChildElements(Comment oldValue, NodeText nodeText)-
Methods inherited from class com.github.javaparser.ast.observer.PropagatingAstObserver
listChange, listReplacement, parentChange, propertyChange, transformInPropagatingObserver
-
-
-
-
Method Detail
-
concretePropertyChange
public void concretePropertyChange(Node observedNode, ObservableProperty property, java.lang.Object oldValue, java.lang.Object newValue)
- Overrides:
concretePropertyChangein classPropagatingAstObserver
-
isCompleteLine
private boolean isCompleteLine(java.util.List<TextElement> elements, int index)
-
removeAllExtraCharacters
private void removeAllExtraCharacters(java.util.List<TextElement> elements, int index)
-
removeAllExtraCharactersBeforePosition
private void removeAllExtraCharactersBeforePosition(java.util.ListIterator<TextElement> iterator)
-
removeAllExtraCharactersStartingFrom
private void removeAllExtraCharactersStartingFrom(java.util.ListIterator<TextElement> iterator)
-
makeCommentToken
private TokenTextElement makeCommentToken(Comment newComment)
-
findChildTextElementForComment
private java.util.List<ChildTextElement> findChildTextElementForComment(Comment oldValue, NodeText nodeText)
-
selectMatchingChildElements
private java.util.List<ChildTextElement> selectMatchingChildElements(Comment oldValue, NodeText nodeText)
-
findTokenTextElementForComment
private java.util.List<TokenTextElement> findTokenTextElementForComment(Comment oldValue, NodeText nodeText)
-
fixIndentOfAddedNode
private void fixIndentOfAddedNode(NodeText nodeText, int index)
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:
concreteListChangein classPropagatingAstObserver
-
concreteListReplacement
public void concreteListReplacement(NodeList<?> changedList, int index, Node oldValue, Node newValue)
- Overrides:
concreteListReplacementin classPropagatingAstObserver
-
-