Package com.google.googlejavaformat
Class InputOutput
- java.lang.Object
-
- com.google.googlejavaformat.InputOutput
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.google.common.collect.Range<java.lang.Integer>EMPTY_RANGEprivate static com.google.common.collect.DiscreteDomain<java.lang.Integer>INTEGERSprivate com.google.common.collect.ImmutableList<java.lang.String>linesprotected java.util.List<com.google.common.collect.Range<java.lang.Integer>>rangesTheRanges of the tokens or comments lying on each line, in any part.
-
Constructor Summary
Constructors Constructor Description InputOutput()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidaddToRanges(java.util.List<com.google.common.collect.Range<java.lang.Integer>> ranges, int i, int k)protected voidcomputeRanges(java.util.List<? extends Input.Tok> toks)java.lang.StringgetLine(int lineI)Get a line.intgetLineCount()Get the line count.com.google.common.collect.Range<java.lang.Integer>getRanges(int lineI)Get theRangeofInput.Toks lying in any part on a line.static java.util.Map<java.lang.Integer,com.google.common.collect.Range<java.lang.Integer>>makeKToIJ(InputOutput put)Given anInputOutput, compute the map from tok indices to line ranges.protected voidsetLines(com.google.common.collect.ImmutableList<java.lang.String> lines)Set the lines.java.lang.StringtoString()
-
-
-
Field Detail
-
lines
private com.google.common.collect.ImmutableList<java.lang.String> lines
-
EMPTY_RANGE
protected static final com.google.common.collect.Range<java.lang.Integer> EMPTY_RANGE
-
INTEGERS
private static final com.google.common.collect.DiscreteDomain<java.lang.Integer> INTEGERS
-
ranges
protected final java.util.List<com.google.common.collect.Range<java.lang.Integer>> ranges
TheRanges of the tokens or comments lying on each line, in any part.
-
-
Method Detail
-
setLines
protected final void setLines(com.google.common.collect.ImmutableList<java.lang.String> lines)
Set the lines.
-
getLineCount
public final int getLineCount()
Get the line count.- Returns:
- the line count
-
getLine
public final java.lang.String getLine(int lineI)
Get a line.- Parameters:
lineI- the line number- Returns:
- the line
-
addToRanges
private static void addToRanges(java.util.List<com.google.common.collect.Range<java.lang.Integer>> ranges, int i, int k)
-
computeRanges
protected final void computeRanges(java.util.List<? extends Input.Tok> toks)
-
makeKToIJ
public static java.util.Map<java.lang.Integer,com.google.common.collect.Range<java.lang.Integer>> makeKToIJ(InputOutput put)
Given anInputOutput, compute the map from tok indices to line ranges.- Parameters:
put- theInputOutput- Returns:
- the map from
com.google.googlejavaformat.java.JavaInput.Tokindices to line ranges in thisput
-
getRanges
public final com.google.common.collect.Range<java.lang.Integer> getRanges(int lineI)
Get theRangeofInput.Toks lying in any part on a line.- Parameters:
lineI- the line number- Returns:
- the
RangeofInput.Toks on the specified line
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-