Class Level


public final class Level extends Doc
A Level inside a Doc.
  • Method Details

    • computeWidth

      protected float computeWidth()
      Description copied from class: Doc
      Compute the Doc's width.
      Specified by:
      computeWidth in class Doc
      Returns:
      the width, or Float.POSITIVE_INFINITY if it must be broken
    • computeFlat

      protected 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

      protected com.google.common.collect.Range<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 State computeBreaks(CommentsHelper commentsHelper, int maxWidth, State state, Obs.ExplorationNode observer)
      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(State state, 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
    • getPlusIndent

      public Indent getPlusIndent()
    • partialInlineability

      public PartialInlineability partialInlineability()
    • getDebugName

      public Optional<String> getDebugName()
    • getOpenOp

      public OpenOp getOpenOp()
    • getColumnLimitBeforeLastBreak

      public OptionalInt getColumnLimitBeforeLastBreak()
      An optional, more restrictive column limit for inner breaks that are marked as Break.hasColumnLimit(). If the level is to be considered one-lineable, the last such break must not start at a column higher than this.
    • representation

      public String representation(State state)
      An indented representation of this level and all nested levels inside it.
    • toString

      public String toString()
      Overrides:
      toString in class Object