Distributed Algorithms - Ricart Agrawala Mutual Exclusion 2000-06-26 Thomas Lehner, Rene Mayrhofer class CriticalRegionConflict extends GlobalAssertion { private Vector procsInCR = new Vector(); public boolean assert(Program progs[]) { int numOfProcsInCR = 0; procsInCR.removeAllElements(); for (int i=0; i<progs.length; i++) { if (((Prog) progs[i]).region == Prog.C) { numOfProcsInCR++; procsInCR.add(new Integer(i)); } return numOfProcsInCR <= 1; } public String getText() { String text = Processes in the critical region: ; for (int i=0; i<procsInCR.size(); i++) text += procsInCR.get(i) + ; return text; }
{}