Package org.spdx.utility.compare
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<SpdxDocument,SpdxItem> Map of SPDX document to Itemsprotected Map<SpdxDocument,Map<SpdxDocument, Map<String, String>>> Mapping of all extracted license info ID's between all SPDX documents included in the comparerprotected String -
Constructor Summary
ConstructorsConstructorDescriptionSpdxItemComparer(Map<SpdxDocument, Map<SpdxDocument, Map<String, String>>> extractedLicenseIdMap) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentItem(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 voidprotected voidchecks to make sure there is not a compare in progressgetItem(SpdxDocument doc) Get the item contained by the document docgetUniqueAnnotations(SpdxDocument docA, SpdxDocument docB) Get annotations that are in docA but not in docBgetUniqueRelationship(SpdxDocument docA, SpdxDocument docB) Get relationships that are in docA but not in docBgetUniqueSeenLicenses(SpdxDocument docA, SpdxDocument docB) Get any licenses found in docA but not in docBbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanboolean
-
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, 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-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 SpdxCompareException Get 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 SpdxCompareException Get 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 SpdxCompareException Get annotations that are in docA but not in docB- Parameters:
docA-docB-- Returns:
- Throws:
SpdxCompareException
-