Package org.apache.rat.analysis.matchers
Class AbstractSimpleMatcher
java.lang.Object
org.apache.rat.analysis.matchers.AbstractHeaderMatcher
org.apache.rat.analysis.matchers.AbstractSimpleMatcher
- All Implemented Interfaces:
IHeaderMatcher
- Direct Known Subclasses:
CopyrightMatcher,FullTextMatcher,SimpleRegexMatcher,SimpleTextMatcher,SPDXMatcherFactory.Match
An abstract IHeaderMatcher that does simple matching. Implementations need to implement the
doMatch(String)
method to perform the actual matching. All handling of the State is managed by this class. By default the
finalizeState() method will convert State.i to State.f.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.rat.analysis.IHeaderMatcher
IHeaderMatcher.Builder, IHeaderMatcher.State -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs the AbstractSimpleMatcher with the specified id. -
Method Summary
Modifier and TypeMethodDescriptionGets the the current state of the matcher.protected abstract booleanPerforms the actual match test.Gets the final state for this matcher.Attempts to matchlineand returns the State after the match is attempted.voidreset()Resets this stateState.i.Methods inherited from class org.apache.rat.analysis.matchers.AbstractHeaderMatcher
getId, toString
-
Constructor Details
-
AbstractSimpleMatcher
Constructs the AbstractSimpleMatcher with the specified id. If the id is null or an empty string a unique random id will be generated.- Parameters:
id- the Id to use. May be null.
-
-
Method Details
-
doMatch
Performs the actual match test.- Parameters:
line- the line to check.- Returns:
trueif the line matches,falseotherwise.
-
matches
Description copied from interface:IHeaderMatcherAttempts to matchlineand returns the State after the match is attempted.- Parameters:
line- next line of text, not null- Returns:
- the new state after the matching was attempted.
-
reset
public void reset()Description copied from interface:IHeaderMatcherResets this stateState.i. If text is being cached this method should clear that cache. -
finalizeState
Description copied from interface:IHeaderMatcherGets the final state for this matcher. This is called after the EOF on the input. At this point there should be no matchers in anState.istate. -
currentState
Description copied from interface:IHeaderMatcherGets the the current state of the matcher. All matchers should be inState.iat the start.- Returns:
- the current state of the matcher.
-