00001 class Pair 00002 { 00003 private int hi; 00004 private int lo; 00005 00006 public Pair() 00007 { 00008 this.hi = 0; 00009 this.lo = 0; 00010 } 00011 00012 public synchronized void inclo () 00013 { 00014 while (this.lo <= this.hi) 00015 { 00016 try { 00017 this.wait(); 00018 } 00019 catch (java.lang.InterruptedException ex) { 00020 } 00021 } 00022 this.lo = (this.lo + 1); 00023 } 00024 00025 public synchronized void inchi () 00026 { 00027 this.hi = (this.hi + 1); 00028 this.notify(); 00029 } 00030 }