MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / get

Method get

validating/CircularQueue.java:40–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 assert invariant();
39 }
40 public Object get() {
41 precondition(!empty(),
42 "get() from empty CircularQueue");
43 assert invariant();
44 Object returnVal = data[out];
45 data[out] = null;
46 out++;
47 if(out >= data.length) {
48 out = 0;
49 wrapped = false;
50 }
51 assert postcondition(
52 returnVal != null,
53 "Null item in CircularQueue");
54 assert invariant();
55 return returnVal;
56 }
57 // Design-by-contract support methods:
58 private static void
59 precondition(boolean cond, String msg) {

Callers

nothing calls this directly

Calls 4

preconditionMethod · 0.95
emptyMethod · 0.95
invariantMethod · 0.95
postconditionMethod · 0.95

Tested by

no test coverage detected