Package org.spdx.utility.compare
Class CompareTemplateOutputHandler
java.lang.Object
org.spdx.utility.compare.CompareTemplateOutputHandler
- All Implemented Interfaces:
ILicenseTemplateOutputHandler
Compares the output of a parsed license template to text. The method matches is called after
the document is parsed to determine if the text matches.
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBegin optional rule foundvoidSignals all text has been added and parsing can be completed.voidEnd optional rule foundbooleanmatches()Performs the actual parsing if it has not been completed.voidText for processinginttextEquivalent(String text, int startToken) Compares the text against the compareTextvoidVariable rule found within the template
-
Constructor Details
-
CompareTemplateOutputHandler
- Parameters:
compareText- Text to compare the parsed SPDX license template to- Throws:
IOException- This is not to be expected since we are using StringReaders
-
-
Method Details
-
text
Description copied from interface:ILicenseTemplateOutputHandlerText for processing- Specified by:
textin interfaceILicenseTemplateOutputHandler
-
variableRule
Description copied from interface:ILicenseTemplateOutputHandlerVariable rule found within the template- Specified by:
variableRulein interfaceILicenseTemplateOutputHandler
-
beginOptional
Description copied from interface:ILicenseTemplateOutputHandlerBegin optional rule found- Specified by:
beginOptionalin interfaceILicenseTemplateOutputHandler
-
endOptional
Description copied from interface:ILicenseTemplateOutputHandlerEnd optional rule found- Specified by:
endOptionalin interfaceILicenseTemplateOutputHandler
-
matches
Performs the actual parsing if it has not been completed. NOTE: This should only be called after all text has been added.- Returns:
- true if no differences were found
- Throws:
LicenseParserException
-
getDifferences
- Returns:
- details on the differences found
-
completeParsing
Description copied from interface:ILicenseTemplateOutputHandlerSignals all text has been added and parsing can be completed.- Specified by:
completeParsingin interfaceILicenseTemplateOutputHandler- Throws:
LicenseParserException
-
textEquivalent
Compares the text against the compareText- Parameters:
text- text to comparestartToken- token of the compareText to being the comparison- Returns:
- next token index (positive) if there is a match, negative first token where this is a miss-match if no match
-