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 files. Thecompare(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 void
addDocumentFile(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 void
checkInProgress()
checks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxFile
getFile(org.spdx.library.model.v2.SpdxDocument spdxDocument)
SpdxFileDifference
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 Bboolean
isChecksumsEquals()
boolean
isContributorsEquals()
boolean
isDifferenceFound()
boolean
isNoticeTextEquals()
boolean
isTypesEquals()
-
Methods inherited from class org.spdx.utility.compare.SpdxItemComparer
addDocumentItem, checkCompareMade, getItem, getUniqueAnnotations, getUniqueRelationship, getUniqueSeenLicenses, isAnnotationsEquals, isAttributionTextEquals, isCommentsEquals, isConcludedLicenseEquals, isCopyrightsEquals, isInProgress, 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.InvalidSPDXAnalysisException
Add a file to the comparer and compare to the existing files- Parameters:
spdxDocument
- document containing the filespdxFile
-- Throws:
SpdxCompareException
org.spdx.core.InvalidSPDXAnalysisException
-
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
-docB
-- Returns:
- Throws:
SpdxCompareException
-
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 classSpdxItemComparer
- Throws:
SpdxCompareException
-
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 classSpdxItemComparer
- Returns:
- Throws:
SpdxCompareException
-
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
-docB
-- Returns:
- Throws:
SpdxCompareException
-
-