private void verifyReplacementRange ( SegmentWithRange replacedSegment , StreamSegmentsWithPredecessors replacementSegments ) { log . debug ( "Verification of replacement segments {} with the current segments {}" , replacementSegments , segments ) ; Map < Long , List < SegmentWithRange > > replacementRanges = replacementSegments . getReplacementRanges ( ) ; List < SegmentWithRange > replacements = replacementRanges . get ( replacedSegment . getSegment ( ) . getSegmentId ( ) ) ; Preconditions . checkArgument ( replacements != null , "Replacement segments did not contain replacements for segment being replaced" ) ; if ( replacementRanges . size ( ) == 1 ) { //Simple split Preconditions . checkArgument ( replacedSegment . getHigh ( ) == getUpperBound ( replacements ) ) ; Preconditions . checkArgument ( replacedSegment . getLow ( ) == getLowerBound ( replacements ) ) ; } else { Preconditions . checkArgument ( replacedSegment . getHigh ( ) <= getUpperBound ( replacements ) ) ; Preconditions . checkArgument ( replacedSegment . getLow ( ) >= getLowerBound ( replacements ) ) ; } for ( Entry < Long , List < SegmentWithRange > > ranges : replacementRanges . entrySet ( ) ) { Entry < Double , SegmentWithRange > upperReplacedSegment = segments . floorEntry ( getUpperBound ( ranges . getValue ( ) ) ) ; Entry < Double , SegmentWithRange > lowerReplacedSegment = segments . higherEntry ( getLowerBound ( ranges . getValue ( ) ) ) ; Preconditions . checkArgument ( upperReplacedSegment != null , "Missing replaced replacement segments %s" , replacementSegments ) ; Preconditions . checkArgument ( lowerReplacedSegment != null , "Missing replaced replacement segments %s" , replacementSegments ) ; } }
Checks that replacementSegments provided are consistent with the segments that are currently being used .