EMPTY_RANGE, range0s, range1s, ranges| Constructor and Description |
|---|
JavaInput(String text)
Input constructor.
|
| Modifier and Type | Method and Description |
|---|---|
RangeSet<Integer> |
characterRangesToTokenRanges(Collection<Range<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.
|
ImmutableMap<Integer,Integer> |
getPositionToColumnMap() |
ImmutableRangeMap<Integer,com.google.googlejavaformat.java.JavaInput.Token> |
getPositionTokenMap()
Get the navigable map from position to
Token. |
String |
getText()
Get the input text.
|
ImmutableList<? extends Input.Token> |
getTokens()
Get the input tokens.
|
void |
setCompilationUnit(org.openjdk.tools.javac.tree.JCTree.JCCompilationUnit unit) |
String |
toString() |
createDiagnosticcomputeRanges, getLine, getLineCount, getRange0s, getRange1s, getRanges, makeKToIJ, setLinespublic JavaInput(String text) throws FormatterException
text - the input textFormatterException - if the input cannot be parsedpublic String getText()
public ImmutableMap<Integer,Integer> getPositionToColumnMap()
getPositionToColumnMap in class Inputpublic ImmutableList<? extends Input.Token> getTokens()
public ImmutableRangeMap<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 RangeSet<Integer> characterRangesToTokenRanges(Collection<Range<Integer>> characterRanges) throws FormatterException
FormatterExceptionCopyright © 2015–2017 Google Inc.. All rights reserved.