Class Doc.Space

  • All Implemented Interfaces:
    Op
    Enclosing class:
    Doc

    static final class Doc.Space
    extends Doc
    implements Op
    A Leaf node in a Doc for a non-breaking space.
    • Field Detail

      • SPACE

        private static final Doc.Space SPACE
    • Constructor Detail

      • Space

        private Space()
    • Method Detail

      • make

        static Doc.Space make()
        Factor method for Space.
        Returns:
        the new Space
      • add

        public void add​(DocBuilder builder)
        Description copied from interface: Op
        Add an Op to a DocBuilder.
        Specified by:
        add in interface Op
        Parameters:
        builder - the DocBuilder
      • computeWidth

        int computeWidth()
        Description copied from class: Doc
        Compute the Doc's width.
        Specified by:
        computeWidth in class Doc
        Returns:
        the width
      • computeFlat

        java.lang.String computeFlat()
        Description copied from class: Doc
        Compute the Doc's flat value. Not defined (and never called) if contains forced breaks.
        Specified by:
        computeFlat in class Doc
        Returns:
        the flat value
      • computeRange

        com.google.common.collect.Range<java.lang.Integer> computeRange()
        Description copied from class: Doc
        Compute the Doc's Range of Input.Tokens.
        Specified by:
        computeRange in class Doc
        Returns:
        the Range
      • computeBreaks

        public Doc.State computeBreaks​(CommentsHelper commentsHelper,
                                       int maxWidth,
                                       Doc.State state)
        Description copied from class: Doc
        Make breaking decisions for a Doc.
        Specified by:
        computeBreaks in class Doc
        maxWidth - the maximum line width
        state - the current output state
        Returns:
        the new output state
      • write

        public void write​(Output output)
        Description copied from class: Doc
        Write a Doc to an Output, after breaking decisions have been made.
        Specified by:
        write in class Doc
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object