Package org.languagetool.rules
Class AbstractFutureDateFilter
java.lang.Object
org.languagetool.rules.patterns.RuleFilter
org.languagetool.rules.AbstractFutureDateFilter
Checks if a given date is in the future
Used for mismatch detection between verb tense and a given date
- Since:
- 4.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacceptRuleMatch
(RuleMatch match, Map<String, String> args, int patternTokenPos, AnalyzedTokenReadings[] patternTokens) Returns the original rule match or a modified one, ornull
if the rule match is filtered out.protected abstract Calendar
private Calendar
protected int
getDayOfMonth
(String localizedDayOfMonth) Implement so that "first" returns1
, second returns2
etc.private int
protected abstract int
Implement so that January returns1
, February2
etc.private int
getMonthFromArguments
(Map<String, String> args) Methods inherited from class org.languagetool.rules.patterns.RuleFilter
getRequired, matches
-
Field Details
-
DAY_OF_MONTH_PATTERN
-
-
Constructor Details
-
AbstractFutureDateFilter
public AbstractFutureDateFilter()
-
-
Method Details
-
getDayOfMonth
Implement so that "first" returns1
, second returns2
etc.- Parameters:
localizedDayOfMonth
- name of day of the month or abbreviation thereof
-
getMonth
Implement so that January returns1
, February2
etc.- Parameters:
localizedMonth
- name of a month or abbreviation thereof
-
getCalendar
-
acceptRuleMatch
public RuleMatch acceptRuleMatch(RuleMatch match, Map<String, String> args, int patternTokenPos, AnalyzedTokenReadings[] patternTokens) Description copied from class:RuleFilter
Returns the original rule match or a modified one, ornull
if the rule match is filtered out.- Specified by:
acceptRuleMatch
in classRuleFilter
- Parameters:
args
- a map with values foryear
,month
,day
(day of month),weekDay
patternTokens
- those tokens of the text that correspond the matched pattern- Returns:
null
if this rule match should be removed, or any other RuleMatch (e.g. the one from the arguments) that properly describes the detected error
-
getDate
-
getDayOfMonthFromArguments
-
getMonthFromArguments
-