@@ -57,7 +57,7 @@ class ParseInstruction {
5757
5858 /**
5959 * Construct a new {@link ParseInstruction} with the specified rule, text, and parent
60- *
60+ * <p>
6161 * A parse instruction represents a single unit of parsing logic, which may include a rule,
6262 * associated text, and a hierarchical relationship to a parent instruction.
6363 *
@@ -77,7 +77,7 @@ class ParseInstruction {
7777
7878 /**
7979 * Return a string representation of this parse instruction
80- *
80+ * <p>
8181 * If the parse instruction has an associated rule, the rule's string representation is returned.
8282 * If the parse instruction has associated text, the first 10 characters of the text are returned.
8383 * If neither a rule nor text is associated, "NONE" is returned.
@@ -103,7 +103,7 @@ public String toString() {
103103
104104 /**
105105 * Retrieve the license template rule associated with this parse instruction
106- *
106+ * <p>
107107 * The rule defines the type of instruction (e.g., variable, optional, etc.) and provides
108108 * details about how the instruction should be processed during the comparison.
109109 *
@@ -116,7 +116,7 @@ public LicenseTemplateRule getRule() {
116116
117117 /**
118118 * Set the license template rule associated with this parse instruction
119- *
119+ * <p>
120120 * The rule defines the type of instruction (e.g., variable, optional, etc.) and provides
121121 * details about how the instruction should be processed during the comparison.
122122 *
@@ -129,7 +129,7 @@ public void setRule(LicenseTemplateRule rule) {
129129
130130 /**
131131 * Retrieve the text associated with this parse instruction
132- *
132+ * <p>
133133 * The text represents the content of this parse instruction, which may be compared against
134134 * other text during the license template matching process.
135135 *
@@ -142,7 +142,7 @@ public String getText() {
142142
143143 /**
144144 * Set the text content for this parse instruction
145- *
145+ * <p>
146146 * The text represents the content of this parse instruction, which may be compared against
147147 * other text during the license template matching process.
148148 *
@@ -198,7 +198,7 @@ public void setParent(ParseInstruction parent) {
198198
199199 /**
200200 * Retrieve the list of sub-instructions for this parse instruction.
201- *
201+ * <p>
202202 * Sub-instructions represent the child instructions that are part of this parse
203203 * instruction. These can include text, rules, or other nested instructions.
204204 *
@@ -590,7 +590,7 @@ public void setLastOptionalDifference(DifferenceDescription optionalDifference)
590590 * a single token
591591 *
592592 * @return {@code true} if the instruction following this instruction is a
593- * {@code BEGIN_OPTIONAL } rule containing text with a single token, {@code false}
593+ * {@code beginOptional } rule containing text with a single token, {@code false}
594594 * otherwise.
595595 */
596596 public boolean isFollowingInstructionOptionalSingleToken () {
@@ -677,11 +677,23 @@ public void skipNextInstruction() {
677677 nextInst .setSkip (true );
678678 }
679679 }
680-
680+
681+ /**
682+ * Check whether this parse instruction should be skipped during matching
683+ *
684+ * @return {@code true} if this parse instruction should be skipped; {@code false}
685+ * otherwise.
686+ */
681687 public boolean getSkip () {
682- return this .skip ;
688+ return this .skip ;
683689 }
684-
690+
691+ /**
692+ * Set whether this parse instruction should be skipped during matching
693+ *
694+ * @param skip {@code true} if this parse instruction should be skipped; {@code false}
695+ * otherwise.
696+ */
685697 public void setSkip (boolean skip ) {
686698 this .skip = skip ;
687699 }
@@ -728,7 +740,7 @@ public ParseInstruction getNextNormalTextInstruction() {
728740 /**
729741 * Set whether the first text token of this parse instruction should be skipped during
730742 * matching
731- *
743+ * <p>
732744 * This is useful in cases where the first token of the text is optional or should not be
733745 * considered for comparison purposes.
734746 *
@@ -742,7 +754,7 @@ public void setSkipFirstToken(boolean skipFirstTextToken) {
742754 /**
743755 * Check whether the first text token of this parse instruction should be skipped during
744756 * matching
745- *
757+ * <p>
746758 * This is useful in cases where the first token of the text is optional or should not be
747759 * considered for comparison purposes.
748760 *
@@ -765,6 +777,7 @@ public static class DifferenceDescription {
765777
766778 /**
767779 * Creates a difference description
780+ *
768781 * @param differenceFound if true, a difference was found
769782 * @param differenceMessage Message describing the differences
770783 * @param differences list of lines where the difference was found
@@ -785,28 +798,39 @@ public DifferenceDescription() {
785798 }
786799
787800 /**
788- * @return true if a difference is found
801+ * Check whether a difference was found during the comparison process
802+ *
803+ * @return {@code true} if a difference was found; {@code false} otherwise.
789804 */
790805 public boolean isDifferenceFound () {
791806 return differenceFound ;
792807 }
793808
794809 /**
795- * @param differenceFound if true, a difference was found
810+ * Set whether a difference was found during the comparison process
811+ *
812+ * @param differenceFound {@code true} if a difference was found; {@code false} otherwise.
796813 */
797814 public void setDifferenceFound (boolean differenceFound ) {
798815 this .differenceFound = differenceFound ;
799816 }
800817
801818 /**
802- * @return Message describing the differences
819+ * Retrieve the message describing the differences found during the comparison process
820+ * <p>
821+ * The difference message provides details about the nature of the differences, including
822+ * the location, token, and context of the mismatch.
823+ *
824+ * @return A message describing the differences.
803825 */
804826 public String getDifferenceMessage () {
805827 return differenceMessage ;
806828 }
807829
808830 /**
809- * @param differenceMessage Message describing the differences
831+ * Set the message describing the differences found during the comparison process.
832+ *
833+ * @param differenceMessage A message describing the differences.
810834 */
811835 public void setDifferenceMessage (String differenceMessage ) {
812836 this .differenceMessage = differenceMessage ;
@@ -827,6 +851,8 @@ public void setDifferences(List<LineColumn> differences) {
827851 }
828852
829853 /**
854+ * Adds a new difference to the list of differences found during the comparison process
855+ *
830856 * @param location Location in the text of the difference
831857 * @param token Token causing the difference
832858 * @param msg Message for the difference
@@ -880,9 +906,15 @@ public void addDifference(LineColumn location, String token, String msg, String
880906 DifferenceDescription differences = new DifferenceDescription ();
881907 ParseInstruction currentOptionalInstruction = null ;
882908 boolean parsingComplete = false ;
883-
909+
884910 /**
885- * @param compareText Text to compare the parsed SPDX license template to
911+ * Construct a new {@link CompareTemplateOutputHandler} with the specified text to compare
912+ * <p>
913+ * This handler is used to compare the output of a parsed SPDX license template to the provided
914+ * text. It tokenizes the input text and prepares it for comparison against the parsed license
915+ * template.
916+ *
917+ * @param compareText The text to compare the parsed SPDX license template to.
886918 * @throws IOException This is not to be expected since we are using StringReaders
887919 */
888920 public CompareTemplateOutputHandler (String compareText ) throws IOException {
@@ -892,11 +924,14 @@ public CompareTemplateOutputHandler(String compareText) throws IOException {
892924 }
893925
894926 /**
927+ * Compares the given text tokens against the match tokens starting from a specific token index
928+ *
895929 * @param textTokens source for compare
896930 * @param matchTokens tokens to match against
897931 * @param startToken index for the start token
898932 * @param instruction parse instruction
899- * @return positive index of the next match token after the match or negative index of the token which first failed the match
933+ * @return positive index of the next match token after the match or negative index of the token
934+ * which first failed the match
900935 */
901936 private int compareText (String [] textTokens , String [] matchTokens , int startToken ,
902937 ParseInstruction instruction ) {
@@ -1023,7 +1058,10 @@ public void endOptional(LicenseTemplateRule rule) {
10231058 }
10241059
10251060 /**
1026- * Performs the actual parsing if it has not been completed. NOTE: This should only be called after all text has been added.
1061+ * Performs the actual parsing if it has not been completed
1062+ * <p>
1063+ * NOTE: This should only be called after all text has been added.
1064+ *
10271065 * @return true if no differences were found
10281066 * @throws LicenseParserException on license parsing error
10291067 */
@@ -1035,6 +1073,8 @@ public boolean matches() throws LicenseParserException {
10351073 }
10361074
10371075 /**
1076+ * Retrieve the details of the differences found during the comparison process
1077+ *
10381078 * @return details on the differences found
10391079 */
10401080 public DifferenceDescription getDifferences () {
@@ -1057,6 +1097,7 @@ public void completeParsing() throws LicenseParserException {
10571097
10581098 /**
10591099 * Compares the text against the compareText
1100+ *
10601101 * @param text text to compare
10611102 * @param startToken token of the compareText to being the comparison
10621103 * @return next token index (positive) if there is a match, negative first token where this is a miss-match if no match
0 commit comments