public abstract class AbstractNewYearDateFilter extends RuleFilter
Constructor and Description |
---|
AbstractNewYearDateFilter() |
Modifier and Type | Method and Description |
---|---|
RuleMatch |
acceptRuleMatch(RuleMatch match,
Map<String,String> args,
int patternTokenPos,
AnalyzedTokenReadings[] patternTokens)
Returns the original rule match or a modified one, or
null
if the rule match is filtered out. |
protected abstract Calendar |
getCalendar() |
protected int |
getCurrentYear() |
protected int |
getDayOfMonth(String localizedDayOfMonth)
Implement so that "first" returns
1 , second returns 2 etc. |
protected abstract int |
getMonth(String localizedMonth)
Implement so that January returns
1 , February 2 etc. |
protected boolean |
isJanuary()
Return true if the year recently changed (= it is January)
|
getOptional, getOptional, getPosition, getRequired, isMatchAtSentenceStart, matches
protected boolean isJanuary()
protected int getCurrentYear()
protected abstract int getMonth(String localizedMonth)
1
, February 2
etc.localizedMonth
- name of a month or abbreviation thereofprotected abstract Calendar getCalendar()
protected int getDayOfMonth(String localizedDayOfMonth)
1
, second returns 2
etc.localizedDayOfMonth
- name of day of the month or abbreviation thereofpublic RuleMatch acceptRuleMatch(RuleMatch match, Map<String,String> args, int patternTokenPos, AnalyzedTokenReadings[] patternTokens)
RuleFilter
null
if the rule match is filtered out.acceptRuleMatch
in class RuleFilter
args
- a map with values for year
, month
, day
(day of month)patternTokens
- those tokens of the text that correspond the matched patternnull
if this rule match should be removed, or any other RuleMatch (e.g. the one from
the arguments) that properly describes the detected error