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

Class Map11

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

Source from the content-addressed store, hash-verified

243 }
244
245 public static class Map11 implements Job {
246 @Override
247 public void run(BValue value) {
248 var map11 = value.getMap11(); // key is 0,1,2
249/// logger.info("Map11: {} {}", value.objectId(), map11.size());
250 var forceRemove = map11.size() >= 3;
251 if (forceRemove) {
252 map11.remove(getRandom().nextLong(3));
253 } else {
254 switch (getRandom().nextInt(3)) {
255 case 0: // put, maybe replace.
256 map11.put(getRandom().nextLong(3), new demo.Module2.BValue());
257 break;
258
259 case 1: // remove, maybe remove nothing
260 map11.remove(getRandom().nextLong(3));
261 break;
262
263 case 2: // modify.
264 if (map11.isEmpty())
265 map11.put(getRandom().nextLong(3), new demo.Module2.BValue()); // ensure modify
266 var randItem = getRandItem(map11);
267 assert randItem != null;
268 randItem.setS(getRandom().nextInt());
269 break;
270 }
271 }
272 }
273
274 private static demo.Module2.BValue getRandItem(PMap2<Long, demo.Module2.BValue> map2) {
275 if (map2.isEmpty())
276 return null;
277 var index = getRandom().nextInt(map2.size());
278 for (var cur : map2) {
279 if (index-- == 0)
280 return cur.getValue();
281 }
282 return null;
283 }
284 }
285
286 public static class Bean12 implements Job {
287

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected