Package dev.amp.validator
Class ReferencePointMatcher
- java.lang.Object
-
- dev.amp.validator.ReferencePointMatcher
-
public class ReferencePointMatcher extends Object
A tag may initialize this ReferencePointMatcher with its reference points. Then, the matcher will be invoked for each child tag via ::Match, and eventually it will be invoked upon exiting the parent tag.- Author:
- nhant01, GeorgeLuo
-
-
Constructor Summary
Constructors Constructor Description ReferencePointMatcher(ParsedValidatorRules parsedValidatorRules, ParsedReferencePoints parsedReferencePoints, Locator lineCol)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Clean up reference, improve gc performance.voidexitParentTag(Context context, dev.amp.validator.ValidatorProtos.ValidationResult.Builder result)This method gets invoked when we're done with processing all the child tags, so now we can determine whether any reference points remain unsatisfied or duplicate.LocatorgetLineCol()Returns a pair of line/col.voidrecordMatch(ParsedTagSpec parsedTagSpec)Record the parsed tag spec id.ValidateTagResultvalidateTag(ParsedHtmlTag tag, Context context)This method gets invoked when matching a child tag of the parent that is specifying / requiring the reference points.
-
-
-
Constructor Detail
-
ReferencePointMatcher
public ReferencePointMatcher(@Nonnull ParsedValidatorRules parsedValidatorRules, @Nonnull ParsedReferencePoints parsedReferencePoints, @Nonnull Locator lineCol) throws TagValidationExceptionConstructor.- Parameters:
parsedValidatorRules- the ParsedValidatorRules object.parsedReferencePoints- the parsed reference points.lineCol- a pair of line/col.- Throws:
TagValidationException- the TagValidationException.
-
-
Method Detail
-
validateTag
public ValidateTagResult validateTag(@Nonnull ParsedHtmlTag tag, @Nonnull Context context) throws TagValidationException, ValidatorException, IOException, CssValidationException
This method gets invoked when matching a child tag of the parent that is specifying / requiring the reference points. So effectively, this method will try through the specified reference points and record them in this.referencePointsMatched.- Parameters:
tag- the ParsedHtmlTag.context- the Context.- Returns:
- result returns ValidateTagResult.
- Throws:
TagValidationException- the TagValidationException.ValidatorException- the ValidatorException.IOException- IO ExceptionCssValidationException- CssValidation Exception
-
exitParentTag
public void exitParentTag(@Nonnull Context context, @Nonnull dev.amp.validator.ValidatorProtos.ValidationResult.Builder result) throws TagValidationExceptionThis method gets invoked when we're done with processing all the child tags, so now we can determine whether any reference points remain unsatisfied or duplicate.- Parameters:
context- the Context.result- the ValidationResult.- Throws:
TagValidationException- the TagValidationException.
-
cleanup
public void cleanup()
Clean up reference, improve gc performance.
-
getLineCol
public Locator getLineCol()
Returns a pair of line/col.- Returns:
- returns a pair of line/col.
-
recordMatch
public void recordMatch(@Nonnull ParsedTagSpec parsedTagSpec)Record the parsed tag spec id.- Parameters:
parsedTagSpec- the ParsedTagSpec.
-
-