Package com.google.googlejavaformat
Class Doc.Break
java.lang.Object
com.google.googlejavaformat.Doc
com.google.googlejavaformat.Doc.Break
- All Implemented Interfaces:
Op
- Enclosing class:
Doc
A leaf node in a
Doc for an optional break.-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanWas this break taken?private final Doc.FillModeprivate final String(package private) intNew indent after this break.private final Optional<Output.BreakTag> private final IndentFields inherited from class com.google.googlejavaformat.Doc
MAX_LINE_WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBreak(Doc.FillMode fillMode, String flat, Indent plusIndent, Optional<Output.BreakTag> optTag) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(DocBuilder builder) Add anOpto aDocBuilder.computeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state) Make breaking decisions for aDoc.computeBreaks(Doc.State state, int lastIndent, boolean broken) (package private) StringCompute theDoc's flat value.(package private) com.google.common.collect.Range<Integer> (package private) intCompute theDoc's width.(package private) intReturn theBreak's extra indent.(package private) booleanisForced()Is theBreakforced?static Doc.Breakmake(Doc.FillMode fillMode, String flat, Indent plusIndent) Make aBreak.static Doc.Breakmake(Doc.FillMode fillMode, String flat, Indent plusIndent, Optional<Output.BreakTag> optTag) Make aBreak.static Doc.BreakMake a forcedBreak.toString()voidWrite aDocto anOutput, after breaking decisions have been made.
-
Field Details
-
fillMode
-
flat
-
plusIndent
-
optTag
-
broken
boolean brokenWas this break taken? -
newIndent
int newIndentNew indent after this break.
-
-
Constructor Details
-
Break
private Break(Doc.FillMode fillMode, String flat, Indent plusIndent, Optional<Output.BreakTag> optTag)
-
-
Method Details
-
make
Make aBreak.- Parameters:
fillMode- theDoc.FillModeflat- 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.FillModeflat- 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
-
getPlusIndent
int getPlusIndent()Return theBreak's extra indent.- Returns:
- the extra indent
-
isForced
boolean isForced()Is theBreakforced?- Returns:
- whether the
Breakis forced
-
add
Description copied from interface:OpAdd anOpto aDocBuilder.- Specified by:
addin interfaceOp- Parameters:
builder- theDocBuilder
-
computeWidth
int computeWidth()Description copied from class:DocCompute theDoc's width.- Specified by:
computeWidthin classDoc- Returns:
- the width
-
computeFlat
String computeFlat()Description copied from class:DocCompute theDoc's flat value. Not defined (and never called) if contains forced breaks.- Specified by:
computeFlatin classDoc- Returns:
- the flat value
-
computeRange
com.google.common.collect.Range<Integer> computeRange()Description copied from class:Doc- Specified by:
computeRangein classDoc- Returns:
- the
Range
-
computeBreaks
-
computeBreaks
Description copied from class:DocMake breaking decisions for aDoc.- Specified by:
computeBreaksin classDoc- Parameters:
maxWidth- the maximum line widthstate- the current output state- Returns:
- the new output state
-
write
Description copied from class:DocWrite aDocto anOutput, after breaking decisions have been made. -
toString
-