test_class.declarator: DEFLATE_COMPRESSION_METHOD = 8
test_class.modifier: private static final
test_class.original_string: private static final int DEFLATE_COMPRESSION_METHOD = 8;
test_class.type: int
test_class.var_name: DEFLATE_COMPRESSION_METHOD
test_class.declarator: UNIMPORTANT = makeFakeEntry("/unimportant", 1337, 1337)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry UNIMPORTANT = makeFakeEntry("/unimportant", 1337, 1337);
test_class.type: MinimalZipEntry
test_class.var_name: UNIMPORTANT
test_class.declarator: ENTRY_A_100K =
        makeFakeEntry("/a/100k", 100 * 1024, 200 * 1024)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry ENTRY_A_100K =
        makeFakeEntry("/a/100k", 100 * 1024, 200 * 1024);
test_class.type: MinimalZipEntry
test_class.var_name: ENTRY_A_100K
test_class.declarator: ENTRY_B_200K =
        makeFakeEntry("/b/200k", 100 * 1024, 300 * 1024)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry ENTRY_B_200K =
        makeFakeEntry("/b/200k", 100 * 1024, 300 * 1024);
test_class.type: MinimalZipEntry
test_class.var_name: ENTRY_B_200K
test_class.declarator: ENTRY_C_300K =
        makeFakeEntry("/c/300k", 100 * 1024, 400 * 1024)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry ENTRY_C_300K =
        makeFakeEntry("/c/300k", 100 * 1024, 400 * 1024);
test_class.type: MinimalZipEntry
test_class.var_name: ENTRY_C_300K
test_class.declarator: ENTRY_D_400K =
        makeFakeEntry("/d/400k", 100 * 1024, 500 * 1024)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry ENTRY_D_400K =
        makeFakeEntry("/d/400k", 100 * 1024, 500 * 1024);
test_class.type: MinimalZipEntry
test_class.var_name: ENTRY_D_400K
test_class.declarator: IGNORED_A = makeFakeEntry("/ignored/a", 1234, 5678)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry IGNORED_A = makeFakeEntry("/ignored/a", 1234, 5678);
test_class.type: MinimalZipEntry
test_class.var_name: IGNORED_A
test_class.declarator: IGNORED_B = makeFakeEntry("/ignored/b", 5678, 9101112)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry IGNORED_B = makeFakeEntry("/ignored/b", 5678, 9101112);
test_class.type: MinimalZipEntry
test_class.var_name: IGNORED_B
test_class.declarator: IGNORED_C = makeFakeEntry("/ignored/c", 9101112, 13141516)
test_class.modifier: private static final
test_class.original_string: private static final MinimalZipEntry IGNORED_C = makeFakeEntry("/ignored/c", 9101112, 13141516);
test_class.type: MinimalZipEntry
test_class.var_name: IGNORED_C
test_class.declarator: REC_A_100K =
        new QualifiedRecommendation(
            ENTRY_A_100K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_BYTES_CHANGED)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_A_100K =
        new QualifiedRecommendation(
            ENTRY_A_100K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_BYTES_CHANGED);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_A_100K
test_class.declarator: REC_B_200K =
        new QualifiedRecommendation(
            ENTRY_B_200K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_OLD,
            RecommendationReason.UNCOMPRESSED_CHANGED_TO_COMPRESSED)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_B_200K =
        new QualifiedRecommendation(
            ENTRY_B_200K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_OLD,
            RecommendationReason.UNCOMPRESSED_CHANGED_TO_COMPRESSED);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_B_200K
test_class.declarator: REC_C_300K =
        new QualifiedRecommendation(
            ENTRY_C_300K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_BYTES_CHANGED)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_C_300K =
        new QualifiedRecommendation(
            ENTRY_C_300K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_BYTES_CHANGED);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_C_300K
test_class.declarator: REC_D_400K =
        new QualifiedRecommendation(
            ENTRY_D_400K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_CHANGED_TO_UNCOMPRESSED)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_D_400K =
        new QualifiedRecommendation(
            ENTRY_D_400K,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_BOTH,
            RecommendationReason.COMPRESSED_CHANGED_TO_UNCOMPRESSED);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_D_400K
test_class.declarator: REC_IGNORED_A_UNCHANGED =
        new QualifiedRecommendation(
            IGNORED_A,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.COMPRESSED_BYTES_IDENTICAL)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_IGNORED_A_UNCHANGED =
        new QualifiedRecommendation(
            IGNORED_A,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.COMPRESSED_BYTES_IDENTICAL);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_IGNORED_A_UNCHANGED
test_class.declarator: REC_IGNORED_B_BOTH_UNCOMPRESSED =
        new QualifiedRecommendation(
            IGNORED_B,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.BOTH_ENTRIES_UNCOMPRESSED)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_IGNORED_B_BOTH_UNCOMPRESSED =
        new QualifiedRecommendation(
            IGNORED_B,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.BOTH_ENTRIES_UNCOMPRESSED);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_IGNORED_B_BOTH_UNCOMPRESSED
test_class.declarator: REC_IGNORED_C_UNSUITABLE =
        new QualifiedRecommendation(
            IGNORED_C,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.UNSUITABLE)
test_class.modifier: private static final
test_class.original_string: private static final QualifiedRecommendation REC_IGNORED_C_UNSUITABLE =
        new QualifiedRecommendation(
            IGNORED_C,
            UNIMPORTANT,
            Recommendation.UNCOMPRESS_NEITHER,
            RecommendationReason.UNSUITABLE);
test_class.type: QualifiedRecommendation
test_class.var_name: REC_IGNORED_C_UNSUITABLE
test_class.declarator: ALL_IGNORED_RECS =
        Collections.unmodifiableList(
            Arrays.asList(
                REC_IGNORED_A_UNCHANGED, REC_IGNORED_B_BOTH_UNCOMPRESSED, REC_IGNORED_C_UNSUITABLE))
test_class.modifier: private static final
test_class.original_string: private static final List<QualifiedRecommendation> ALL_IGNORED_RECS =
        Collections.unmodifiableList(
            Arrays.asList(
                REC_IGNORED_A_UNCHANGED, REC_IGNORED_B_BOTH_UNCOMPRESSED, REC_IGNORED_C_UNSUITABLE));
test_class.type: List<QualifiedRecommendation>
test_class.var_name: ALL_IGNORED_RECS
test_class.declarator: ALL_RECS =
        Collections.unmodifiableList(
            Arrays.asList(
                REC_IGNORED_A_UNCHANGED,
                REC_A_100K,
                REC_IGNORED_B_BOTH_UNCOMPRESSED,
                REC_D_400K,
                REC_IGNORED_C_UNSUITABLE,
                REC_B_200K,
                REC_C_300K))
test_class.modifier: private static final
test_class.original_string: private static final List<QualifiedRecommendation> ALL_RECS =
        Collections.unmodifiableList(
            Arrays.asList(
                REC_IGNORED_A_UNCHANGED,
                REC_A_100K,
                REC_IGNORED_B_BOTH_UNCOMPRESSED,
                REC_D_400K,
                REC_IGNORED_C_UNSUITABLE,
                REC_B_200K,
                REC_C_300K));
test_class.type: List<QualifiedRecommendation>
test_class.var_name: ALL_RECS
test_class.declarator: tempFile = null
test_class.modifier: private
test_class.original_string: private File tempFile = null;
test_class.type: File
test_class.var_name: tempFile
test_class.file: feya/libraries/archive_diff/diff.generator/src/test/java/com/google/archivepatcher/generator/DeltaFriendlyOldBlobSizeLimiterTest.java
test_class.identifier: DeltaFriendlyOldBlobSizeLimiterTest
test_case.body: @Test
    public void testMaxLimit() {
      DeltaFriendlyOldBlobSizeLimiter limiter = new DeltaFriendlyOldBlobSizeLimiter(Long.MAX_VALUE);
      assertEquivalence(ALL_RECS, limiter.getModifiedRecommendations(tempFile, tempFile, ALL_RECS));
    }
test_case.class_method_signature: DeltaFriendlyOldBlobSizeLimiterTest.testMaxLimit()
test_case.full_signature: @Test public void testMaxLimit()
test_case.identifier: testMaxLimit
test_case.invocations: assertEquivalence getModifiedRecommendations
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMaxLimit()
focal_class.declarator: maxSizeBytes
focal_class.modifier: private final
focal_class.original_string: private final long maxSizeBytes;
focal_class.type: long
focal_class.var_name: maxSizeBytes
focal_class.declarator: COMPARATOR =
        new UncompressedOldEntrySizeComparator()
focal_class.modifier: private static final
focal_class.original_string: private static final Comparator<QualifiedRecommendation> COMPARATOR =
        new UncompressedOldEntrySizeComparator();
focal_class.type: Comparator<QualifiedRecommendation>
focal_class.var_name: COMPARATOR
focal_class.file: feya/libraries/archive_diff/diff.generator/src/main/java/com/google/archivepatcher/generator/DeltaFriendlyOldBlobSizeLimiter.java
focal_class.identifier: DeltaFriendlyOldBlobSizeLimiter
focal_class.interfaces: implements RecommendationModifier
focal_class.class_method_signature: DeltaFriendlyOldBlobSizeLimiter.DeltaFriendlyOldBlobSizeLimiter(long maxSizeBytes)
focal_class.full_signature: public  DeltaFriendlyOldBlobSizeLimiter(long maxSizeBytes)
focal_class.identifier: DeltaFriendlyOldBlobSizeLimiter
focal_class.modifiers: public
focal_class.parameters: (long maxSizeBytes)
focal_class.signature:  DeltaFriendlyOldBlobSizeLimiter(long maxSizeBytes)
focal_class.class_method_signature: DeltaFriendlyOldBlobSizeLimiter.getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_class.full_signature: @Override public List<QualifiedRecommendation> getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_class.identifier: getModifiedRecommendations
focal_class.modifiers: @Override public
focal_class.parameters: (
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_class.return: List<QualifiedRecommendation>
focal_class.signature: List<QualifiedRecommendation> getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_class.class_method_signature: DeltaFriendlyOldBlobSizeLimiter.sortRecommendations(
        List<QualifiedRecommendation> originalRecommendations)
focal_class.full_signature: private static List<QualifiedRecommendation> sortRecommendations(
        List<QualifiedRecommendation> originalRecommendations)
focal_class.identifier: sortRecommendations
focal_class.modifiers: private static
focal_class.parameters: (
        List<QualifiedRecommendation> originalRecommendations)
focal_class.return: List<QualifiedRecommendation>
focal_class.signature: List<QualifiedRecommendation> sortRecommendations(
        List<QualifiedRecommendation> originalRecommendations)
focal_method.body: @Override
    public List<QualifiedRecommendation> getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations) {
  
      List<QualifiedRecommendation> sorted = sortRecommendations(originalRecommendations);
  
      List<QualifiedRecommendation> result = new ArrayList<>(sorted.size());
      long bytesRemaining = maxSizeBytes - oldFile.length();
      for (QualifiedRecommendation originalRecommendation : sorted) {
        if (!originalRecommendation.getRecommendation().uncompressOldEntry) {
          // Keep the original recommendation, no need to track size since it won't be uncompressed.
          result.add(originalRecommendation);
        } else {
          long extraBytesConsumed =
              originalRecommendation.getOldEntry().getUncompressedSize()
                  - originalRecommendation.getOldEntry().getCompressedSize();
          if (bytesRemaining - extraBytesConsumed >= 0) {
            // Keep the original recommendation, but also subtract from the remaining space.
            result.add(originalRecommendation);
            bytesRemaining -= extraBytesConsumed;
          } else {
            // Update the recommendation to prevent uncompressing this tuple.
            result.add(
                new QualifiedRecommendation(
                    originalRecommendation.getOldEntry(),
                    originalRecommendation.getNewEntry(),
                    Recommendation.UNCOMPRESS_NEITHER,
                    RecommendationReason.RESOURCE_CONSTRAINED));
          }
        }
      }
      return result;
    }
focal_method.class_method_signature: DeltaFriendlyOldBlobSizeLimiter.getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_method.full_signature: @Override public List<QualifiedRecommendation> getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_method.identifier: getModifiedRecommendations
focal_method.invocations: sortRecommendations size length getRecommendation add getUncompressedSize getOldEntry getCompressedSize getOldEntry add add getOldEntry getNewEntry
focal_method.modifiers: @Override public
focal_method.parameters: (
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)
focal_method.return: List<QualifiedRecommendation>
focal_method.signature: List<QualifiedRecommendation> getModifiedRecommendations(
        File oldFile, File newFile, List<QualifiedRecommendation> originalRecommendations)