private void initialize ( ) { String lastRefType = this . fieldPath . getLastRefTypeInPath ( ) ; // get all cardinality to estimate size of array bits needed. totalWords = readStateEngine . getTypeState ( lastRefType ) . getPopulatedOrdinals ( ) . cardinality ( ) ; averageWordLen = 0 ; double avg = 0 ; HollowObjectTypeReadState objectTypeReadState = ( HollowObjectTypeReadState ) readStateEngine . getTypeState ( lastRefType ) ; BitSet keyBitSet = objectTypeReadState . getPopulatedOrdinals ( ) ; int ordinal = keyBitSet . nextSetBit ( 0 ) ; while ( ordinal != - 1 ) { avg += ( ( double ) objectTypeReadState . readString ( ordinal , 0 ) . length ( ) ) / ( ( double ) objectTypeReadState . maxOrdinal ( ) ) ; ordinal = keyBitSet . nextSetBit ( ordinal + 1 ) ; } averageWordLen = ( int ) Math . ceil ( avg ) ; HollowObjectTypeReadState valueState = ( HollowObjectTypeReadState ) readStateEngine . getTypeDataAccess ( type ) ; maxOrdinalOfType = valueState . maxOrdinal ( ) ; // initialize the prefix index. build ( ) ; }
initialize field positions and field paths .