MCPcopy Create free account
hub / github.com/BaseXdb/basex / finish

Method finish

basex-core/src/main/java/org/basex/util/Table.java:100–141  ·  view source on GitHub ↗

Returns a textual representation of the table. @return text

()

Source from the content-addressed store, hash-verified

98 * @return text
99 */
100 public byte[] finish() {
101 final int[] ind = new int[header.size()];
102 final int size = header.size();
103 for(int s = 0; s < size; ++s) {
104 for(final TokenList e : contents) {
105 ind[s] = Math.max(ind[s], e.get(s).length);
106 }
107 ind[s] = Math.max(ind[s], header.get(s).length);
108 }
109
110 final TokenBuilder tb = new TokenBuilder();
111 for(int u = 0; u < size; ++u) {
112 final byte[] s = header.get(u);
113 final int is = ind[u] - s.length + DIST;
114 tb.add(s);
115 for(int i = 0; i < is; ++i) tb.add(' ');
116 }
117 tb.add(NL);
118 for(int u = 0; u < size; ++u) {
119 for(int i = 0; i < ind[u] + (u + 1 == size ? 0 : DIST); ++i) tb.add('-');
120 }
121 tb.add(NL);
122 for(final TokenList e : contents) {
123 for(int u = 0; u < size; ++u) {
124 final byte[] s = e.get(u);
125 final int is = ind[u] - s.length;
126 if(u < align.size() && align.get(u)) {
127 for(int i = 0; i < is; ++i) tb.add(' ');
128 tb.add(s);
129 } else {
130 tb.add(s);
131 for(int i = 0; i < is; ++i) tb.add(' ');
132 }
133 for(int i = 0; i < DIST; ++i) tb.add(' ');
134 }
135 tb.add(NL);
136 }
137 if(description != null) {
138 tb.add(NL).addExt(description, contents.size()).add(DOT);
139 }
140 return tb.finish();
141 }
142
143 @Override
144 public String toString() {

Callers 12

tableMethod · 0.95
toStringMethod · 0.95
createMethod · 0.45
BaseXGUIMethod · 0.45
tokenMethod · 0.45
splitMethod · 0.45
chopMethod · 0.45
splitMethod · 0.45
similarEntityMethod · 0.45
infMethod · 0.45
toArrayMethod · 0.45
startMethod · 0.45

Calls 7

addMethod · 0.95
finishMethod · 0.95
addExtMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
addMethod · 0.65
maxMethod · 0.45

Tested by

no test coverage detected