satisfied = isLocallySatisfiedBy(item) && spanMatches(item);
if (isLocallySatisfiedBy(item) && spanMatches(item)) satisfied = true;
  public boolean isSatisfiedBy(Item item) {    CKYItem ckyItem = (CKYItem)item;    // normally, preterminal items should be assigned constraints from the    // list of leaves, and thus this case should normally not be considered;    // but just in case a brain-dead programmer creates a decoder that is    // inefficient in this way, here's the code to deal with it    if (ckyItem.isPreterminal()) {      satisfied = isLocallySatisfiedBy(item) && spanMatches(item);      return satisfied;    }    if (!isLocallySatisfiedBy(item) || !spanMatches(item))      return false;    // now, make sure that number of children equals number of child constraints    int numLeftChildren = ckyItem.numLeftChildren();    int numRightChildren = ckyItem.numRightChildren();    if (numLeftChildren + numRightChildren + 1 != children.size())      return false;    // check that each child constraint is met in proper order    // first, check left children    int constraintIdx = 0;    for (SLNode curr = ckyItem.children(Constants.LEFT);         curr != null && constraintIdx < children.size();         curr = curr.next(), constraintIdx++) {      Constraint currConstraint = ((CKYItem)curr.data()).getConstraint();      if (currConstraint != children.get(constraintIdx))        return false;    }    // now, check head child    int headChildIdx = numLeftChildren;    if (ckyItem.headChild().getConstraint() != children.get(headChildIdx))      return false;    // finally, check right children    constraintIdx = children.size() - 1;    for (SLNode curr = ckyItem.children(Constants.RIGHT);         curr != null && constraintIdx >= 0;         curr = curr.next(), constraintIdx--) {      Constraint currConstraint = ((CKYItem)curr.data()).getConstraint();      if (currConstraint != children.get(constraintIdx))        return false;    }    satisfied = true;    return true;  }