EMPTY_RANGE, ranges| Constructor and Description |
|---|
JavaInput(java.lang.String text)
Input constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.RangeSet<java.lang.Integer> |
characterRangesToTokenRanges(java.util.Collection<com.google.common.collect.Range<java.lang.Integer>> characterRanges) |
int |
getColumnNumber(int inputPosition)
Converts a character offset in the input to a 0-based column number.
|
int |
getLineNumber(int inputPosition)
Converts a character offset in the input to a line number.
|
com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.Integer> |
getPositionToColumnMap() |
com.google.common.collect.ImmutableRangeMap<java.lang.Integer,com.google.googlejavaformat.java.JavaInput.Token> |
getPositionTokenMap()
Get the navigable map from position to
Token. |
java.lang.String |
getText()
Get the input text.
|
com.google.common.collect.ImmutableList<? extends Input.Token> |
getTokens()
Get the input tokens.
|
void |
setCompilationUnit(org.openjdk.tools.javac.tree.JCTree.JCCompilationUnit unit) |
java.lang.String |
toString() |
createDiagnosticcomputeRanges, getLine, getLineCount, getRanges, makeKToIJ, setLinespublic JavaInput(java.lang.String text)
throws FormatterException
text - the input textFormatterException - if the input cannot be parsedpublic java.lang.String getText()
public com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.Integer> getPositionToColumnMap()
getPositionToColumnMap in class Inputpublic com.google.common.collect.ImmutableList<? extends Input.Token> getTokens()
public com.google.common.collect.ImmutableRangeMap<java.lang.Integer,com.google.googlejavaformat.java.JavaInput.Token> getPositionTokenMap()
Token. Used to look for tokens following a given
one, and to implement the --offset and --length flags to reformat a character range in the
input file.getPositionTokenMap in class InputTokenpublic int getLineNumber(int inputPosition)
InputgetLineNumber in class Inputpublic int getColumnNumber(int inputPosition)
InputgetColumnNumber in class Inputpublic void setCompilationUnit(org.openjdk.tools.javac.tree.JCTree.JCCompilationUnit unit)
public com.google.common.collect.RangeSet<java.lang.Integer> characterRangesToTokenRanges(java.util.Collection<com.google.common.collect.Range<java.lang.Integer>> characterRanges)
throws FormatterException
FormatterExceptionCopyright © 2015-2018 Google Inc.. All Rights Reserved.