Class InputOutput

java.lang.Object
com.google.googlejavaformat.InputOutput
Direct Known Subclasses:
Input, Output

public abstract class InputOutput extends Object
This interface defines methods common to an Input or an Output.
  • Field Details

    • EMPTY_RANGE

      protected static final com.google.common.collect.Range<Integer> EMPTY_RANGE
    • ranges

      protected final List<com.google.common.collect.Range<Integer>> ranges
      The Ranges of the tokens or comments lying on each line, in any part.
  • Constructor Details

    • InputOutput

      public InputOutput()
  • Method Details

    • setLines

      protected final void setLines(com.google.common.collect.ImmutableList<String> lines)
      Set the lines.
    • getLineCount

      public final int getLineCount()
      Get the line count.
      Returns:
      the line count
    • getLine

      public final String getLine(int lineI)
      Get a line.
      Parameters:
      lineI - the line number
      Returns:
      the line
    • computeRanges

      protected final void computeRanges(List<? extends Input.Tok> toks)
    • makeKToIJ

      public static Map<Integer,com.google.common.collect.Range<Integer>> makeKToIJ(InputOutput put)
      Given an InputOutput, compute the map from tok indices to line ranges.
      Parameters:
      put - the InputOutput
      Returns:
      the map from com.google.googlejavaformat.java.JavaInput.Tok indices to line ranges in this put
    • getRanges

      public final com.google.common.collect.Range<Integer> getRanges(int lineI)
      Get the Range of Input.Toks lying in any part on a line.
      Parameters:
      lineI - the line number
      Returns:
      the Range of Input.Toks on the specified line
    • toString

      public String toString()
      Overrides:
      toString in class Object