Class SpdxFileComparer

java.lang.Object
org.spdx.utility.compare.SpdxItemComparer
org.spdx.utility.compare.SpdxFileComparer

public class SpdxFileComparer extends SpdxItemComparer
Compares two SPDX files

The compare(fileA, fileB) method will perform the comparison and store the results. isDifferenceFound() will return true of any differences were found.

Author:
Gary O'Neall
  • Constructor Details

    • SpdxFileComparer

      public SpdxFileComparer(Map<org.spdx.library.model.v2.SpdxDocument,Map<org.spdx.library.model.v2.SpdxDocument,Map<String,String>>> extractedLicenseIdMap)
  • Method Details

    • addDocumentFile

      public void addDocumentFile(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxFile spdxFile) throws SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisException
      Add a file to the comparer and compare to the existing files
      Parameters:
      spdxDocument - document containing the file
      spdxFile - file to add
      Throws:
      SpdxCompareException - on compare errors
      org.spdx.core.InvalidSPDXAnalysisException - on SPDX parsing errors
    • getFile

      public org.spdx.library.model.v2.SpdxFile getFile(org.spdx.library.model.v2.SpdxDocument spdxDocument) throws SpdxCompareException
      Throws:
      SpdxCompareException
    • isChecksumsEquals

      public boolean isChecksumsEquals() throws SpdxCompareException
      Returns:
      the checksumsEquals
      Throws:
      SpdxCompareException
    • getUniqueChecksums

      public List<org.spdx.library.model.v2.Checksum> getUniqueChecksums(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException
      Get the checksums which are present in the file contained document A but not in document B
      Parameters:
      docA - document to compare
      docB - document to compare
      Returns:
      the checksums which are present in the file contained document A but not in document B
      Throws:
      SpdxCompareException - on compare errors
    • isTypesEquals

      public boolean isTypesEquals() throws SpdxCompareException
      Returns:
      the typesEquals
      Throws:
      SpdxCompareException
    • checkInProgress

      protected void checkInProgress() throws SpdxCompareException
      checks to make sure there is not a compare in progress
      Overrides:
      checkInProgress in class SpdxItemComparer
      Throws:
      SpdxCompareException - on compare errors
    • isContributorsEquals

      public boolean isContributorsEquals() throws SpdxCompareException
      Returns:
      the contributorsEquals
      Throws:
      SpdxCompareException
    • isNoticeTextEquals

      public boolean isNoticeTextEquals() throws SpdxCompareException
      Returns:
      the noticeTextEquals
      Throws:
      SpdxCompareException
    • isDifferenceFound

      public boolean isDifferenceFound() throws SpdxCompareException
      Overrides:
      isDifferenceFound in class SpdxItemComparer
      Returns:
      true if any differences are found
      Throws:
      SpdxCompareException - on compare errors
    • getFileDifference

      public SpdxFileDifference getFileDifference(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException
      Return a file difference for the file contained in two different documents
      Parameters:
      docA - document containing files to compare
      docB - document containing files to compare
      Returns:
      file differences between docA and docB
      Throws:
      SpdxCompareException - on compare errors