public int findMaxPosition(int fromIndex, int toIndex) { this.counter = Aligner.this.tm.getPositionInLine(fromIndex); this.stoppingIndex = toIndex; this.maxPosition = 0; Aligner.this.tm.traverse(fromIndex, this); return this.maxPosition; } }
public int findMaxPosition(int fromIndex, int toIndex) { this.counter = FieldAligner.this.tm.getPositionInLine(fromIndex); this.stoppingIndex = toIndex; this.maxPosition = 0; FieldAligner.this.tm.traverse(fromIndex, this); return this.maxPosition; } }
public int findMaxPosition(int fromIndex, int toIndex) { this.counter = FieldAligner.this.tm.getPositionInLine(fromIndex); this.stoppingIndex = toIndex; this.maxPosition = 0; FieldAligner.this.tm.traverse(fromIndex, this); return this.maxPosition; } }
@Override protected boolean token(Token token, int index) { if (index == this.stoppingIndex) return false; if (getLineBreaksBefore() > 0) this.counter = Aligner.this.tm.getPositionInLine(index); if (token.getAlign() > 0) this.counter = token.getAlign(); this.counter += Aligner.this.tm.getLength(token, this.counter); if (isSpaceAfter() && getLineBreaksAfter() == 0) this.counter++; this.maxPosition = Math.max(this.maxPosition, this.counter); return true; }
currentPositionInLine = this.tm.toIndent(token.getIndent(), token.getWrapPolicy() != null); } else { currentPositionInLine = this.tm.getPositionInLine(index - 1); currentPositionInLine += this.tm.getLength(this.tm.get(index - 1), currentPositionInLine);
@Override protected boolean token(Token token, int index) { if (index == this.stoppingIndex) return false; if (getLineBreaksBefore() > 0) this.counter = FieldAligner.this.tm.getPositionInLine(index); if (token.getAlign() > 0) this.counter = token.getAlign(); this.counter += FieldAligner.this.tm.getLength(token, this.counter); if (isSpaceAfter() && getLineBreaksAfter() == 0) this.counter++; this.maxPosition = Math.max(this.maxPosition, this.counter); return true; }
@Override protected boolean token(Token token, int index) { if (index == this.stoppingIndex) return false; if (getLineBreaksBefore() > 0) this.counter = FieldAligner.this.tm.getPositionInLine(index); if (token.getAlign() > 0) this.counter = token.getAlign(); this.counter += FieldAligner.this.tm.getLength(token, this.counter); if (isSpaceAfter() && getLineBreaksAfter() == 0) this.counter++; this.maxPosition = Math.max(this.maxPosition, this.counter); return true; }
currentPositionInLine = this.tm.toIndent(token.getIndent(), token.getWrapPolicy() != null); } else { currentPositionInLine = this.tm.getPositionInLine(index - 1); currentPositionInLine += this.tm.getLength(this.tm.get(index - 1), currentPositionInLine);
currentPositionInLine = this.tm.toIndent(token.getIndent(), token.getWrapPolicy() != null); } else { currentPositionInLine = this.tm.getPositionInLine(index - 1); currentPositionInLine += this.tm.getLength(this.tm.get(index - 1), currentPositionInLine);
breakIndexes.add(closeBraceIndex); Token prev = this.tm.get(openBraceIndex); int startPos = this.tm.getPositionInLine(openBraceIndex); int pos = startPos + this.tm.getLength(prev, startPos); for (int i = openBraceIndex + 1; i <= lastIndex; i++) {
SimpleName fieldName = fragments.get(0).getName(); int nameIndex = this.tm.firstIndexIn(fieldName, TokenNameIdentifier); int positionInLine = this.tm.getPositionInLine(nameIndex); maxNameAlign = Math.max(maxNameAlign, positionInLine); int positionInLine = this.tm.getPositionInLine(equalIndex); maxAssignAlign = Math.max(maxAssignAlign, positionInLine);
SimpleName fieldName = fragments.get(0).getName(); int nameIndex = this.tm.firstIndexIn(fieldName, TokenNameIdentifier); int positionInLine = this.tm.getPositionInLine(nameIndex); maxNameAlign = Math.max(maxNameAlign, positionInLine); int positionInLine = this.tm.getPositionInLine(equalIndex); maxAssignAlign = Math.max(maxAssignAlign, positionInLine);
private void wrapComments() { CommentWrapExecutor commentWrapper = new CommentWrapExecutor(this.tm, this.options); boolean isNLSTagInLine = false; for (int i = 0; i < this.tm.size(); i++) { Token token = this.tm.get(i); if (token.getLineBreaksBefore() > 0 || token.getLineBreaksAfter() > 0) isNLSTagInLine = false; if (token.hasNLSTag()) { assert token.tokenType == TokenNameStringLiteral; isNLSTagInLine = true; } List<Token> structure = token.getInternalStructure(); if (structure != null && !structure.isEmpty() && !isNLSTagInLine) { int startPosition = this.tm.getPositionInLine(i); if (token.tokenType == TokenNameCOMMENT_LINE) { commentWrapper.wrapLineComment(token, startPosition); } else { assert token.tokenType == TokenNameCOMMENT_BLOCK || token.tokenType == TokenNameCOMMENT_JAVADOC; commentWrapper.wrapMultiLineComment(token, startPosition, false, false); } } } }
private void wrapComments() { CommentWrapExecutor commentWrapper = new CommentWrapExecutor(this.tm, this.options); boolean isNLSTagInLine = false; for (int i = 0; i < this.tm.size(); i++) { Token token = this.tm.get(i); if (token.getLineBreaksBefore() > 0 || token.getLineBreaksAfter() > 0) isNLSTagInLine = false; if (token.hasNLSTag()) { assert token.tokenType == TokenNameStringLiteral; isNLSTagInLine = true; } List<Token> structure = token.getInternalStructure(); if (structure != null && !structure.isEmpty() && !isNLSTagInLine) { int startPosition = this.tm.getPositionInLine(i); if (token.tokenType == TokenNameCOMMENT_LINE) { commentWrapper.wrapLineComment(token, startPosition); } else { assert token.tokenType == TokenNameCOMMENT_BLOCK || token.tokenType == TokenNameCOMMENT_JAVADOC; commentWrapper.wrapMultiLineComment(token, startPosition, false, false); } } } }
private void wrapComments() { CommentWrapExecutor commentWrapper = new CommentWrapExecutor(this.tm, this.options); boolean isNLSTagInLine = false; for (int i = 0; i < this.tm.size(); i++) { Token token = this.tm.get(i); if (token.getLineBreaksBefore() > 0 || token.getLineBreaksAfter() > 0) isNLSTagInLine = false; if (token.hasNLSTag()) { assert token.tokenType == TokenNameStringLiteral; isNLSTagInLine = true; } List<Token> structure = token.getInternalStructure(); if (structure != null && !structure.isEmpty() && !isNLSTagInLine) { int startPosition = this.tm.getPositionInLine(i); if (token.tokenType == TokenNameCOMMENT_LINE) { commentWrapper.wrapLineComment(token, startPosition); } else { assert token.tokenType == TokenNameCOMMENT_BLOCK || token.tokenType == TokenNameCOMMENT_JAVADOC; commentWrapper.wrapMultiLineComment(token, startPosition, false, false); } } } }
int getWrapIndent(Token token) { WrapPolicy policy = token.getWrapPolicy(); if (policy == null) return token.getIndent(); if (policy == WrapPolicy.FORCE_FIRST_COLUMN) return 0; Token wrapParent = this.tm.get(policy.wrapParentIndex); int wrapIndent = wrapParent.getIndent(); if (policy.indentOnColumn) { wrapIndent = this.tm.getPositionInLine(policy.wrapParentIndex); wrapIndent += this.tm.getLength(wrapParent, wrapIndent); if (wrapParent.isSpaceAfter() || this.tm.get(policy.wrapParentIndex + 1).isSpaceBefore()) wrapIndent++; } wrapIndent += policy.extraIndent; return this.tm.toIndent(wrapIndent, true); } }
int getWrapIndent(Token token) { WrapPolicy policy = token.getWrapPolicy(); if (policy == null) return token.getIndent(); if (policy == WrapPolicy.FORCE_FIRST_COLUMN) return 0; Token wrapParent = this.tm.get(policy.wrapParentIndex); int wrapIndent = wrapParent.getIndent(); if (policy.indentOnColumn) { wrapIndent = this.tm.getPositionInLine(policy.wrapParentIndex); wrapIndent += this.tm.getLength(wrapParent, wrapIndent); Token next = this.tm.get(policy.wrapParentIndex + 1); if (wrapParent.isSpaceAfter() || (next.isSpaceBefore() && !next.isComment())) wrapIndent++; } wrapIndent += policy.extraIndent; return this.tm.toIndent(wrapIndent, true); } }
int getWrapIndent(Token token) { WrapPolicy policy = token.getWrapPolicy(); if (policy == null) return token.getIndent(); if (this.options.never_indent_line_comments_on_first_column && token.tokenType == TokenNameCOMMENT_LINE && token.getIndent() == 0) return 0; if (this.options.never_indent_block_comments_on_first_column && token.tokenType == TokenNameCOMMENT_BLOCK && token.getIndent() == 0) return 0; Token wrapParent = this.tm.get(policy.wrapParentIndex); int wrapIndent = wrapParent.getIndent(); if (policy.indentOnColumn) { wrapIndent = this.tm.getPositionInLine(policy.wrapParentIndex); wrapIndent += this.tm.getLength(wrapParent, wrapIndent); if (wrapParent.isSpaceAfter() || this.tm.get(policy.wrapParentIndex + 1).isSpaceBefore()) wrapIndent++; } wrapIndent += policy.extraIndent; return this.tm.toIndent(wrapIndent, true); } }
WrapPolicy policy = this.lastLineComment.getWrapPolicy(); if (policy == null) { int lineStart = this.tm.getPositionInLine(this.tm.findFirstTokenInLine(commentIndex - 1)); int commentStart = this.tm.getPositionInLine(commentIndex - 1); policy = new WrapPolicy(WrapMode.WHERE_NECESSARY, commentIndex - 1, commentStart - lineStart);
WrapPolicy policy = this.lastLineComment.getWrapPolicy(); if (policy == null) { int lineStart = this.tm.getPositionInLine(this.tm.findFirstTokenInLine(commentIndex - 1)); int commentStart = this.tm.getPositionInLine(commentIndex - 1); policy = new WrapPolicy(WrapMode.WHERE_NECESSARY, commentIndex - 1, commentStart - lineStart);