samples/reentrant/src/org/apidesign/reentrant/CriticalSectionSynchronizedWithAssert.java
1 package org.apidesign.reentrant;
3 import java.util.Collection;
5 public class CriticalSectionSynchronizedWithAssert<T extends Comparable<T>> implements CriticalSection<T> {
8 private boolean working;
10 public synchronized void assignPilot(T pilot) {
11 assert !working : "Shall not be working yet in order to be consistent";
15 public int sumBigger(Collection<T> args) {
16 assert !working : "Shall not be working yet in order to be consistent";
20 if (pilot.compareTo(cmp) < 0) {
30 public int getCount() {
31 assert !working : "Shall not be working yet in order to be consistent";