public void recomputeSegmentKeys ( ) throws IOException { if ( ! closed && segmentRegistration != null ) { if ( segmentRegistration . equals ( SEGMENT_SORT_ASC ) || segmentRegistration . equals ( SEGMENT_SORT_DESC ) || segmentRegistration . equals ( SEGMENT_BOUNDARY_ASC ) || segmentRegistration . equals ( SEGMENT_BOUNDARY_DESC ) ) { if ( segmentRegistration . equals ( SEGMENT_SORT_ASC ) || segmentRegistration . equals ( SEGMENT_SORT_DESC ) ) { segmentKeys . clear ( ) ; // recompute boundaries for ( Entry < String , Map < String , T1 > > entry : segmentKeyValueList . entrySet ( ) ) { T1 tmpSegmentValueBoundary = boundaryForSegment ( entry . getKey ( ) ) ; segmentValuesBoundary . put ( entry . getKey ( ) , tmpSegmentValueBoundary ) ; } // compute adjusted boundaries and compute keys for ( Entry < String , Map < String , T1 > > entry : segmentKeyValueList . entrySet ( ) ) { this . segmentName = entry . getKey ( ) ; Map < String , T1 > keyValueList = entry . getValue ( ) ; T1 tmpSegmentValueBoundaryForComputing = boundaryForSegmentComputing ( entry . getKey ( ) ) ; for ( Entry < String , T1 > subEntry : keyValueList . entrySet ( ) ) { if ( tmpSegmentValueBoundaryForComputing == null || compareWithBoundary ( subEntry . getValue ( ) , tmpSegmentValueBoundaryForComputing ) ) { if ( ! segmentKeys . contains ( subEntry . getKey ( ) ) ) { segmentKeys . add ( subEntry . getKey ( ) ) ; } } } } } Map < String , T1 > keyValueList ; Set < String > recomputeKeyList ; segmentRecomputeKeyList = new LinkedHashMap <> ( ) ; for ( String key : segmentKeys ) { for ( Entry < String , Map < String , T1 > > entry : segmentKeyValueList . entrySet ( ) ) { keyValueList = entry . getValue ( ) ; if ( ! keyValueList . containsKey ( key ) ) { if ( ! segmentRecomputeKeyList . containsKey ( entry . getKey ( ) ) ) { recomputeKeyList = new HashSet <> ( ) ; segmentRecomputeKeyList . put ( entry . getKey ( ) , recomputeKeyList ) ; } else { recomputeKeyList = segmentRecomputeKeyList . get ( entry . getKey ( ) ) ; } recomputeKeyList . add ( key ) ; } } } this . segmentName = null ; } else { throw new IOException ( "not for segmentRegistration " + segmentRegistration ) ; } } else { throw new IOException ( "already closed or no segmentRegistration (" + segmentRegistration + ")" ) ; } }
Recompute segment keys .