protected IMultiPoint nearest(double[] rawTarget,double min[]){
  IMultiPoint result=null;
  double d=shorter(rawTarget,min[0]);
  if (d >= 0 && d < min[0]) {
    min[0]=d;
    result=point;
  }
  double dp=Math.abs(coord - rawTarget[dimension - 1]);
  IMultiPoint newResult=null;
  int numDblRec=0;
  if (dp < min[0]) {
    if (above != null) {
      numDblRec++;
      newResult=above.nearest(rawTarget,min);
      if (newResult != null) {
        result=newResult;
      }
    }
    if (below != null) {
      numDblRec++;
      newResult=below.nearest(rawTarget,min);
      if (newResult != null) {
        result=newResult;
      }
    }
    if (numDblRec == 2) {
      numDoubleRecursions++;
    }
 else     if (numDblRec == 1) {
      numRecursions++;
    }
  }
 else {
    numRecursions++;
    if (rawTarget[dimension - 1] < coord) {
      if (below != null) {
        newResult=below.nearest(rawTarget,min);
      }
    }
 else {
      if (above != null) {
        newResult=above.nearest(rawTarget,min);
      }
    }
    if (newResult != null) {
      return newResult;
    }
  }
  return result;
}

protected IMultiPoint nearest ( double [ ] rawTarget , double min [ ] ) { IMultiPoint result = null ; double d = shorter ( rawTarget , min [ 0 ] ) ; if ( d >= 0 && d < min [ 0 ] ) { min [ 0 ] = d ; result = point ; } double dp = Math . abs ( coord - rawTarget [ dimension - 1 ] ) ; IMultiPoint newResult = null ; int numDblRec = 0 ; if ( dp < min [ 0 ] ) { if ( above != null ) { numDblRec ++ ; newResult = above . nearest ( rawTarget , min ) ; if ( newResult != null ) { result = newResult ; } } if ( below != null ) { numDblRec ++ ; newResult = below . nearest ( rawTarget , min ) ; if ( newResult != null ) { result = newResult ; } } if ( numDblRec == 2 ) { numDoubleRecursions ++ ; } else if ( numDblRec == 1 ) { numRecursions ++ ; } } else { numRecursions ++ ; if ( rawTarget [ dimension - 1 ] < coord ) { if ( below != null ) { newResult = below . nearest ( rawTarget , min ) ; } } else { if ( above != null ) { newResult = above . nearest ( rawTarget , min ) ; } } if ( newResult != null ) { return newResult ; } } return result ; }
in sub - tree rooted at node , see if one of its descendants is closer to rawtarget than min [ 0 ] . < p > if no descendant improves on the min [ ] result then null is returned .
