Class SpdxItemComparer
java.lang.Object
org.spdx.utility.compare.SpdxItemComparer
- Direct Known Subclasses:
SpdxFileComparer,SpdxPackageComparer,SpdxSnippetComparer
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 O'Neall
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<org.spdx.library.model.v2.SpdxDocument, org.spdx.library.model.v2.SpdxItem> Map of SPDX document to Itemsprotected Map<org.spdx.library.model.v2.SpdxDocument, Map<org.spdx.library.model.v2.SpdxDocument, Map<String, String>>> Mapping of all extracted license info ID's between all SPDX documents included in the comparerprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentItem(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxItem spdxItem) Add a new item to the comparer and compare the contents of the item to all items which have been previously addedprotected voidprotected voidchecks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxItemgetItem(org.spdx.library.model.v2.SpdxDocument doc) Get the item contained by the document docList<org.spdx.library.model.v2.Annotation> getUniqueAnnotations(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get annotations that are in docA but not in docBList<org.spdx.library.model.v2.Relationship> getUniqueRelationship(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get relationships that are in docA but not in docBList<org.spdx.library.model.v2.license.AnyLicenseInfo> getUniqueSeenLicenses(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get any licenses found in docA but not in docBbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanDeprecated.booleanboolean
-
Field Details
-
name
-
documentItem
protected Map<org.spdx.library.model.v2.SpdxDocument,org.spdx.library.model.v2.SpdxItem> documentItemMap of SPDX document to Items -
extractedLicenseIdMap
-
-
Constructor Details
-
SpdxItemComparer
-
-
Method Details
-
addDocumentItem
public void addDocumentItem(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxItem spdxItem) throws SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisException Add a new item to the comparer and compare the contents of the item to all items which have been previously added- Parameters:
spdxDocument- document containing the itemspdxItem- item to add- Throws:
SpdxCompareException- on compare errororg.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing error
-
isConcludedLicenseEquals
- Returns:
- the concludedLicenseEquals
- Throws:
SpdxCompareException
-
isSeenLicenseEquals
- Returns:
- the seenLicenseEquals
- Throws:
SpdxCompareException
-
getUniqueSeenLicenses
public List<org.spdx.library.model.v2.license.AnyLicenseInfo> getUniqueSeenLicenses(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Get any licenses found in docA but not in docB- Parameters:
docA- A document to comparedocB- B document to compare- Returns:
- any licenses found in docA but not in docB
- Throws:
SpdxCompareException- on compare errors
-
isCommentsEquals
- Returns:
- the commentsEquals
- Throws:
SpdxCompareException
-
isCopyrightsEquals
- Returns:
- the copyrightsEquals
- Throws:
SpdxCompareException
-
isLicenseCommentsEquals
- Returns:
- the licenseCommentsEquals
- Throws:
SpdxCompareException
-
isLicenseCommmentsEquals
Deprecated.- Returns:
- the licenseCommentsEquals
- Throws:
SpdxCompareException
-
checkInProgress
checks to make sure there is not a compare in progress- Throws:
SpdxCompareException- on compare errors
-
checkCompareMade
- Throws:
SpdxCompareException- if no comparisons have been made
-
isDifferenceFound
- Returns:
- true if any difference is found in the item
- Throws:
SpdxCompareException- on compare error
-
isInProgress
- Returns:
- the inProgress
- Throws:
SpdxCompareException
-
getItem
public org.spdx.library.model.v2.SpdxItem getItem(org.spdx.library.model.v2.SpdxDocument doc) throws SpdxCompareException Get the item contained by the document doc- Parameters:
doc- document containing the item- Returns:
- the item contained by the document doc
- Throws:
SpdxCompareException- on compare error
-
isRelationshipsEquals
- Returns:
- the relationshipsEquals
- Throws:
SpdxCompareException
-
getUniqueRelationship
public List<org.spdx.library.model.v2.Relationship> getUniqueRelationship(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Get relationships that are in docA but not in docB- Parameters:
docA- A document to comparedocB- B document to compare- Returns:
- relationships that are in docA but not in docB
- Throws:
SpdxCompareException- on compare error
-
isAnnotationsEquals
- Returns:
- the annotationsEquals
- Throws:
SpdxCompareException
-
isAttributionTextEquals
- Returns:
- the attributionTextEquals
- Throws:
SpdxCompareException- on compare error
-
getUniqueAnnotations
public List<org.spdx.library.model.v2.Annotation> getUniqueAnnotations(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Get annotations that are in docA but not in docB- Parameters:
docA- A document to comparedocB- B document to compare- Returns:
- annotations that are in docA but not in docB
- Throws:
SpdxCompareException- on compare error
-