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. 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 Constructor Description SpdxFileComparer(Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>> extractedLicenseIdMap) -
Method Summary
Modifier and Type Method Description voidaddDocumentFile(SpdxDocument spdxDocument, 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 progressSpdxFilegetFile(SpdxDocument spdxDocument)SpdxFileDifferencegetFileDifference(SpdxDocument docA, SpdxDocument docB)Return a file difference for the file contained in two different documentsList<Checksum>getUniqueChecksums(SpdxDocument docA, 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, isLicenseCommmentsEquals, isRelationshipsEquals, isSeenLicenseEquals
-
Constructor Details
-
SpdxFileComparer
public SpdxFileComparer(Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>> extractedLicenseIdMap)
-
-
Method Details
-
addDocumentFile
public void addDocumentFile(SpdxDocument spdxDocument, SpdxFile spdxFile) throws SpdxCompareException, InvalidSPDXAnalysisExceptionAdd a file to the comparer and compare to the existing files- Parameters:
spdxDocument- document containing the filespdxFile-- Throws:
SpdxCompareExceptionInvalidSPDXAnalysisException
-
getFile
- Throws:
SpdxCompareException
-
isChecksumsEquals
- Returns:
- the checksumsEquals
- Throws:
SpdxCompareException
-
getUniqueChecksums
public List<Checksum> getUniqueChecksums(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionGet the checksums which are present in the file contained document A but not in document B- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-
isTypesEquals
- Returns:
- the typesEquals
- Throws:
SpdxCompareException
-
checkInProgress
checks to make sure there is not a compare in progress- Overrides:
checkInProgressin classSpdxItemComparer- Throws:
SpdxCompareException
-
isContributorsEquals
- Returns:
- the contributorsEquals
- Throws:
SpdxCompareException
-
isNoticeTextEquals
- Returns:
- the noticeTextEquals
- Throws:
SpdxCompareException
-
isDifferenceFound
- Overrides:
isDifferenceFoundin classSpdxItemComparer- Returns:
- Throws:
SpdxCompareException
-
getFileDifference
public SpdxFileDifference getFileDifference(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionReturn a file difference for the file contained in two different documents- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-