Package com.google.googlejavaformat
Class Doc.Break
- java.lang.Object
-
- com.google.googlejavaformat.Doc
-
- com.google.googlejavaformat.Doc.Break
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanbrokenWas this break taken?private Doc.FillModefillModeprivate java.lang.Stringflat(package private) intnewIndentNew indent after this break.private java.util.Optional<Output.BreakTag>optTagprivate IndentplusIndent-
Fields inherited from class com.google.googlejavaformat.Doc
MAX_LINE_WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description privateBreak(Doc.FillMode fillMode, java.lang.String flat, Indent plusIndent, java.util.Optional<Output.BreakTag> optTag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DocBuilder builder)Add anOpto aDocBuilder.Doc.StatecomputeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state)Make breaking decisions for aDoc.Doc.StatecomputeBreaks(Doc.State state, int lastIndent, boolean broken)(package private) java.lang.StringcomputeFlat()Compute theDoc's flat value.(package private) com.google.common.collect.Range<java.lang.Integer>computeRange()(package private) intcomputeWidth()Compute theDoc's width.(package private) intgetPlusIndent()Return theBreak's extra indent.(package private) booleanisForced()Is theBreakforced?static Doc.Breakmake(Doc.FillMode fillMode, java.lang.String flat, Indent plusIndent)Make aBreak.static Doc.Breakmake(Doc.FillMode fillMode, java.lang.String flat, Indent plusIndent, java.util.Optional<Output.BreakTag> optTag)Make aBreak.static Doc.BreakmakeForced()Make a forcedBreak.java.lang.StringtoString()voidwrite(Output output)Write aDocto anOutput, after breaking decisions have been made.
-
-
-
Field Detail
-
fillMode
private final Doc.FillMode fillMode
-
flat
private final java.lang.String flat
-
plusIndent
private final Indent plusIndent
-
optTag
private final java.util.Optional<Output.BreakTag> optTag
-
broken
boolean broken
Was this break taken?
-
newIndent
int newIndent
New indent after this break.
-
-
Constructor Detail
-
Break
private Break(Doc.FillMode fillMode, java.lang.String flat, Indent plusIndent, java.util.Optional<Output.BreakTag> optTag)
-
-
Method Detail
-
make
public static Doc.Break make(Doc.FillMode fillMode, java.lang.String flat, Indent plusIndent)
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, java.lang.String flat, Indent plusIndent, java.util.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
public static Doc.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
public void add(DocBuilder builder)
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
java.lang.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<java.lang.Integer> computeRange()
Description copied from class:Doc- Specified by:
computeRangein classDoc- Returns:
- the
Range
-
computeBreaks
public Doc.State computeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state)
Description copied from class:DocMake breaking decisions for aDoc.- Specified by:
computeBreaksin classDocmaxWidth- the maximum line widthstate- the current output state- Returns:
- the new output state
-
write
public void write(Output output)
Description copied from class:DocWrite aDocto anOutput, after breaking decisions have been made.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-