Package org.spdx.utility.compare
Class SpdxFileComparer
- java.lang.Object
-
- org.spdx.utility.compare.SpdxItemComparer
-
- org.spdx.utility.compare.SpdxFileComparer
-
public class SpdxFileComparer extends SpdxItemComparer
Compares two SPDX filesThe
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocumentFile(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 voidcheckInProgress()checks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxFilegetFile(org.spdx.library.model.v2.SpdxDocument spdxDocument)SpdxFileDifferencegetFileDifference(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 BbooleanisChecksumsEquals()booleanisContributorsEquals()booleanisDifferenceFound()booleanisNoticeTextEquals()booleanisTypesEquals()-
Methods inherited from class org.spdx.utility.compare.SpdxItemComparer
addDocumentItem, checkCompareMade, getItem, getUniqueAnnotations, getUniqueRelationship, getUniqueSeenLicenses, isAnnotationsEquals, isAttributionTextEquals, isCommentsEquals, isConcludedLicenseEquals, isCopyrightsEquals, isInProgress, isLicenseCommentsEquals, isLicenseCommmentsEquals, isRelationshipsEquals, isSeenLicenseEquals
-
-
-
-
Method Detail
-
addDocumentFile
public void addDocumentFile(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxFile spdxFile) throws SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisExceptionAdd 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
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 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
public boolean isTypesEquals() throws SpdxCompareException- Returns:
- the typesEquals
- Throws:
SpdxCompareException
-
checkInProgress
protected void checkInProgress() throws SpdxCompareExceptionchecks to make sure there is not a compare in progress- Overrides:
checkInProgressin classSpdxItemComparer- 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:
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
-
-