Package com.google.googlejavaformat
Class Doc.Level
java.lang.Object
com.google.googlejavaformat.Doc
com.google.googlejavaformat.Doc.Level
- Enclosing class:
Doc
A
Level inside a Doc.-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanTrue if the entireDoc.Levelfits on one line.private final IndentFields inherited from class com.google.googlejavaformat.Doc
MAX_LINE_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidAdd aDocto theLevel.private static Doc.StatecomputeBreakAndSplit(CommentsHelper commentsHelper, int maxWidth, Doc.State state, Optional<Doc.Break> optBreakDoc, List<Doc> split) Lay out a Break-separated group of Docs in the current Level.computeBreaks(CommentsHelper commentsHelper, int maxWidth, Doc.State state) Make breaking decisions for aDoc.private Doc.StatecomputeBroken(CommentsHelper commentsHelper, int maxWidth, Doc.State state) Compute breaks for aDoc.Levelthat spans multiple lines.(package private) StringCompute theDoc's flat value.(package private) com.google.common.collect.Range<Integer> private static Doc.StatecomputeSplit(CommentsHelper commentsHelper, int maxWidth, List<Doc> docs, Doc.State state) (package private) intCompute theDoc's width.(package private) static intGet the width of a sequence ofDocs.(package private) static Doc.LevelFactory method forLevels.private static voidtoString()private static com.google.common.collect.Range<Integer> voidWrite aDocto anOutput, after breaking decisions have been made.private voidwriteFilled(Output output)
-
Field Details
-
plusIndent
-
docs
-
oneLine
boolean oneLineTrue if the entireDoc.Levelfits on one line. -
splits
-
breaks
-
-
Constructor Details
-
Level
-
-
Method Details
-
make
Factory method forLevels.- Parameters:
plusIndent- the extra indent inside theLevel- Returns:
- the new
Level
-
add
Add aDocto theLevel.- Parameters:
doc- theDocto add
-
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
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
-
splitByBreaks
-
computeBroken
Compute breaks for aDoc.Levelthat spans multiple lines. -
computeBreakAndSplit
private static Doc.State computeBreakAndSplit(CommentsHelper commentsHelper, int maxWidth, Doc.State state, Optional<Doc.Break> optBreakDoc, List<Doc> split) Lay out a Break-separated group of Docs in the current Level. -
computeSplit
private static Doc.State computeSplit(CommentsHelper commentsHelper, int maxWidth, List<Doc> docs, Doc.State state) -
write
Description copied from class:DocWrite aDocto anOutput, after breaking decisions have been made. -
writeFilled
-
getWidth
Get the width of a sequence ofDocs.- Parameters:
docs- theDocs- Returns:
- the width
-
union
-
toString
-