Package org.spdx.compare
Class SpdxItemComparer
java.lang.Object
org.spdx.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>
documentItem
Map of SPDX document to Itemsprotected Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>>
extractedLicenseIdMap
Mapping of all extracted license info ID's between all SPDX documents included in the comparerprotected String
name
-
Constructor Summary
Constructors Constructor Description SpdxItemComparer(Map<SpdxDocument,Map<SpdxDocument,Map<String,String>>> extractedLicenseIdMap)
-
Method Summary
Modifier and Type Method Description void
addDocumentItem(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 void
checkInProgress()
checks to make sure there is not a compare in progressSpdxItem
getItem(SpdxDocument doc)
Get the item contained by the document docAnnotation[]
getUniqueAnnotations(SpdxDocument docA, SpdxDocument docB)
Get annotations that are in docA but not in docBRelationship[]
getUniqueRelationship(SpdxDocument docA, SpdxDocument docB)
Get relationships that are in docA but not in docBAnyLicenseInfo[]
getUniqueSeenLicenses(SpdxDocument docA, SpdxDocument docB)
Get any licenses found in docA but not in docBboolean
isAnnotationsEquals()
boolean
isAttributionTextEquals()
boolean
isCommentsEquals()
boolean
isConcludedLicenseEquals()
boolean
isCopyrightsEquals()
boolean
isDifferenceFound()
boolean
isInProgress()
boolean
isLicenseCommmentsEquals()
boolean
isRelationshipsEquals()
boolean
isSeenLicenseEquals()
-
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 SpdxCompareExceptionAdd 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:
SpdxCompareException
-
isConcludedLicenseEquals
- Returns:
- the concludedLicenseEquals
- Throws:
SpdxCompareException
-
isSeenLicenseEquals
- Returns:
- the seenLicenseEquals
- Throws:
SpdxCompareException
-
getUniqueSeenLicenses
public 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
-
isAttributionTextEquals
- Throws:
SpdxCompareException
-
isLicenseCommmentsEquals
- Returns:
- the licenseCommmentsEquals
- Throws:
SpdxCompareException
-
checkInProgress
checks to make sure there is not a compare in progress- Throws:
SpdxCompareException
-
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 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
-
getUniqueAnnotations
public Annotation[] getUniqueAnnotations(SpdxDocument docA, SpdxDocument docB) throws SpdxCompareExceptionGet annotations that are in docA but not in docB- Parameters:
docA
-docB
-- Returns:
- Throws:
SpdxCompareException
-