Constructor and Description |
---|
RuleSet() |
Modifier and Type | Method and Description |
---|---|
void |
addExcludePattern(String aPattern) |
void |
addExcludePatterns(Collection<String> someExcludePatterns) |
void |
addIncludePattern(String aPattern) |
void |
addIncludePatterns(Collection<String> someIncludePatterns) |
void |
addRule(Rule rule)
Add a new rule to this ruleset.
|
void |
addRuleByReference(String ruleSetFileName,
Rule rule)
Add a new rule by reference to this ruleset.
|
boolean |
addRuleIfNotExists(Rule rule)
Only adds a rule to the ruleset if no rule with the same name for the same language was added
before, so that the existent rule configuration won't be overridden.
|
boolean |
addRuleReplaceIfExists(Rule rule)
Adds a rule.
|
void |
addRuleSet(RuleSet ruleSet)
Add a whole RuleSet to this RuleSet
|
void |
addRuleSetByReference(RuleSet ruleSet,
boolean allRules)
Add all rules by reference from one RuleSet to this RuleSet.
|
void |
addRuleSetByReference(RuleSet ruleSet,
boolean allRules,
String... excludes)
Add all rules by reference from one RuleSet to this RuleSet.
|
boolean |
applies(File file)
Check if a given source file should be checked by rules in this RuleSet.
|
static boolean |
applies(Rule rule,
LanguageVersion languageVersion)
Does the given Rule apply to the given LanguageVersion? If so, the
Language must be the same and be between the minimum and maximums
versions on the Rule.
|
void |
apply(List<? extends Node> acuList,
RuleContext ctx) |
static RuleSet |
createFor(String name,
Rule... theRules)
A convenience constructor
|
void |
end(RuleContext ctx) |
boolean |
equals(Object o) |
String |
getDescription() |
List<String> |
getExcludePatterns() |
String |
getFileName() |
List<String> |
getIncludePatterns() |
String |
getName() |
Rule |
getRuleByName(String ruleName)
Returns the first Rule found with the given name (case-sensitive).
|
Collection<Rule> |
getRules()
Returns the actual Collection of rules in this ruleset
|
int |
hashCode() |
void |
removeDysfunctionalRules(Collection<Rule> collector)
Remove and collect any misconfigured rules.
|
void |
setDescription(String description) |
void |
setExcludePatterns(Collection<String> theExcludePatterns) |
void |
setFileName(String fileName) |
void |
setIncludePatterns(Collection<String> theIncludePatterns) |
void |
setName(String name) |
int |
size()
Returns the number of rules in this ruleset
|
void |
start(RuleContext ctx) |
boolean |
usesDFA(Language language)
Does any Rule for the given Language use the DFA layer?
|
boolean |
usesTypeResolution(Language language)
Does any Rule for the given Language use Type Resolution?
|
public static RuleSet createFor(String name, Rule... theRules)
name
- theRules
- public int size()
public void addRule(Rule rule)
rule
- the rule to be addedpublic boolean addRuleReplaceIfExists(Rule rule)
rule
- true
if the new rule replaced an existing one, otherwise false
.public boolean addRuleIfNotExists(Rule rule)
rule
- true
if the rule was added, false
otherwisepublic void addRuleByReference(String ruleSetFileName, Rule rule)
ruleSetFileName
- the ruleset which contains the rulerule
- the rule to be addedpublic Collection<Rule> getRules()
Rule
public boolean usesDFA(Language language)
language
- The Language.true
if a Rule for the Language uses the DFA layer,
false
otherwise.public Rule getRuleByName(String ruleName)
ruleName
- the exact name of the rule to findpublic void addRuleSet(RuleSet ruleSet)
ruleSet
- the RuleSet to addpublic void addRuleSetByReference(RuleSet ruleSet, boolean allRules)
ruleSet
- the RuleSet to addallRules
- public void addRuleSetByReference(RuleSet ruleSet, boolean allRules, String... excludes)
ruleSet
- the RuleSet to addallRules
- excludes
- names of the rules that should be excluded.public boolean applies(File file)
exclude
pattern which matches
the file, unless there is an include
pattern which also matches
the file. In other words, include
patterns override exclude
patterns.file
- the source file to checktrue
if the file should be checked, false
otherwisepublic void start(RuleContext ctx)
public void apply(List<? extends Node> acuList, RuleContext ctx)
public static boolean applies(Rule rule, LanguageVersion languageVersion)
rule
- The rule.languageVersion
- The language version.public void end(RuleContext ctx)
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String getFileName()
public void setFileName(String fileName)
public String getName()
public void setName(String name)
public String getDescription()
public void setDescription(String description)
public void addExcludePattern(String aPattern)
public void addExcludePatterns(Collection<String> someExcludePatterns)
public void setExcludePatterns(Collection<String> theExcludePatterns)
public void addIncludePattern(String aPattern)
public void addIncludePatterns(Collection<String> someIncludePatterns)
public void setIncludePatterns(Collection<String> theIncludePatterns)
public boolean usesTypeResolution(Language language)
language
- The Language.true
if a Rule for the Language uses Type Resolution,
false
otherwise.public void removeDysfunctionalRules(Collection<Rule> collector)
collector
- Copyright © 2002–2017 InfoEther. All rights reserved.