EMPTY_RANGE, 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() |
createDiagnostic
computeRanges, getLine, getLineCount, getRanges, makeKToIJ, setLines
public 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 Input
public 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 Input
Token
public int getLineNumber(int inputPosition)
Input
getLineNumber
in class Input
public int getColumnNumber(int inputPosition)
Input
getColumnNumber
in class Input
public void setCompilationUnit(org.openjdk.tools.javac.tree.JCTree.JCCompilationUnit unit)
public RangeSet<Integer> characterRangesToTokenRanges(Collection<Range<Integer>> characterRanges) throws FormatterException
FormatterException
Copyright © 2015–2017 Google Inc.. All rights reserved.