private int [ ] determineAll_Buckets_Sarray_Sptrmap ( int q ) { int [ ] buckets = determineAll_Buckets_Sarray ( q ) ; int strLen = length ; sufPtrMap = new int [ strLen + 2 * q + 1 ] ; /* computation of first hashvalue */ int alphabetSize = alphabet . size ; int mappedUcharArray = 0 ; int tempPower = 1 ; int hashCode = 0 ; int i ; for ( i = q - 1 ; i >= 0 ; i -- ) { hashCode += seq [ start + mappedUcharArray + i ] * tempPower ; tempPower *= alphabetSize ; } int tempModulo = kbs_power_Ulong ( alphabetSize , q - 1 ) ; mappedUcharArray += q ; int j ; for ( j = 0 ; j < strLen - 1 ; j ++ ) { sufPtrMap [ j ] = ( buckets [ hashCode + 1 ] ) - 1 ; hashCode -= ( seq [ start + mappedUcharArray - q ] ) * tempModulo ; hashCode *= alphabetSize ; hashCode += seq [ start + mappedUcharArray ] ; mappedUcharArray ++ ; } sufPtrMap [ j ] = buckets [ hashCode ] ; /* set the values in sufPtrMap[strLen..strLen+2*d] to [-1, -2, ..., -2*d] */ 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 q sorted suffix array and the bucket - pointer table .