Module aya.pretty

Class StringPrinter<StringConfig extends StringPrinterConfig>

java.lang.Object
org.aya.pretty.backend.string.StringPrinter<StringConfig>
All Implemented Interfaces:
Cursor.CursorAPI, Printer<String,StringConfig>
Direct Known Subclasses:
DocHtmlPrinter, DocTeXPrinter

public class StringPrinter<StringConfig extends StringPrinterConfig> extends Object implements Printer<String,StringConfig>, Cursor.CursorAPI
The class for all string-output printers.
  • Field Details

  • Constructor Details

    • StringPrinter

      public StringPrinter()
  • Method Details

    • makeIndent

      @NotNull public @NotNull String makeIndent(int indent)
      Specified by:
      makeIndent in interface Cursor.CursorAPI
    • render

      @NotNull public @NotNull String render(@NotNull StringConfig config, @NotNull @NotNull Doc doc)
      Description copied from interface: Printer
      Render a Doc object with a config.
      Specified by:
      render in interface Printer<String,StringConfig extends StringPrinterConfig>
      Parameters:
      config - printer config
      doc - doc object
      Returns:
      rendered content
    • predictWidth

      protected int predictWidth(@NotNull @NotNull Cursor cursor, @NotNull @NotNull Doc doc)
    • fitsBetter

      @NotNull protected @NotNull Doc fitsBetter(@NotNull @NotNull Cursor cursor, @NotNull @NotNull Doc a, @NotNull @NotNull Doc b)
    • renderHeader

      protected void renderHeader(@NotNull @NotNull Cursor cursor)
    • renderFooter

      protected void renderFooter(@NotNull @NotNull Cursor cursor)
    • renderDoc

      protected void renderDoc(@NotNull @NotNull Cursor cursor, @NotNull @NotNull Doc doc)
    • renderSpecialSymbol

      protected void renderSpecialSymbol(@NotNull @NotNull Cursor cursor, @NotNull @NotNull String text)
    • renderNest

      protected void renderNest(@NotNull @NotNull Cursor cursor, @NotNull Doc.Nest nest)
    • renderUnionDoc

      protected void renderUnionDoc(@NotNull @NotNull Cursor cursor, @NotNull Doc.Union union)
    • renderFlatAlt

      protected void renderFlatAlt(@NotNull @NotNull Cursor cursor, @NotNull Doc.FlatAlt alt)
    • renderHyperLinked

      protected void renderHyperLinked(@NotNull @NotNull Cursor cursor, @NotNull Doc.HyperLinked text)
    • renderStyled

      protected void renderStyled(@NotNull @NotNull Cursor cursor, @NotNull Doc.Styled styled)
    • renderPlainText

      protected void renderPlainText(@NotNull @NotNull Cursor cursor, @NotNull @NotNull String content)
    • renderHardLineBreak

      protected void renderHardLineBreak(@NotNull @NotNull Cursor cursor)