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

Class Set10

ZezeJava/ZezeJavaTest/src/Infinite/CoverHistory.java:208–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206 }
207
208 public static class Set10 implements Job {
209
210 private static void randRemove(PSet1<Integer> set) {
211 if (set.isEmpty())
212 return;
213
214 var index = getRandom().nextInt(set.size());
215 for (var it = set.iterator(); it.hasNext(); /**/) {
216 if (index == 0) {
217 it.remove();
218 break;
219 }
220 --index;
221 it.next();
222 }
223 }
224
225 @Override
226 public void run(BValue value) {
227 var set = value.getSet10();
228 var forceRemove = set.size() >= 3;
229 if (forceRemove) {
230 randRemove(set);
231 } else {
232 switch (getRandom().nextInt(2)) {
233 case 0: // insert
234 set.add(getRandom().nextInt());
235 break;
236
237 case 1: // remove
238 randRemove(set);
239 break;
240 }
241 }
242 }
243 }
244
245 public static class Map11 implements Job {
246 @Override

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected