net.sourceforge.pmd

## Class RuleSets

- java.lang.Object
- - net.sourceforge.pmd.RuleSets

-     public class RuleSets
      extends Object

  Grouping of Rules per Language in a RuleSet.
  Author:
    pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RuleSets()` Public constructor.
    `RuleSets(RuleSet ruleSet)` Public constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRuleSet(RuleSet ruleSet)` Add a ruleset for a language.
    `boolean` | `applies(File file)` Check if a given source file should be checked by rules in this RuleSets.
    `void` | `apply(List<Node> acuList, RuleContext ctx, Language language)` Apply all applicable rules to the compilation units.
    `void` | `end(RuleContext ctx)` Notify all rules of the end of processing.
    `Set<Rule>` | `getAllRules()` Return all rules from all rulesets.
    `RuleSet[]` | `getAllRuleSets()` Get all the RuleSets.
    `Rule` | `getRuleByName(String ruleName)` Returns the first Rule found with the given name.
    `Iterator<RuleSet>` | `getRuleSetsIterator()`
    `void` | `removeDysfunctionalRules(Collection<Rule> collector)` Remove and collect any rules that report problems.
    `void` | `start(RuleContext ctx)` Notify all rules of the start of processing.
    `boolean` | `usesDFA(Language language)` Check if the rules that apply to a source of the given language use DFA.
    `boolean` | `usesTypeResolution(Language language)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RuleSets

          public RuleSets()

      Public constructor.

    - #### RuleSets

          public RuleSets(RuleSet ruleSet)

      Public constructor. Add the given rule set.
      Parameters:
        `ruleSet` - the RuleSet

  - ### Method Detail

    - #### addRuleSet

          public 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

    - #### getAllRuleSets

          public RuleSet[] getAllRuleSets()

      Get all the RuleSets.
      Returns:
        RuleSet[]

    - #### getRuleSetsIterator

          public Iterator<RuleSet> getRuleSetsIterator()

    - #### getAllRules

          public Set<Rule> getAllRules()

      Return all rules from all rulesets.
      Returns:
        Set

    - #### applies

          public boolean applies(File file)

      Check if a given source file should be checked by rules in this RuleSets.
      Parameters:
        `file` - the source file to check
      Returns:
        `true` if the file should be checked, `false` otherwise

    - #### start

          public void start(RuleContext ctx)

      Notify all rules of the start of processing.

    - #### apply

          public void apply(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

    - #### end

          public void end(RuleContext ctx)

      Notify all rules of the end of processing.

    - #### usesDFA

          public boolean usesDFA(Language language)

      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

    - #### getRuleByName

          public Rule getRuleByName(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

    - #### usesTypeResolution

          public boolean usesTypeResolution(Language language)

    - #### removeDysfunctionalRules

          public void removeDysfunctionalRules(Collection<Rule> collector)

      Remove and collect any rules that report problems.
      Parameters:
        `collector` -

Copyright © 2002-2013 InfoEther. All Rights Reserved.