MCPcopy Index your code
hub / github.com/google/google-java-format / Space

Class Space

core/src/main/java/com/google/googlejavaformat/Doc.java:508–556  ·  view source on GitHub ↗

A Leaf node in a Doc for a non-breaking space.

Source from the content-addressed store, hash-verified

506
507 /** A Leaf node in a {@link Doc} for a non-breaking space. */
508 static final class Space extends Doc implements Op {
509 private static final Space SPACE = new Space();
510
511 private Space() {}
512
513 /**
514 * Factor method for {@code Space}.
515 *
516 * @return the new {@code Space}
517 */
518 static Space make() {
519 return SPACE;
520 }
521
522 @Override
523 public void add(DocBuilder builder) {
524 builder.add(this);
525 }
526
527 @Override
528 int computeWidth() {
529 return 1;
530 }
531
532 @Override
533 String computeFlat() {
534 return " ";
535 }
536
537 @Override
538 Range<Integer> computeRange() {
539 return EMPTY_RANGE;
540 }
541
542 @Override
543 public State computeBreaks(CommentsHelper commentsHelper, int maxWidth, State state) {
544 return state.withColumn(state.column + 1);
545 }
546
547 @Override
548 public void write(Output output) {
549 output.append(" ", range());
550 }
551
552 @Override
553 public String toString() {
554 return MoreObjects.toStringHelper(this).toString();
555 }
556 }
557
558 /** A leaf node in a {@link Doc} for an optional break. */
559 public static final class Break extends Doc implements Op {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…