net.sourceforge.pmd.lang.java.rule.codesize

## Class AbstractNcssCountRule

- java.lang.Object
- - net.sourceforge.pmd.AbstractPropertySource
  - - net.sourceforge.pmd.lang.rule.AbstractRule
    - - net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
      - - net.sourceforge.pmd.lang.java.rule.AbstractStatisticalJavaRule
        - - net.sourceforge.pmd.lang.java.rule.codesize.AbstractNcssCountRule

All Implemented Interfaces:
  JavaParserVisitor, ImmutableLanguage, StatisticalRule, PropertySource, Rule

Direct Known Subclasses:
  NcssConstructorCountRule, NcssMethodCountRule, NcssTypeCountRule

    public abstract class AbstractNcssCountRule
    extends AbstractStatisticalJavaRule

Abstract superclass for NCSS counting methods. Counts tokens according to JavaNCSS rules.

Author:
  Jason Bennett

### Field Summary

### Fields inherited from class net.sourceforge.pmd.AbstractPropertySource

`propertyDescriptors, propertyValuesByDescriptor`

### Fields inherited from interface net.sourceforge.pmd.lang.rule.stat.StatisticalRule

`MINIMUM_DESCRIPTOR, SIGMA_DESCRIPTOR, TOP_SCORE_DESCRIPTOR`

### Fields inherited from interface net.sourceforge.pmd.Rule

`VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR`

### Constructor Summary

Constructors
`protected` `AbstractNcssCountRule(Class<?> nodeClass)` Count the nodes of the given type using NCSS rules.

### Method Summary

Methods
`protected Integer` `countNodeChildren(Node node, Object data)` Count the number of children of the given Java node.
`Object` `visit(ASTBreakStatement node, Object data)`
`Object` `visit(ASTCatchStatement node, Object data)`
`Object` `visit(ASTContinueStatement node, Object data)`
`Object` `visit(ASTDoStatement node, Object data)`
`Object` `visit(ASTFinallyStatement node, Object data)`
`Object` `visit(ASTForStatement node, Object data)`
`Object` `visit(ASTIfStatement node, Object data)`
`Object` `visit(ASTLabeledStatement node, Object data)`
`Object` `visit(ASTLocalVariableDeclaration node, Object data)`
`Object` `visit(ASTReturnStatement node, Object data)`
`Object` `visit(ASTStatementExpression node, Object data)`
`Object` `visit(ASTSwitchLabel node, Object data)`
`Object` `visit(ASTSwitchStatement node, Object data)`
`Object` `visit(ASTSynchronizedStatement node, Object data)`
`Object` `visit(ASTThrowStatement node, Object data)`
`Object` `visit(ASTWhileStatement node, Object data)`
`Object` `visit(JavaNode node, Object data)`

### Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractStatisticalJavaRule

`addDataPoint, apply, getViolationParameters`

### Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule

`getDeclaringType, importsPackage, isQualifiedName, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll`

### Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule

`addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, deepCopyValuesTo, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, start, usesDFA, usesRuleChain, usesTypeResolution`

### Methods inherited from class net.sourceforge.pmd.AbstractPropertySource

`copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

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

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

### Methods inherited from interface net.sourceforge.pmd.Rule

`addExample, addRuleChainVisit, addRuleChainVisit, end, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, start, usesDFA, usesRuleChain, usesTypeResolution`

### Methods inherited from interface net.sourceforge.pmd.PropertySource

`definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

### Constructor Detail

#### AbstractNcssCountRule

    protected AbstractNcssCountRule(Class<?> nodeClass)

Count the nodes of the given type using NCSS rules.

Parameters:
  `nodeClass` - class of node to count

### Method Detail

#### visit

    public Object visit(JavaNode node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### countNodeChildren

    protected Integer countNodeChildren(Node node,
                            Object data)

Count the number of children of the given Java node. Adds one to count the node itself.

Parameters:
  `node` - java node having children counted
  `data` - node data
Returns:
  count of the number of children of the node, plus one

#### visit

    public Object visit(ASTForStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTDoStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTIfStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTWhileStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTBreakStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTCatchStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTContinueStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTFinallyStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTReturnStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTSwitchStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTSynchronizedStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTThrowStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTStatementExpression node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTLabeledStatement node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTLocalVariableDeclaration node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`

#### visit

    public Object visit(ASTSwitchLabel node,
               Object data)

Specified by:
  `visit` in interface `JavaParserVisitor`
Overrides:
  `visit` in class `AbstractJavaRule`