while (prevItemsAdded.size() > 0) {
int i = -1;  for (i = 0; prevItemsAdded.size() > 0; i++) {
  protected void addUnariesAndStopProbs(int start, int end)  throws RemoteException {    prevItemsAdded.clear();    currItemsAdded.clear();    stopProbItemsToAdd.clear();    boolean buildingOnPreterminalProductions = start == end;    Iterator it = chart.getAll(start, end);    while (it.hasNext()) {      CKYItem item = (CKYItem)it.next();      if (item.stop() == false)        stopProbItemsToAdd.add(item);      else if (buildingOnPreterminalProductions)        prevItemsAdded.add(item);    }    if (!buildingOnPreterminalProductions) {      it = stopProbItemsToAdd.iterator();      while (it.hasNext())        addStopProbs((CKYItem)it.next(), prevItemsAdded);    }    //for (int i = 0; i < 5; i++) {    while (prevItemsAdded.size() > 0) {      Iterator prevItems = prevItemsAdded.iterator();      while (prevItems.hasNext()) {        CKYItem item = (CKYItem)prevItems.next();        addUnaries(item, currItemsAdded);      }      exchangePrevAndCurrItems();      currItemsAdded.clear();      prevItems = prevItemsAdded.iterator();      while (prevItems.hasNext()) {        CKYItem item = (CKYItem)prevItems.next();        addStopProbs(item, currItemsAdded);      }      exchangePrevAndCurrItems();      currItemsAdded.clear();    }  }