private void appendFill ( int length , int fillType ) { assert length > 0 ; assert lastWordIndex >= - 1 ; fillType &= ConciseSetUtils . SEQUENCE_BIT ; // it is actually a literal... if ( length == 1 ) { appendLiteral ( fillType == 0 ? ConciseSetUtils . ALL_ZEROS_LITERAL : ConciseSetUtils . ALL_ONES_LITERAL ) ; return ; } // empty set if ( lastWordIndex < 0 ) { words [ lastWordIndex = 0 ] = fillType | ( length - 1 ) ; return ; } final int lastWord = words [ lastWordIndex ] ; if ( isLiteral ( lastWord ) ) { if ( fillType == 0 && lastWord == ConciseSetUtils . ALL_ZEROS_LITERAL ) { words [ lastWordIndex ] = length ; } else if ( fillType == ConciseSetUtils . SEQUENCE_BIT && lastWord == ConciseSetUtils . ALL_ONES_LITERAL ) { words [ lastWordIndex ] = ConciseSetUtils . SEQUENCE_BIT | length ; } else if ( ! simulateWAH ) { if ( fillType == 0 && containsOnlyOneBit ( getLiteralBits ( lastWord ) ) ) { words [ lastWordIndex ] = length | ( ( 1 + Integer . numberOfTrailingZeros ( lastWord ) ) << 25 ) ; } else if ( fillType == ConciseSetUtils . SEQUENCE_BIT && containsOnlyOneBit ( ~ lastWord ) ) { words [ lastWordIndex ] = ConciseSetUtils . SEQUENCE_BIT | length | ( ( 1 + Integer . numberOfTrailingZeros ( ~ lastWord ) ) << 25 ) ; } else { words [ ++ lastWordIndex ] = fillType | ( length - 1 ) ; } } else { words [ ++ lastWordIndex ] = fillType | ( length - 1 ) ; } } else { if ( ( lastWord & 0xC0000000 ) == fillType ) { words [ lastWordIndex ] += length ; } else { words [ ++ lastWordIndex ] = fillType | ( length - 1 ) ; } } }
Append a sequence word after the last word