Program: 181108
Project: 181108
Buggy source:
/** 
 * * FUNCTION NAME: leftMostNE                                                    * PURPOSE:       Determine the point with minimum x-coordinate among           all points {p ∈ P | xmin ≤ p.x ∧ ymin ≤ p.y}                  * PARAMETERS                                                                   Type/Name:   double/xmin                                                   Description: The minimum x coordinate to consider                          * Type/Name:   double/ymin                                                   Description: The minimum y coordinate to consider                          * RETURN:        The PSTPoint with minimum x-coordinate within given           boundaries.                                                   
 */
public PSTPoint leftMostNE(double xmin,double ymin){
  PSTPoint best=new PSTPoint(Double.POSITIVE_INFINITY,Double.POSITIVE_INFINITY);
  int indexP=1;
  int indexQ=1;
  while (!isLeaf(indexP)) {
    PSTPoint p=getPoint(indexP);
    if (xmin <= p.getX() && p.getY() >= ymin)     best=p;
    PSTPoint q=getPoint(indexQ);
    if (xmin <= q.getX() && q.getY() >= ymin)     best=q;
    if (indexP == indexQ) {
      if (numberOfChildren(indexP) == 1) {
        indexQ=indexOfLeftChild(indexP);
        indexP=indexOfLeftChild(indexP);
      }
 else {
        indexQ=indexOfRightChild(indexP);
        indexP=indexOfLeftChild(indexP);
      }
    }
 else {
      if (isLeaf(indexQ))       indexQ=indexP;
 else       if (numberOfChildren(indexQ) == 1) {
        PSTPoint ql=getPoint(indexOfLeftChild(indexQ));
        PSTPoint pr=getPoint(indexOfRightChild(indexP));
        if (ql.getY() < ymin) {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
 else         if (pr.getY() < ymin) {
          indexP=indexOfLeftChild(indexP);
          indexQ=indexOfLeftChild(indexQ);
        }
 else         if (ql.getX() < xmin) {
          indexP=indexOfLeftChild(indexQ);
          indexQ=indexOfLeftChild(indexQ);
        }
 else         if (pr.getX() < xmin) {
          indexP=indexOfRightChild(indexP);
          indexQ=indexOfLeftChild(indexQ);
        }
 else {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
      }
 else {
        PSTPoint ql=getPoint(indexOfLeftChild(indexQ));
        PSTPoint pr=getPoint(indexOfRightChild(indexP));
        PSTPoint pl=getPoint(indexOfLeftChild(indexP));
        if (pr.getX() >= xmin && pr.getY() >= ymin) {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
 else         if (pr.getX() < xmin) {
          if (ql.getX() < xmin) {
            indexP=indexOfLeftChild(indexQ);
            indexQ=indexOfRightChild(indexQ);
          }
 else           if (ql.getY() < ymin) {
            indexP=indexOfRightChild(indexP);
            indexQ=indexOfRightChild(indexQ);
          }
 else {
            indexP=indexOfRightChild(indexP);
            indexQ=indexOfLeftChild(indexQ);
          }
        }
 else {
          if (pl.getY() < ymin) {
            indexP=indexOfLeftChild(indexQ);
            indexQ=indexOfRightChild(indexQ);
          }
 else {
            indexP=indexOfLeftChild(indexP);
            if (ql.getY() >= ymin)             indexQ=indexOfLeftChild(indexQ);
 else             indexQ=indexOfRightChild(indexQ);
          }
        }
      }
    }
  }
  PSTPoint p=getPoint(indexP);
  if (xmin <= p.getX() && p.getY() >= ymin)   best=p;
  PSTPoint q=getPoint(indexQ);
  if (xmin <= q.getX() && q.getY() >= ymin)   best=q;
  return best;
}

Fixed version (ground truth):
/** 
 * * FUNCTION NAME: leftMostNE                                                    * PURPOSE:       Determine the point with minimum x-coordinate among           all points {p ∈ P | xmin ≤ p.x ∧ ymin ≤ p.y}                  * PARAMETERS                                                                   Type/Name:   double/xmin                                                   Description: The minimum x coordinate to consider                          * Type/Name:   double/ymin                                                   Description: The minimum y coordinate to consider                          * RETURN:        The PSTPoint with minimum x-coordinate within given           boundaries.                                                   
 */
public PSTPoint leftMostNE(double xmin,double ymin){
  PSTPoint best=new PSTPoint(Double.POSITIVE_INFINITY,Double.POSITIVE_INFINITY);
  int indexP=1;
  int indexQ=1;
  while (!isLeaf(indexP)) {
    PSTPoint p=getPoint(indexP);
    if (xmin <= p.getX() && p.getY() >= ymin && p.getX() < best.getX())     best=p;
    PSTPoint q=getPoint(indexQ);
    if (xmin <= q.getX() && q.getY() >= ymin && q.getX() < best.getX())     best=q;
    if (indexP == indexQ) {
      if (numberOfChildren(indexP) == 1) {
        indexQ=indexOfLeftChild(indexP);
        indexP=indexOfLeftChild(indexP);
      }
 else {
        indexQ=indexOfRightChild(indexP);
        indexP=indexOfLeftChild(indexP);
      }
    }
 else {
      if (isLeaf(indexQ))       indexQ=indexP;
 else       if (numberOfChildren(indexQ) == 1) {
        PSTPoint ql=getPoint(indexOfLeftChild(indexQ));
        PSTPoint pr=getPoint(indexOfRightChild(indexP));
        if (ql.getY() < ymin) {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
 else         if (pr.getY() < ymin) {
          indexP=indexOfLeftChild(indexP);
          indexQ=indexOfLeftChild(indexQ);
        }
 else         if (ql.getX() < xmin) {
          indexP=indexOfLeftChild(indexQ);
          indexQ=indexOfLeftChild(indexQ);
        }
 else         if (pr.getX() < xmin) {
          indexP=indexOfRightChild(indexP);
          indexQ=indexOfLeftChild(indexQ);
        }
 else {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
      }
 else {
        PSTPoint ql=getPoint(indexOfLeftChild(indexQ));
        PSTPoint pr=getPoint(indexOfRightChild(indexP));
        PSTPoint pl=getPoint(indexOfLeftChild(indexP));
        if (pr.getX() >= xmin && pr.getY() >= ymin) {
          indexQ=indexOfRightChild(indexP);
          indexP=indexOfLeftChild(indexP);
        }
 else         if (pr.getX() < xmin) {
          if (ql.getX() < xmin) {
            indexP=indexOfLeftChild(indexQ);
            indexQ=indexOfRightChild(indexQ);
          }
 else           if (ql.getY() < ymin) {
            indexP=indexOfRightChild(indexP);
            indexQ=indexOfRightChild(indexQ);
          }
 else {
            indexP=indexOfRightChild(indexP);
            indexQ=indexOfLeftChild(indexQ);
          }
        }
 else {
          if (pl.getY() < ymin) {
            indexP=indexOfLeftChild(indexQ);
            indexQ=indexOfRightChild(indexQ);
          }
 else {
            indexP=indexOfLeftChild(indexP);
            if (ql.getY() >= ymin)             indexQ=indexOfLeftChild(indexQ);
 else             indexQ=indexOfRightChild(indexQ);
          }
        }
      }
    }
  }
  PSTPoint p=getPoint(indexP);
  if (xmin <= p.getX() && p.getY() >= ymin && p.getX() < best.getX())   best=p;
  PSTPoint q=getPoint(indexQ);
  if (xmin <= q.getX() && q.getY() >= ymin && q.getX() < best.getX())   best=q;
  return best;
}