MCPcopy Create free account
hub / github.com/careercup/ctci / run

Method run

java/Chapter 16/IntroductionLocks/MyClass.java:21–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 }
20
21 public void run() {
22 completionLock.lock();
23 int[] operations = AssortedMethods.randomArray(20, -50, 50);
24 for (int op : operations) {
25 delta += op;
26 if (op < 0) {
27 int val = op * -1;
28 noLockATM.withdraw(val);
29 lockedATM.withdraw(val);
30 } else {
31 noLockATM.deposit(op);
32 lockedATM.deposit(op);
33 }
34 }
35 completionLock.unlock();
36 }
37
38 public void waitUntilDone() {
39 completionLock.lock();

Callers

nothing calls this directly

Calls 3

randomArrayMethod · 0.95
withdrawMethod · 0.45
depositMethod · 0.45

Tested by

no test coverage detected