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() |
createDiagnostic
computeRanges, getLine, getLineCount, getRanges, makeKToIJ, setLines
public 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 Input
public 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 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 com.google.common.collect.RangeSet<java.lang.Integer> characterRangesToTokenRanges(java.util.Collection<com.google.common.collect.Range<java.lang.Integer>> characterRanges) throws FormatterException
FormatterException
Copyright © 2015-2018 Google Inc.. All Rights Reserved.