MCPcopy Create free account
hub / github.com/VolmitSoftware/Adapt / tick

Method tick

src/main/java/com/volmit/adapt/api/tick/Ticker.java:72–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 }
71
72 private void tick() {
73 ticking = true;
74// int ix = 0;
75 AtomicInteger tc = new AtomicInteger(0);
76 BurstExecutor e = MultiBurst.burst.burst(ticklist.size());
77 for (int i = 0; i < ticklist.size(); i++) {
78 int ii = i;
79// ix++;
80 e.queue(() -> {
81 Ticked t = ticklist.get(ii);
82
83 if (t != null && t.shouldTick()) {
84 tc.incrementAndGet();
85 try {
86 t.tick();
87 } catch (Throwable exxx) {
88 exxx.printStackTrace();
89 }
90 }
91 });
92 }
93
94 e.complete();
95// Adapt.info(ix + "");
96
97 synchronized (newTicks) {
98 while (newTicks.isNotEmpty()) {
99 tc.incrementAndGet();
100 ticklist.add(newTicks.popRandom());
101 }
102 }
103
104 synchronized (removeTicks) {
105 while (removeTicks.isNotEmpty()) {
106 tc.incrementAndGet();
107 String id = removeTicks.popRandom();
108
109 for (int i = 0; i < ticklist.size(); i++) {
110 if (ticklist.get(i).getId().equals(id)) {
111 ticklist.remove(i);
112 break;
113 }
114 }
115 }
116 }
117
118 ticking = false;
119 tc.get();
120 }
121}

Callers 1

TickerMethod · 0.95

Calls 11

queueMethod · 0.95
shouldTickMethod · 0.95
tickMethod · 0.95
completeMethod · 0.95
burstMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
addMethod · 0.65
getIdMethod · 0.65
removeMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected