Package org.spdx.utility.compare
Class SpdxItemComparer
java.lang.Object
org.spdx.utility.compare.SpdxItemComparer
- Direct Known Subclasses:
SpdxFileComparer,SpdxPackageComparer,SpdxSnippetComparer
public class SpdxItemComparer extends Object
Compares two SPDX items. The
compare(itemA, itemB) method will perform the comparison and
store the results. isDifferenceFound() will return true of any
differences were found.- Author:
- Gary
-
Field Summary
Fields Modifier and Type Field Description protected Map<SpdxDocument,SpdxItem>documentItemMap of SPDX document to Itemsprotected Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>>extractedLicenseIdMapMapping of all extracted license info ID's between all SPDX documents included in the comparerprotected Stringname -
Constructor Summary
Constructors Constructor Description SpdxItemComparer(Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>> extractedLicenseIdMap) -
Method Summary
Modifier and Type Method Description voidaddDocumentItem(SpdxDocument spdxDocument, SpdxItem spdxItem)Add a new item to the comparer and compare the contents of the item to all items which have been previously addedprotected voidcheckCompareMade()protected voidcheckInProgress()checks to make sure there is not a compare in progressSpdxItemgetItem(SpdxDocument doc)Get the item contained by the document docList<Annotation>getUniqueAnnotations(SpdxDocument docA, SpdxDocument docB)Get annotations that are in docA but not in docBList<Relationship>getUniqueRelationship(SpdxDocument docA, SpdxDocument docB)Get relationships that are in docA but not in docBList<AnyLicenseInfo>getUniqueSeenLicenses(SpdxDocument docA, SpdxDocument docB)Get any licenses found in docA but not in docBbooleanisAnnotationsEquals()booleanisAttributionTextEquals()booleanisCommentsEquals()booleanisConcludedLicenseEquals()booleanisCopyrightsEquals()booleanisDifferenceFound()booleanisInProgress()booleanisLicenseCommmentsEquals()booleanisRelationshipsEquals()booleanisSeenLicenseEquals()
-
Field Details
-
name
-
documentItem
Map of SPDX document to Items -
extractedLicenseIdMap
Mapping of all extracted license info ID's between all SPDX documents included in the comparer
-
-
Constructor Details
-
SpdxItemComparer
public SpdxItemComparer(Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>> extractedLicenseIdMap)
-
-
Method Details
-
addDocumentItem
public void addDocumentItem(SpdxDocument spdxDocument, SpdxItem spdxItem) throws SpdxCompareException, InvalidSPDXAnalysisExceptionAdd a new item to the comparer and compare the contents of the item to all items which have been previously added- Parameters:
spdxDocument-spdxItem-- Throws:
SpdxCompareExceptionInvalidSPDXAnalysisException
-
isConcludedLicenseEquals
- Returns:
- the concludedLicenseEquals
- Throws:
SpdxCompareException
-
isSeenLicenseEquals
- Returns:
- the seenLicenseEquals
- Throws:
SpdxCompareException
-
getUniqueSeenLicenses
public List<AnyLicenseInfo> getUniqueSeenLicenses(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionGet any licenses found in docA but not in docB- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-
isCommentsEquals
- Returns:
- the commentsEquals
- Throws:
SpdxCompareException
-
isCopyrightsEquals
- Returns:
- the copyrightsEquals
- Throws:
SpdxCompareException
-
isLicenseCommmentsEquals
- Returns:
- the licenseCommmentsEquals
- Throws:
SpdxCompareException
-
checkInProgress
checks to make sure there is not a compare in progress- Throws:
SpdxCompareException
-
checkCompareMade
- Throws:
SpdxCompareException- if no comparisons have been made
-
isDifferenceFound
- Returns:
- Throws:
SpdxCompareException
-
isInProgress
- Returns:
- the inProgress
- Throws:
SpdxCompareException
-
getItem
Get the item contained by the document doc- Parameters:
doc-- Returns:
- Throws:
SpdxCompareException
-
isRelationshipsEquals
- Returns:
- the relationshipsEquals
- Throws:
SpdxCompareException
-
getUniqueRelationship
public List<Relationship> getUniqueRelationship(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionGet relationships that are in docA but not in docB- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-
isAnnotationsEquals
- Returns:
- the annotationsEquals
- Throws:
SpdxCompareException
-
isAttributionTextEquals
- Returns:
- the attributionTextEquals
- Throws:
SpdxCompareException
-
getUniqueAnnotations
public List<Annotation> getUniqueAnnotations(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionGet annotations that are in docA but not in docB- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-