Program: 86571
Project: 86571
Buggy source:
/** 
 * @param point
 * @return
 */
List<BoundaryPart> getEligibleParts(final Point point){
  if (boundary.size() <= 1) {
    return new ArrayList<BoundaryPart>();
  }
  int size=boundary.size();
  ArrayList<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  if (boundary.get(1).isConstraintRightPoint(point)) {
    ret.add(boundary.get(0));
    ret.addAll(getUpperSameRightPoint(0,boundary.get(0)));
    return ret;
  }
  if (boundary.get(1).pointIsLower(point)) {
    ret.add(boundary.get(0));
    return ret;
  }
  if (boundary.get(size - 1).isConstraintRightPoint(point)) {
    ret.add(boundary.get(size - 1));
    ret.addAll(getLowerSameRightPoint(size - 1,boundary.get(size - 1)));
    return ret;
  }
  if (boundary.get(size - 1).pointIsUpper(point)) {
    ret.add(boundary.get(size - 1));
    return ret;
  }
  BoundaryPart bp=boundary.get(0);
  BoundaryPart bpo;
  int index=boundary.size() / 2;
  int delta=index;
  boolean next=true;
  while (next) {
    bp=boundary.get(index);
    if (bp.pointIsUpper(point)) {
      bpo=boundary.get(index + 1);
      if (bpo.pointIsLower(point)) {
        ret.add(bp);
        return ret;
      }
 else       if (bpo.isConstraintRightPoint(point)) {
        ret.add(bp);
        ret.addAll(getUpperSameRightPoint(index + 1,bpo));
        return ret;
      }
 else {
        delta=delta / 2 > 0 ? delta / 2 : 1;
        index=index + delta;
      }
    }
 else     if (bp.isConstraintRightPoint(point)) {
      ret.addAll(getLowerSameRightPoint(index,bp));
      ret.add(bp);
      ret.addAll(getUpperSameRightPoint(index,bp));
    }
 else {
      bpo=boundary.get(index - 1);
      if (bpo.pointIsUpper(point)) {
        ret.add(bpo);
        return ret;
      }
 else       if (bpo.isConstraintRightPoint(point)) {
        ret.add(bp);
        ret.addAll(getUpperSameRightPoint(index - 1,bpo));
        return ret;
      }
 else {
        delta=delta / 2 > 0 ? delta / 2 : 1;
        index=index - delta;
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @param point
 * @return
 */
List<BoundaryPart> getEligibleParts(final Point point){
  if (boundary.size() <= 1) {
    return new ArrayList<BoundaryPart>();
  }
  int size=boundary.size();
  ArrayList<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  if (boundary.get(1).isConstraintRightPoint(point)) {
    ret.add(boundary.get(0));
    ret.addAll(getUpperSameRightPoint(0,boundary.get(0)));
    return ret;
  }
  if (boundary.get(1).pointIsLower(point)) {
    ret.add(boundary.get(0));
    return ret;
  }
  if (boundary.get(size - 1).isConstraintRightPoint(point)) {
    ret.addAll(getLowerSameRightPoint(size - 1,boundary.get(size - 1)));
    ret.add(boundary.get(size - 1));
    return ret;
  }
  if (boundary.get(size - 1).pointIsUpper(point)) {
    ret.add(boundary.get(size - 1));
    return ret;
  }
  BoundaryPart bp=boundary.get(0);
  BoundaryPart bpo;
  int index=boundary.size() / 2;
  int delta=index;
  boolean next=true;
  while (next) {
    bp=boundary.get(index);
    if (bp.pointIsUpper(point)) {
      bpo=boundary.get(index + 1);
      if (bpo.pointIsLower(point)) {
        ret.add(bp);
        return ret;
      }
 else       if (bpo.isConstraintRightPoint(point)) {
        ret.add(bp);
        ret.addAll(getUpperSameRightPoint(index + 1,bpo));
        return ret;
      }
 else {
        delta=delta / 2 > 0 ? delta / 2 : 1;
        index=index + delta;
      }
    }
 else     if (bp.isConstraintRightPoint(point)) {
      ret.addAll(getLowerSameRightPoint(index,bp));
      ret.add(bp);
      ret.addAll(getUpperSameRightPoint(index,bp));
    }
 else {
      bpo=boundary.get(index - 1);
      if (bpo.pointIsUpper(point)) {
        ret.add(bpo);
        return ret;
      }
 else       if (bpo.isConstraintRightPoint(point)) {
        ret.add(bp);
        ret.addAll(getUpperSameRightPoint(index - 1,bpo));
        return ret;
      }
 else {
        delta=delta / 2 > 0 ? delta / 2 : 1;
        index=index - delta;
      }
    }
  }
  return ret;
}