Package net.sourceforge.pmd.cpd.impl
Class BaseTokenFilter<T extends GenericToken<T>>
java.lang.Object
net.sourceforge.pmd.cpd.impl.BaseTokenFilter<T>
- All Implemented Interfaces:
TokenManager<T>
- Direct Known Subclasses:
AntlrTokenFilter,JavaCCTokenFilter
A generic filter for PMD token managers that allows to use comments
to enable / disable analysis of parts of the stream
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidanalyzeToken(T currentToken) Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.protected voidanalyzeTokens(T currentToken, Iterable<T> remainingTokens) Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.final Tprotected booleanExtension point for subclasses to indicate tokens are to be filtered.protected booleanshouldStopProcessing(T currentToken) Extension point for subclasses to indicate when to stop filtering tokens.
-
Constructor Details
-
BaseTokenFilter
Creates a new BaseTokenFilter- Parameters:
tokenManager- The token manager from which to retrieve tokens to be filtered
-
-
Method Details
-
getNextToken
- Specified by:
getNextTokenin interfaceTokenManager<T extends GenericToken<T>>
-
analyzeToken
Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.- Parameters:
currentToken- The token to be analyzed- See Also:
-
analyzeTokens
Extension point for subclasses to analyze all tokens (before filtering) and update internal status to decide on custom discard rules.- Parameters:
currentToken- The token to be analyzedremainingTokens- All upcoming tokens- See Also:
-
isLanguageSpecificDiscarding
protected boolean isLanguageSpecificDiscarding()Extension point for subclasses to indicate tokens are to be filtered.- Returns:
- True if tokens should be filtered, false otherwise
-
shouldStopProcessing
Extension point for subclasses to indicate when to stop filtering tokens.- Parameters:
currentToken- The token to be analyzed- Returns:
- True if the token filter has finished consuming all tokens, false otherwise
-