(final boolean indent, final TokenBuilder tb, final int level,
final InputInfo ii)
| 463 | } |
| 464 | |
| 465 | @Override |
| 466 | public final void string(final boolean indent, final TokenBuilder tb, final int level, |
| 467 | final InputInfo ii) throws QueryException { |
| 468 | |
| 469 | tb.add("{"); |
| 470 | int c = 0; |
| 471 | final IntConsumer addWS = lvl -> { |
| 472 | for(int l = 0; l < lvl; l++) tb.add(" "); |
| 473 | }; |
| 474 | for(final Entry entry : entries()) { |
| 475 | if(c++ > 0) tb.add(','); |
| 476 | if(indent) { |
| 477 | tb.add('\n'); |
| 478 | addWS.accept(level + 1); |
| 479 | } |
| 480 | tb.add(entry.key()).add(':'); |
| 481 | if(indent) tb.add(' '); |
| 482 | final Value value = entry.value(); |
| 483 | final boolean par = value.size() != 1; |
| 484 | if(par) tb.add('('); |
| 485 | int cc = 0; |
| 486 | for(final Item item : value) { |
| 487 | if(cc++ > 0) { |
| 488 | tb.add(','); |
| 489 | if(indent) tb.add(' '); |
| 490 | } |
| 491 | if(item instanceof final XQMap map) map.string(indent, tb, level + 1, ii); |
| 492 | else if(item instanceof final XQArray array) array.string(indent, tb, level, ii); |
| 493 | else tb.add(item); |
| 494 | } |
| 495 | if(par) tb.add(')'); |
| 496 | } |
| 497 | if(indent) { |
| 498 | tb.add('\n'); |
| 499 | addWS.accept(level); |
| 500 | } |
| 501 | tb.add('}'); |
| 502 | } |
| 503 | |
| 504 | @Override |
| 505 | public final String description() { |
no test coverage detected