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

Class PSet

ZezeJava/ZezeJava/src/main/java/Zeze/Transaction/Collections/PSet.java:12–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10import org.pcollections.Empty;
11
12public abstract class PSet<V> extends Collection implements Set<V> {
13 @NotNull org.pcollections.PSet<V> set = Empty.set();
14
15 @Override
16 public abstract boolean add(@NotNull V item);
17
18 @Override
19 public abstract boolean remove(@NotNull Object item);
20
21 @Override
22 public abstract void clear();
23
24 public final @NotNull org.pcollections.PSet<V> getSet() {
25 if (isManaged()) {
26 var txn = Transaction.getCurrentVerifyRead(this);
27 if (txn == null)
28 return set;
29 //noinspection DataFlowIssue
30 Log log = txn.getLog(parent().objectId() + variableId());
31 if (log == null)
32 return set;
33 @SuppressWarnings("unchecked")
34 var setLog = (LogSet1<V>)log;
35 return setLog.getValue();
36 }
37 return set;
38 }
39
40 @Override
41 public final int size() {
42 return getSet().size();
43 }
44
45 @Override
46 public final boolean isEmpty() {
47 return getSet().isEmpty();
48 }
49
50 @Override
51 public final boolean contains(@NotNull Object v) {
52 return getSet().contains(v);
53 }
54
55 @Override
56 public boolean containsAll(@NotNull java.util.Collection<?> c) {
57 return getSet().containsAll(c);
58 }
59
60 @Deprecated // unsupported
61 @Override
62 public boolean retainAll(@NotNull java.util.Collection<?> c) {
63 throw new UnsupportedOperationException();
64 }
65
66 public final void copyTo(V @NotNull [] array, int arrayIndex) {
67 for (V v : getSet())
68 array[arrayIndex++] = v;
69 }

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected