question: private int findOrCreateHeapIdx ( int cmid ) { if ( cmid >= map . length ) { growHeapMap ( cmid ) ; } int index = map [ cmid ] ; if ( index == 0 ) { index = nextIndex ++ ; if ( index >= counts . length ) { growHeap ( ) ; } counts [ index ] = 0.0 ; cmids [ index ] = cmid ; map [ cmid ] = index ; } return index ; }
target:  Either find the index that is already being used to hold the counts for cmid or allocate a new entry in the heap for cmid.