chart.add(newItemCopy.start(), newItemCopy.end(), newItemCopy, item, null, headEvent.shallowCopy(), eventProbMass); itemsAdded.add(newItemCopy);
boolean added = chart.add(newItemCopy.start(), newItemCopy.end(), newItemCopy, item, null, headEvent.shallowCopy(), eventProbMass); if (added) itemsAdded.add(newItemCopy);
  protected List addUnaries(EMItem item, List itemsAdded, int level)  throws RemoteException {    EMItem newItem = chart.getNewEMItem();    // set some values now, most to be filled in by code below    newItem.set(null, item.headWord(), null, null, item,		null, null, startList, startList,		item.start(), item.end(),		false, false, false, level, 0.0);    Symbol headSym = (Symbol)item.label();    HeadEvent headEvent = lookupHeadEvent;    headEvent.set(item.headWord(), null, headSym, emptySubcat, emptySubcat);    // foreach (possible) nonterminal    Symbol[] nts = (useHeadToParentMap ?		    (Symbol[])headToParentMap.get(item.label()) : nonterminals);    int numNTs = nts.length;    for (int ntIndex = 0; ntIndex < numNTs; ntIndex++) {      Symbol parent = nts[ntIndex];      headEvent.setParent(parent);      Subcat[] leftSubcats = getPossibleSubcats(leftSubcatMap, headEvent,						leftSubcatPS,						leftSubcatPSLastLevel);      Subcat[] rightSubcats = getPossibleSubcats(rightSubcatMap, headEvent,						 rightSubcatPS,						 rightSubcatPSLastLevel);      if (debugUnaries) {	if (item.start() == 4 && item.end() == 4 && parent == PP) {	  System.err.println(className +			     ".addUnaries: trying to buid on " + headSym +			     " with " + parent);	  Debug.level = 21;	}      }      int numLeftSubcats = leftSubcats.length;      int numRightSubcats = rightSubcats.length;      if (numLeftSubcats > 0 && numRightSubcats > 0) {	// foreach possible right subcat	for (int rightIdx = 0; rightIdx < numRightSubcats; rightIdx++) {	  Subcat rightSubcat = (Subcat)rightSubcats[rightIdx];	  // foreach possible left subcat	  for (int leftIdx = 0; leftIdx < numLeftSubcats; leftIdx++) {	    Subcat leftSubcat = (Subcat)leftSubcats[leftIdx];	    newItem.setLabel(parent);	    newItem.setLeftSubcat(leftSubcat);	    newItem.setRightSubcat(rightSubcat);	    headEvent.setLeftSubcat(leftSubcat);	    headEvent.setRightSubcat(rightSubcat);	    if (debugUnaries) {	    }	    if (isomorphicTreeConstraints) {	      // get head child's constraint's parent and check that it is	      // locally satisfied by newItem	      if (item.getConstraint() == null) {		System.err.println("uh-oh: no constraint for item " + item);	      }	      Constraint headChildParent = item.getConstraint().getParent();	      if (headChildParent != null &&		  headChildParent.isLocallySatisfiedBy(newItem)) {		if (debugConstraints)		  System.err.println("assigning locally-satisfied constraint " +				     headChildParent + " to " + newItem);		newItem.setConstraint(headChildParent);	      }	      else {		if (debugConstraints)		  System.err.println("constraint " + headChildParent +				     " is not locally satisfied by item " +				     newItem);		continue;	      }	    }	    else if (findAtLeastOneSatisfyingConstraint) {	      Constraint constraint = constraints.constraintSatisfying(newItem);	      if (constraint == null)		continue;	      else		newItem.setConstraint(constraint);	    }	    double probLeftSubcat =	      (numLeftSubcats == 1 ? probCertain :	       server.probLeftSubcat(id, headEvent));	    double probRightSubcat =	      (numRightSubcats == 1 ? probCertain :	       server.probRightSubcat(id, headEvent));	    double probHead = server.probHead(id, headEvent);	    if (probHead == probImpossible)	      continue;	    double eventProbMass = probHead * probLeftSubcat * probRightSubcat;	    double insideProb = item.insideProb() * eventProbMass;	    if (debugUnaries) {	    }	    if (insideProb == probImpossible)	      continue;	    newItem.setInsideProb(insideProb);	    EMItem newItemCopy = chart.getNewEMItem();	    newItemCopy.setDataFrom(newItem);	    chart.add(newItemCopy.start(), newItemCopy.end(), newItemCopy,		      item, null,		      headEvent.shallowCopy(), eventProbMass);	    itemsAdded.add(newItemCopy);	  }	} // end foreach possible left subcat      }    }    chart.reclaimItem(newItem);    if (debugUnaries)      Debug.level = 0;    return itemsAdded;  }