Class SpdxFileComparer
java.lang.Object
org.spdx.utility.compare.SpdxItemComparer
org.spdx.utility.compare.SpdxFileComparer
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
-
Field Summary
Fields inherited from class org.spdx.utility.compare.SpdxItemComparer
documentItem, extractedLicenseIdMap, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentFile(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxFile spdxFile) Add a file to the comparer and compare to the existing filesprotected voidchecks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxFilegetFile(org.spdx.library.model.v2.SpdxDocument spdxDocument) getFileDifference(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Return a file difference for the file contained in two different documentsList<org.spdx.library.model.v2.Checksum> getUniqueChecksums(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get the checksums which are present in the file contained document A but not in document BbooleanbooleanbooleanbooleanbooleanMethods inherited from class org.spdx.utility.compare.SpdxItemComparer
addDocumentItem, checkCompareMade, getItem, getUniqueAnnotations, getUniqueRelationship, getUniqueSeenLicenses, isAnnotationsEquals, isAttributionTextEquals, isCommentsEquals, isConcludedLicenseEquals, isCopyrightsEquals, isInProgress, isLicenseCommentsEquals, isLicenseCommmentsEquals, isRelationshipsEquals, isSeenLicenseEquals
-
Constructor Details
-
SpdxFileComparer
-
-
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 filespdxFile- file to add- Throws:
SpdxCompareException- on compare errorsorg.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
- 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 comparedocB- 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
- Returns:
- the typesEquals
- Throws:
SpdxCompareException
-
checkInProgress
checks to make sure there is not a compare in progress- Overrides:
checkInProgressin classSpdxItemComparer- Throws:
SpdxCompareException- on compare errors
-
isContributorsEquals
- Returns:
- the contributorsEquals
- Throws:
SpdxCompareException
-
isNoticeTextEquals
- Returns:
- the noticeTextEquals
- Throws:
SpdxCompareException
-
isDifferenceFound
- Overrides:
isDifferenceFoundin classSpdxItemComparer- 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 comparedocB- document containing files to compare- Returns:
- file differences between docA and docB
- Throws:
SpdxCompareException- on compare errors
-