private void generalSelectMetricHistory ( final LinkedList < InMemoryHistoryNode > selectedLists ) { logger . debug ( "selecting snapshots evenly from across the time interval" ) ; if ( selectedLists . size ( ) > this . numInstances ) { final double step = ( double ) selectedLists . size ( ) / this . numInstances ; long nextIndex = 0 , currentIndex = 0 , numSelectedInstances = 1 ; final Iterator < InMemoryHistoryNode > ite = selectedLists . iterator ( ) ; while ( ite . hasNext ( ) ) { ite . next ( ) ; if ( currentIndex == nextIndex ) { nextIndex = ( long ) Math . floor ( numSelectedInstances * step + 0.5 ) ; numSelectedInstances ++ ; } else { ite . remove ( ) ; } currentIndex ++ ; } } }
filter snapshots by evenly selecting points across the interval