Buggy code:
@ Reference ( authors = "T.<seq2seq4repair_space>Zaeschke,<seq2seq4repair_space>C.<seq2seq4repair_space>Zimmerli,<seq2seq4repair_space>M.C.<seq2seq4repair_space>Norrie" , title = "The<seq2seq4repair_space>PH-Tree<seq2seq4repair_space>--<seq2seq4repair_space>A<seq2seq4repair_space>Space-Efficient<seq2seq4repair_space>Storage<seq2seq4repair_space>Structure<seq2seq4repair_space>and<seq2seq4repair_space>Multi-Dimensional<seq2seq4repair_space>Index" , booktitle = "Proc.<seq2seq4repair_space>Intl.<seq2seq4repair_space>Conf.<seq2seq4repair_space>on<seq2seq4repair_space>Management<seq2seq4repair_space>of<seq2seq4repair_space>Data<seq2seq4repair_space>(SIGMOD'14),<seq2seq4repair_space>2014" , url = "http:////dx.doi.org//10.1145//361002.361007" ) public class MemoryPHTree < O extends NumberVector > extends AbstractIndex < O > implements DynamicIndex , KNNIndex < O > , RangeIndex < O > { private static final Logging LOG = Logging . getLogger ( MemoryPHTree . class ) ; ArrayModifiableDBIDs sorted = null ; private final PhTreeF < DBID > tree ; private int dims = - 1 ; private final Counter objaccess ; private final Counter distcalc ; public MemoryPHTree ( Relation < O > relation ) { } @ Override public void initialize ( ) { } @ Override public String getLongName ( ) { } @ Override public String getShortName ( ) { } @ Override public void logStatistics ( ) { } protected void countObjectAccess ( ) { } protected void countDistanceComputation ( ) { } @ Override public KNNQuery < O > getKNNQuery ( DistanceQuery < O > distanceQuery , Object ... hints ) { } @ Override public RangeQuery < O > getRangeQuery ( DistanceQuery < O > distanceQuery , Object ... hints ) { } public class PHTreeKNNQuery extends AbstractDistanceKNNQuery < O > { private Norm < ? super O > norm ; public PHTreeKNNQuery ( DistanceQuery < O > distanceQuery , Norm < ? super O > norm ) { } @ Override public KNNList getKNNForObject ( O obj , int k ) { final KNNHeap knns = DBIDUtil . newHeap ( k ) ; <START_BUG> for ( double [ ] v : tree . nearestNeighbour ( 0 , oToDouble ( obj , new double [ dims ] ) ) ) { <END_BUG> DBID id = tree . get ( v ) ; O o2 = relation . get ( id ) ; double distance = norm . distance ( obj , o2 ) ; knns . insert ( distance , id ) ; } return knns . toKNNList ( ) ; } } public class PHTreeRangeQuery extends AbstractDistanceRangeQuery < O > { private Norm < ? super O > norm ; private PhQueryF < DBID > query ; private final double [ ] min ; private final double [ ] max ; public PHTreeRangeQuery ( DistanceQuery < O > distanceQuery , Norm < ? super O > norm ) { } @ Override public void getRangeForObject ( O obj , double range , ModifiableDoubleDBIDList result ) { } } @ Alias ( { "miniph" , "ph" } ) public static class Factory < O extends NumberVector > implements IndexFactory < O , MemoryPHTree < O > > { public Factory ( ) { } @ Override public MemoryPHTree < O > instantiate ( Relation < O > relation ) { } @ Override public TypeInformation getInputTypeRestriction ( ) { } public static class Parametrizer extends AbstractParameterizer { @ Override protected MemoryPHTree . Factory < NumberVector > makeInstance ( ) { } } } @ Override public boolean delete ( DBIDRef id ) { } @ Override public void insert ( DBIDRef id ) { } @ Override public void deleteAll ( DBIDs ids ) { } @ Override public void insertAll ( DBIDs ids ) { } private double [ ] oToDouble ( O o , double [ ] v ) { } }

Fix:
for ( double [ ] v : tree . nearestNeighbour ( k , oToDouble ( obj , new double [ dims ] ) ) ) {