Class InputOutput

  • Direct Known Subclasses:
    Input, Output

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

      Fields 
      Modifier and Type Field Description
      protected static com.google.common.collect.Range<java.lang.Integer> EMPTY_RANGE  
      private static com.google.common.collect.DiscreteDomain<java.lang.Integer> INTEGERS  
      private com.google.common.collect.ImmutableList<java.lang.String> lines  
      protected java.util.List<com.google.common.collect.Range<java.lang.Integer>> ranges
      The Ranges 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 void addToRanges​(java.util.List<com.google.common.collect.Range<java.lang.Integer>> ranges, int i, int k)  
      protected void computeRanges​(java.util.List<? extends Input.Tok> toks)  
      java.lang.String getLine​(int lineI)
      Get a line.
      int getLineCount()
      Get the line count.
      com.google.common.collect.Range<java.lang.Integer> getRanges​(int lineI)
      Get the Range of Input.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 an InputOutput, compute the map from tok indices to line ranges.
      protected void setLines​(com.google.common.collect.ImmutableList<java.lang.String> lines)
      Set the lines.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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
        The Ranges of the tokens or comments lying on each line, in any part.
    • Constructor Detail

      • InputOutput

        public InputOutput()
    • 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 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<java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object