/**
   * Sorts the entries of the specified node according to their minimum distance
   * to the specified object.
   *
   * @param node the node
   * @param q the query object
   * @param distanceFunction the distance function for computing the distances
   * @return a list of the sorted entries
   */
// TODO: move somewhere else?
protected List<DoubleObjPair<RdKNNEntry>> getSortedEntries(AbstractRStarTreeNode<?, ?> node, SpatialComparable q, SpatialPrimitiveDistanceFunction<?> distanceFunction) {
    List<DoubleObjPair<RdKNNEntry>> result = new ArrayList<>();
    for(int i = 0; i < node.getNumEntries(); i++) {
      RdKNNEntry entry = (RdKNNEntry) node.getEntry(i);
      double minDist = distanceFunction.minDist(entry, q);
      result.add(new DoubleObjPair<>(minDist, entry));
    }
    Collections.sort(result);
    return result;
  }
protected List<DoubleObjPair<RdKNNEntry>> getSortedEntries(AbstractRStarTreeNode<?, ?> node, SpatialComparable q, SpatialPrimitiveDistanceFunction<?> distanceFunction) {
List<DoubleObjPair<RdKNNEntry>> result = new ArrayList<>();
for(int i = 0; i < node.getNumEntries(); i++) {
RdKNNEntry entry = (RdKNNEntry) node.getEntry(i);
double minDist = distanceFunction.minDist(entry, q);
result.add(new DoubleObjPair<>(minDist, entry));
}
Collections.sort(result);
return result;
}
protected List<DoubleObjPair<RdKNNEntry>> getSortedEntries(AbstractRStarTreeNode<?, ?> node, SpatialComparable q, SpatialPrimitiveDistanceFunction<?> distanceFunction) {
List<DoubleObjPair<RdKNNEntry>> result = new ArrayList<>();
for(int i = 0; i < node.getNumEntries(); i++) {
RdKNNEntry entry = (RdKNNEntry) node.getEntry(i);
double minDist = distanceFunction.minDist(entry, q);
result.add(new DoubleObjPair<>(minDist, entry));
}
Collections.sort(result);
return result;
}
protected List<DoubleObjPair<RdKNNEntry>> getSortedEntries(AbstractRStarTreeNode<?, ?> node, SpatialComparable q, SpatialPrimitiveDistanceFunction<?> distanceFunction) {
List<DoubleObjPair<RdKNNEntry>> result = new ArrayList<>();
for(int i = 0; i < node.getNumEntries(); i++) {
RdKNNEntry entry = (RdKNNEntry) node.getEntry(i);
double minDist = distanceFunction.minDist(entry, q);
result.add(new DoubleObjPair<>(minDist, entry));
}
Collections.sort(result);
return result;
}