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.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.googlejavaformat.Doc
Doc.Break, Doc.FillMode, Doc.State, Doc.Token
-
Method Summary
Modifier and Type Method Description void
add(DocBuilder builder)
Add anOp
to aDocBuilder
.Doc.State
computeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state)
Make breaking decisions for aDoc
.Doc.State
computeBreaks(Doc.State state, int lastIndent, boolean broken)
static Doc.Break
make(Doc.FillMode fillMode, String flat, Indent plusIndent)
Make aBreak
.static Doc.Break
make(Doc.FillMode fillMode, String flat, Indent plusIndent, Optional<Output.BreakTag> optTag)
Make aBreak
.static Doc.Break
makeForced()
Make a forcedBreak
.String
toString()
void
write(Output output)
Write aDoc
to anOutput
, after breaking decisions have been made.
-
Method Details
-
make
Make aBreak
.- Parameters:
fillMode
- theDoc.FillMode
flat
- the text when not brokenplusIndent
- 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 aBreak
.- Parameters:
fillMode
- theDoc.FillMode
flat
- the text when not brokenplusIndent
- extra indent if takenoptTag
- an optional tag for remembering whether the break was taken- Returns:
- the new
Break
-
makeForced
Make a forcedBreak
.- Returns:
- the new forced
Break
-
add
Description copied from interface:Op
Add anOp
to aDocBuilder
.- Specified by:
add
in interfaceOp
- Parameters:
builder
- theDocBuilder
-
computeBreaks
-
computeBreaks
Description copied from class:Doc
Make breaking decisions for aDoc
.- Specified by:
computeBreaks
in classDoc
maxWidth
- the maximum line widthstate
- the current output state- Returns:
- the new output state
-
write
Description copied from class:Doc
Write aDoc
to anOutput
, after breaking decisions have been made. -
toString
-