java.lang.Object
com.google.googlejavaformat.Doc
JavaInputAstVisitor
outputs a
sequence of Op
s using OpsBuilder
. This linear sequence is then transformed by
DocBuilder
into a tree-structured Doc
. The top-level Doc
is a Doc.Level
, which contains a sequence of Doc
s, including other Doc.Level
s. Leaf
Doc
s are Doc.Token
s, representing language-level tokens; Doc.Tok
s, which may also
represent non-token Input.Tok
s, including comments and other white-space; Doc.Space
s,
representing single spaces; and Doc.Break
s, which represent optional line-breaks.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The maximum supported line width. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Doc.State
computeBreaks
(CommentsHelper commentsHelper, int maxWidth, Doc.State state) Make breaking decisions for aDoc
.abstract void
Write aDoc
to anOutput
, after breaking decisions have been made.
-
Field Details
-
MAX_LINE_WIDTH
public static final int MAX_LINE_WIDTHThe maximum supported line width.This can be used as a sentinel/threshold for
Doc
s that break unconditionally.The value was selected to be obviously too large for any practical line, but small enough to prevent accidental overflow.
- See Also:
-
-
Constructor Details
-
Doc
public Doc()
-
-
Method Details
-
computeBreaks
public abstract Doc.State computeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state) Make breaking decisions for aDoc
.- Parameters:
maxWidth
- the maximum line widthstate
- the current output state- Returns:
- the new output state
-
write
Write aDoc
to anOutput
, after breaking decisions have been made.
-