Class Doc.Break

java.lang.Object
com.google.googlejavaformat.Doc
com.google.googlejavaformat.Doc.Break
All Implemented Interfaces:
Op
Enclosing class:
Doc

public static final class Doc.Break extends Doc implements Op
A leaf node in a Doc for an optional break.
  • Method Details

    • make

      public static Doc.Break make(Doc.FillMode fillMode, String flat, Indent plusIndent)
      Make a Break.
      Parameters:
      fillMode - the Doc.FillMode
      flat - the text when not broken
      plusIndent - extra indent if taken
      Returns:
      the new Break
    • make

      public static Doc.Break make(Doc.FillMode fillMode, String flat, Indent plusIndent, Optional<Output.BreakTag> optTag)
      Make a Break.
      Parameters:
      fillMode - the Doc.FillMode
      flat - the text when not broken
      plusIndent - extra indent if taken
      optTag - an optional tag for remembering whether the break was taken
      Returns:
      the new Break
    • makeForced

      public static Doc.Break makeForced()
      Make a forced Break.
      Returns:
      the new forced Break
    • 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
    • computeBreaks

      public Doc.State computeBreaks(Doc.State state, int lastIndent, boolean broken)
    • 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
      Parameters:
      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 String toString()
      Overrides:
      toString in class Object