MCPcopy Create free account
hub / github.com/e2wugui/zeze / get

Method get

ZezeJava/ZezeJava/src/main/java/Zeze/Transaction/TableX.java:606–627  ·  view source on GitHub ↗
(@NotNull K key)

Source from the content-addressed store, hash-verified

604 }
605
606 public final @Nullable V get(@NotNull K key) {
607 var currentT = Transaction.getCurrent();
608 assert currentT != null;
609 //noinspection ConstantValue
610 if (key == null)
611 throw new IllegalArgumentException("key is null");
612
613 var tkey = new TableKey(getId(), key);
614 var cr = currentT.getRecordAccessed(tkey);
615 if (cr != null) {
616 @SuppressWarnings("unchecked")
617 var r = (V)cr.newestValue();
618 return r;
619 }
620
621 var r = load(key);
622 var v = r.strongRef;
623 currentT.addRecordAccessed(r.record.createRootInfoIfNeed(tkey),
624 new RecordAccessed(r),
625 v == null && isMemory());
626 return v;
627 }
628
629 public final boolean contains(@NotNull K key) {
630 return get(key) != null;

Callers 2

containsMethod · 0.95
tryAddMethod · 0.95

Calls 8

getCurrentMethod · 0.95
loadMethod · 0.95
getIdMethod · 0.65
isMemoryMethod · 0.65
getRecordAccessedMethod · 0.45
newestValueMethod · 0.45
addRecordAccessedMethod · 0.45
createRootInfoIfNeedMethod · 0.45

Tested by

no test coverage detected