private static void partialMatch(DimensionalNode node,boolean[] relevant,double[] keys,ArrayList<IMultiPoint> results){
  IMultiPoint pt=node.point;
  boolean match=true;
  for (int i=0; i < relevant.length; i++) {
    if (!relevant[i])     continue;
    if (!FloatingPoint.same(pt.getCoordinate(i + 1),keys[i])) {
      match=false;
      break;
    }
  }
  if (match) {
    results.add(pt);
  }
  int d=node.dimension;
  if (relevant[d - 1]) {
    if (FloatingPoint.lesserEquals(keys[d - 1],pt.getCoordinate(d))) {
      DimensionalNode below=node.getBelow();
      if (below != null) {
        partialMatch(below,relevant,keys,results);
      }
    }
    if (FloatingPoint.greaterEquals(keys[d - 1],pt.getCoordinate(d))) {
      DimensionalNode above=node.getAbove();
      if (above != null) {
        partialMatch(above,relevant,keys,results);
      }
    }
  }
 else {
    DimensionalNode below=node.getBelow();
    if (below != null) {
      partialMatch(below,relevant,keys,results);
    }
    DimensionalNode above=node.getAbove();
    if (above != null) {
      partialMatch(above,relevant,keys,results);
    }
  }
}

private static void partialMatch ( DimensionalNode node , boolean [ ] relevant , double [ ] keys , ArrayList < IMultiPoint > results ) { IMultiPoint pt = node . point ; boolean match = true ; for ( int i = 0 ; i < relevant . length ; i ++ ) { if ( ! relevant [ i ] ) continue ; if ( ! FloatingPoint . same ( pt . getCoordinate ( i + 1 ) , keys [ i ] ) ) { match = false ; break ; } } if ( match ) { results . add ( pt ) ; } int d = node . dimension ; if ( relevant [ d - 1 ] ) { if ( FloatingPoint . lesserEquals ( keys [ d - 1 ] , pt . getCoordinate ( d ) ) ) { DimensionalNode below = node . getBelow ( ) ; if ( below != null ) { partialMatch ( below , relevant , keys , results ) ; } } if ( FloatingPoint . greaterEquals ( keys [ d - 1 ] , pt . getCoordinate ( d ) ) ) { DimensionalNode above = node . getAbove ( ) ; if ( above != null ) { partialMatch ( above , relevant , keys , results ) ; } } } else { DimensionalNode below = node . getBelow ( ) ; if ( below != null ) { partialMatch ( below , relevant , keys , results ) ; } DimensionalNode above = node . getAbove ( ) ; if ( above != null ) { partialMatch ( above , relevant , keys , results ) ; } } }
description of algorithm taken from bentley ' s original paper .
