Package net.sourceforge.pmd
Class RuleSets
- java.lang.Object
- 
- net.sourceforge.pmd.RuleSets
 
- 
 public class RuleSets extends java.lang.ObjectGrouping of Rules per Language in a RuleSet.- Author:
- pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddRuleSet(RuleSet ruleSet)Add a ruleset for a language.booleanapplies(java.io.File file)Check if a given source file should be checked by rules in this RuleSets.voidapply(java.util.List<Node> acuList, RuleContext ctx, Language language)Apply all applicable rules to the compilation units.voidend(RuleContext ctx)Notify all rules of the end of processing.java.util.Set<Rule>getAllRules()Return all rules from all rulesets.RuleSet[]getAllRuleSets()Get all the RuleSets.longgetChecksum()Retrieves a checksum of the rulesets being used.RulegetRuleByName(java.lang.String ruleName)Returns the first Rule found with the given name.java.util.Iterator<RuleSet>getRuleSetsIterator()voidremoveDysfunctionalRules(java.util.Collection<Rule> collector)Remove and collect any rules that report problems.intruleCount()Determines the total count of rules that are used in all rule sets.voidstart(RuleContext ctx)Notify all rules of the start of processing.booleanusesDFA(Language language)Deprecated.SeeRule.isDfa()booleanusesMultifile(Language language)Deprecated.booleanusesTypeResolution(Language language)Deprecated.
 
- 
- 
- 
Constructor Detail- 
RuleSetspublic RuleSets() Public constructor.
 - 
RuleSetspublic RuleSets(RuleSets ruleSets) Copy constructor. Deep copies RuleSets.- Parameters:
- ruleSets- The RuleSets to copy.
 
 - 
RuleSetspublic RuleSets(RuleSet ruleSet) Public constructor. Add the given rule set.- Parameters:
- ruleSet- the RuleSet
 
 
- 
 - 
Method Detail- 
addRuleSetpublic void addRuleSet(RuleSet ruleSet) Add a ruleset for a language. Only one ruleset can be added for a specific language. If ruleSet.getLanguage() is null, it is assumed to be a RuleSet of java rules.- Parameters:
- ruleSet- the RuleSet
 
 - 
getAllRuleSetspublic RuleSet[] getAllRuleSets() Get all the RuleSets.- Returns:
- RuleSet[]
 
 - 
getRuleSetsIteratorpublic java.util.Iterator<RuleSet> getRuleSetsIterator() 
 - 
getAllRulespublic java.util.Set<Rule> getAllRules() Return all rules from all rulesets.- Returns:
- Set
 
 - 
appliespublic boolean applies(java.io.File file) Check if a given source file should be checked by rules in this RuleSets.- Parameters:
- file- the source file to check
- Returns:
- trueif the file should be checked,- falseotherwise
 
 - 
startpublic void start(RuleContext ctx) Notify all rules of the start of processing.
 - 
applypublic void apply(java.util.List<Node> acuList, RuleContext ctx, Language language) Apply all applicable rules to the compilation units. Applicable means the language of the rules must match the language of the source (@see applies).- Parameters:
- acuList- the List of compilation units; the type these must have, depends on the source language
- ctx- the RuleContext
- language- the Language of the source
 
 - 
endpublic void end(RuleContext ctx) Notify all rules of the end of processing.
 - 
usesDFA@Deprecated public boolean usesDFA(Language language) Deprecated.SeeRule.isDfa()Check if the rules that apply to a source of the given language use DFA.- Parameters:
- language- the language of a source
- Returns:
- true if any rule in the RuleSet needs the DFA layer
 
 - 
getRuleByNamepublic Rule getRuleByName(java.lang.String ruleName) Returns the first Rule found with the given name. Note: Since we support multiple languages, rule names are not expected to be unique within any specific ruleset.- Parameters:
- ruleName- the exact name of the rule to find
- Returns:
- the rule or null if not found
 
 - 
ruleCountpublic int ruleCount() Determines the total count of rules that are used in all rule sets.- Returns:
- the count
 
 - 
usesTypeResolution@Deprecated public boolean usesTypeResolution(Language language) Deprecated.Does any Rule for the given Language use Type Resolution?- Parameters:
- language- The Language.
- Returns:
- trueif a Rule for the Language uses Type Resolution,- falseotherwise.
 
 - 
usesMultifile@Deprecated public boolean usesMultifile(Language language) Deprecated.Does any Rule for the given Language use multi-file analysis?- Parameters:
- language- The Language.
- Returns:
- trueif a Rule for the Language uses multi file analysis,- falseotherwise.
 
 - 
removeDysfunctionalRulespublic void removeDysfunctionalRules(java.util.Collection<Rule> collector) Remove and collect any rules that report problems.- Parameters:
- collector-
 
 - 
getChecksumpublic long getChecksum() Retrieves a checksum of the rulesets being used. Any change to any rule of any ruleset should trigger a checksum change.- Returns:
- The checksum for this ruleset collection.
 
 
- 
 
-