private int [ ] determinePower2Alpha_Buckets_Sarray_Sptrmap ( int q ) { int strLen = length ; int exp2 = kbs_getExp_Ulong ( 2 , alphabet . size ) ; if ( exp2 < 0 ) { throw new RuntimeException ( "value out of bounds" ) ; } int [ ] buckets = determinePower2Alpha_Buckets_Sarray ( q ) ; this . sufPtrMap = new int [ strLen + 2 * q + 1 ] ; int mappedUcharArray = 0 ; int hashCode = 0 ; int j ; for ( j = 0 ; j < q ; j ++ ) { hashCode = hashCode << exp2 ; hashCode += seq [ start + mappedUcharArray + j ] ; } int tempModulo = 0 ; tempModulo = ~ tempModulo ; tempModulo = tempModulo << ( exp2 * ( q - 1 ) ) ; tempModulo = ~ tempModulo ; mappedUcharArray += q ; for ( j = 0 ; j < strLen - 1 ; j ++ ) { sufPtrMap [ j ] = ( buckets [ hashCode + 1 ] ) - 1 ; hashCode = hashCode & tempModulo ; hashCode = hashCode << exp2 ; hashCode = hashCode | seq [ start + mappedUcharArray ] ; mappedUcharArray ++ ; } sufPtrMap [ j ] = buckets [ hashCode ] ; int beginPtr = - 1 ; for ( j = strLen ; j <= strLen + 2 * q ; j ++ ) { sufPtrMap [ j ] = beginPtr -- ; } return buckets ; }
Constructs all buckets w . r . t . q - gram size q the up to prefix length q sorted suffix array and the bucket - pointer table .