public abstract class Doc extends HasUniqueId
JavaInputAstVisitor outputs a sequence of Ops using
OpsBuilder. This linear sequence is then transformed by DocBuilder into a tree-structured
Doc. The top-level Doc is a Level, which contains a sequence of Docs, including other
Levels. Leaf Docs are Tokens, representing language-level tokens; Comments, which may
also represent non-token Input.Toks, including comments and other white-space; NonBreakingSpaces,
representing single spaces; and Breaks, which represent optional line-breaks.| Constructor and Description |
|---|
Doc() |
| Modifier and Type | Method and Description |
|---|---|
abstract State |
computeBreaks(CommentsHelper commentsHelper,
int maxWidth,
State state,
Obs.ExplorationNode explorationNode)
Make breaking decisions for a
Doc. |
protected abstract java.lang.String |
computeFlat()
Compute the
Doc's flat value. |
protected abstract com.google.common.collect.Range<java.lang.Integer> |
computeRange()
Compute the
Doc's Range of Input.Tokens. |
protected abstract float |
computeWidth()
Compute the
Doc's width. |
java.lang.String |
getFlat()
Return a
Doc's flat-string value; not defined (and never called) if the (@code Doc} contains forced
breaks. |
abstract void |
write(State state,
Output output)
Write a
Doc to an Output, after breaking decisions have been made. |
idpublic final java.lang.String getFlat()
Doc's flat-string value; not defined (and never called) if the (@code Doc} contains forced
breaks.protected abstract float computeWidth()
Doc's width.Float.POSITIVE_INFINITY if it must be brokenprotected abstract java.lang.String computeFlat()
Doc's flat value. Not defined (and never called) if contains forced breaks.protected abstract com.google.common.collect.Range<java.lang.Integer> computeRange()
Doc's Range of Input.Tokens.Rangepublic abstract State computeBreaks(CommentsHelper commentsHelper, int maxWidth, State state, Obs.ExplorationNode explorationNode)
Doc.maxWidth - the maximum line widthstate - the current output state