()
| 65 | return true; |
| 66 | } |
| 67 | private boolean invariant() { |
| 68 | // Guarantee that no null values are in the |
| 69 | // region of 'data' that holds objects: |
| 70 | for(int i = out; i != in; i = (i + 1) % data.length) |
| 71 | if(data[i] == null) |
| 72 | throw new CircularQueueException( |
| 73 | "null in CircularQueue"); |
| 74 | // Guarantee that only null values are outside the |
| 75 | // region of 'data' that holds objects: |
| 76 | if(full()) return true; |
| 77 | for(int i = in; i != out; i = (i + 1) % data.length) |
| 78 | if(data[i] != null) |
| 79 | throw new CircularQueueException( |
| 80 | "non-null outside of CircularQueue range: " |
| 81 | + dump()); |
| 82 | return true; |
| 83 | } |
| 84 | public String dump() { |
| 85 | return "in = " + in + |
| 86 | ", out = " + out + |
no test coverage detected