private static int aggregateDimValue ( final int [ ] positions , final BufferAggregator [ ] theAggregators , final ByteBuffer resultsBuf , final int numBytesPerRecord , final int [ ] aggregatorOffsets , final int aggSize , final int aggExtra , final int dimIndex , int currentPosition ) { if ( SKIP_POSITION_VALUE == positions [ dimIndex ] ) { return currentPosition ; } if ( INIT_POSITION_VALUE == positions [ dimIndex ] ) { positions [ dimIndex ] = currentPosition * numBytesPerRecord ; currentPosition ++ ; final int pos = positions [ dimIndex ] ; for ( int j = 0 ; j < aggSize ; ++ j ) { theAggregators [ j ] . init ( resultsBuf , pos + aggregatorOffsets [ j ] ) ; } } final int position = positions [ dimIndex ] ; switch ( aggExtra ) { case 7 : theAggregators [ 6 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 6 ] ) ; // fall through case 6 : theAggregators [ 5 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 5 ] ) ; // fall through case 5 : theAggregators [ 4 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 4 ] ) ; // fall through case 4 : theAggregators [ 3 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 3 ] ) ; // fall through case 3 : theAggregators [ 2 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 2 ] ) ; // fall through case 2 : theAggregators [ 1 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 1 ] ) ; // fall through case 1 : theAggregators [ 0 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ 0 ] ) ; } for ( int j = aggExtra ; j < aggSize ; j += AGG_UNROLL_COUNT ) { theAggregators [ j ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j ] ) ; theAggregators [ j + 1 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 1 ] ) ; theAggregators [ j + 2 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 2 ] ) ; theAggregators [ j + 3 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 3 ] ) ; theAggregators [ j + 4 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 4 ] ) ; theAggregators [ j + 5 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 5 ] ) ; theAggregators [ j + 6 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 6 ] ) ; theAggregators [ j + 7 ] . aggregate ( resultsBuf , position + aggregatorOffsets [ j + 7 ] ) ; } return currentPosition ; }
Returns a new currentPosition incremented if a new position was initialized otherwise the same position as passed in the last argument .