improve javadoc

This commit is contained in:
2020-09-27 12:14:55 +02:00
parent 439bf0b05b
commit 550e4401e5

View File

@@ -21,11 +21,11 @@ import org.lucares.utils.byteencoder.VariableByteEncoder;
* <pre> * <pre>
* Node layout: * Node layout:
* *
* ─────── Prefix ──────▶ ◀───────────────── Suffix ────────────────── * ─────── Prefix ──────▶ ◀───────────────── Suffix ──────────────────
* ┏━━━┳━━━━━┳━━━━━┳━━━━━┳━━━┳╸╺╸╺╸╺╸╺┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ * ┏━━━┳━━━━━┳━━━━━┳━━━━━┳━━━┳╸╺╸╺╸╺╸╺┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
* ┃ 6 ┃ 5,6 ┃ 3,6 ┃ 3,2 ┃ ∅ ┃ ┃"ba"->"147"┃"foobar"->"467"┃"foobaz"->"value"┃ * ┃ 6 ┃ 5,6 ┃ 3,6 ┃ 3,2 ┃ ∅ ┃ ┃"ba"->"147"┃"foobar"->"467"┃"foobaz"->"value"┃
* ┗━━━┻━━━━━┻━━━━━┻━━━━━┻━━━┻╸╺╸╺╸╺╸╺┻━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛ * ┗━━━┻━━━━━┻━━━━━┻━━━━━┻━━━┻╸╺╸╺╸╺╸╺┻━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛
* │ │ │ │ │ │ │ └▶ null byte that serves as a separator for the prefix. * │ │ │ │ │ │ │ └▶ null byte that serves as a terminator for the prefix.
* │ │ │ │ │ │ └▶ size of the third last key ("ba" in this example) * │ │ │ │ │ │ └▶ size of the third last key ("ba" in this example)
* │ │ │ │ │ └▶ size of the third last value ("147" in this example) * │ │ │ │ │ └▶ size of the third last value ("147" in this example)
* │ │ │ │ └▶ size of the second last key ("foobar" in this example) * │ │ │ │ └▶ size of the second last key ("foobar" in this example)
@@ -202,13 +202,13 @@ public class PersistentMapDiskNode {
+ String.join("\n", entries.values().stream().map(NodeEntry::toString).collect(Collectors.toList())); + String.join("\n", entries.values().stream().map(NodeEntry::toString).collect(Collectors.toList()));
} }
public <K, V> String toString(Function<byte[], K> keyDecoder, Function<byte[], V> valueDecoder) { public <K, V> String toString(final Function<byte[], K> keyDecoder, final Function<byte[], V> valueDecoder) {
StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
result.append("@"); result.append("@");
result.append(nodeOffset); result.append(nodeOffset);
result.append(": "); result.append(": ");
for (NodeEntry e : entries.values()) { for (final NodeEntry e : entries.values()) {
String s = e.toString(keyDecoder, valueDecoder); final String s = e.toString(keyDecoder, valueDecoder);
result.append("\n"); result.append("\n");
result.append(s); result.append(s);
} }