net.sourceforge.pmd
Class RuleSet

java.lang.Object
  extended by net.sourceforge.pmd.RuleSet

public class RuleSet
extends java.lang.Object

This class represents a collection of rules.

See Also:
Rule

Constructor Summary
RuleSet()
           
 
Method Summary
 void addExcludePattern(java.lang.String excludePattern)
           
 void addExcludePatterns(java.util.List<java.lang.String> excludePatterns)
           
 void addIncludePattern(java.lang.String includePattern)
           
 void addIncludePatterns(java.util.List<java.lang.String> includePatterns)
           
 void addRule(Rule rule)
          Add a new rule to this ruleset
 void addRuleByReference(java.lang.String ruleSetFileName, Rule rule)
          Add a new rule by reference to this ruleset.
 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.
 boolean applies(java.io.File file)
          Check if a given source file should be checked by rules in this RuleSet.
 void apply(java.util.List acuList, RuleContext ctx)
           
 void end(RuleContext ctx)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getDescription()
           
 java.util.List<java.lang.String> getExcludePatterns()
           
 java.lang.String getFileName()
           
 java.util.List<java.lang.String> getIncludePatterns()
           
 Language getLanguage()
           
 java.lang.String getName()
           
 Rule getRuleByName(java.lang.String ruleName)
          Returns the Rule with the given name
 java.util.Collection<Rule> getRules()
          Returns the actual Collection of rules in this ruleset
 int hashCode()
           
 void setDescription(java.lang.String description)
           
 void setExcludePatterns(java.util.List<java.lang.String> excludePatterns)
           
 void setFileName(java.lang.String fileName)
           
 void setIncludePatterns(java.util.List<java.lang.String> includePatterns)
           
 void setLanguage(Language language)
           
 void setName(java.lang.String name)
           
 int size()
          Returns the number of rules in this ruleset
 void start(RuleContext ctx)
           
 boolean usesDFA()
           
 boolean usesTypeResolution()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleSet

public RuleSet()
Method Detail

size

public int size()
Returns the number of rules in this ruleset

Returns:
an int representing the number of rules

addRule

public void addRule(Rule rule)
Add a new rule to this ruleset

Parameters:
rule - the rule to be added

addRuleByReference

public void addRuleByReference(java.lang.String ruleSetFileName,
                               Rule rule)
Add a new rule by reference to this ruleset.

Parameters:
ruleSetFileName - the ruleset which contains the rule
rule - the rule to be added

getRules

public java.util.Collection<Rule> getRules()
Returns the actual Collection of rules in this ruleset

Returns:
a Collection with the rules. All objects are of type Rule

usesDFA

public boolean usesDFA()
Returns:
true if any rule in the RuleSet needs the DFA layer

getRuleByName

public Rule getRuleByName(java.lang.String ruleName)
Returns the Rule with the given name

Parameters:
ruleName - the name of the rule to find
Returns:
the rule or null if not found

addRuleSet

public void addRuleSet(RuleSet ruleSet)
Add a whole RuleSet to this RuleSet

Parameters:
ruleSet - the RuleSet to add

addRuleSetByReference

public void addRuleSetByReference(RuleSet ruleSet,
                                  boolean allRules)
Add all rules by reference from one RuleSet to this RuleSet. The rules can be added as individual references, or collectively as an all rule reference.

Parameters:
ruleSet - the RuleSet to add
allRules -

applies

public boolean applies(java.io.File file)
Check if a given source file should be checked by rules in this RuleSet. A file should not be checked if there is an 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.

Parameters:
file - the source file to check
Returns:
true if the file should be checked, false otherwise

start

public void start(RuleContext ctx)

apply

public void apply(java.util.List acuList,
                  RuleContext ctx)

end

public void end(RuleContext ctx)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getLanguage

public Language getLanguage()

setLanguage

public void setLanguage(Language language)

getFileName

public java.lang.String getFileName()

setFileName

public void setFileName(java.lang.String fileName)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String description)

getExcludePatterns

public java.util.List<java.lang.String> getExcludePatterns()

addExcludePattern

public void addExcludePattern(java.lang.String excludePattern)

addExcludePatterns

public void addExcludePatterns(java.util.List<java.lang.String> excludePatterns)

setExcludePatterns

public void setExcludePatterns(java.util.List<java.lang.String> excludePatterns)

getIncludePatterns

public java.util.List<java.lang.String> getIncludePatterns()

addIncludePattern

public void addIncludePattern(java.lang.String includePattern)

addIncludePatterns

public void addIncludePatterns(java.util.List<java.lang.String> includePatterns)

setIncludePatterns

public void setIncludePatterns(java.util.List<java.lang.String> includePatterns)

usesTypeResolution

public boolean usesTypeResolution()


Copyright © 2002-2011 InfoEther. All Rights Reserved.