private static boolean subsumedBy ( BlocksGroup group1 , BlocksGroup group2 , int indexCorrection ) { List < Block > list1 = group1 . blocks ; List < Block > list2 = group2 . blocks ; int i = 0 ; int j = 0 ; while ( i < list1 . size ( ) && j < list2 . size ( ) ) { Block block1 = list1 . get ( i ) ; Block block2 = list2 . get ( j ) ; int c = RESOURCE_ID_COMPARATOR . compare ( block1 . getResourceId ( ) , block2 . getResourceId ( ) ) ; if ( c != 0 ) { j ++ ; continue ; } c = block1 . getIndexInFile ( ) - indexCorrection - block2 . getIndexInFile ( ) ; if ( c < 0 ) { // list1[i] < list2[j] break ; } if ( c != 0 ) { // list1[i] != list2[j] j ++ ; } if ( c == 0 ) { // list1[i] == list2[j] i ++ ; j ++ ; } } return i == list1 . size ( ) ; }
One group is subsumed by another group when each block from first group has corresponding block from second group with same resource id and with corrected index .