Class MethodCountCheck.MethodCounter
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MethodCounter
- Enclosing class:
- MethodCountCheck
Marker class used to collect data about the number of methods per
class. Objects of this class are used on the Stack to count the
methods for each class and layer.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MethodCounter
(DetailAST scopeDefinition) Creates an interface. -
Method Summary
Modifier and TypeMethodDescriptionprivate DetailAST
Returns the surrounding scope definition (class, enum, etc.) which the method counts are connected to.private int
getTotal()
Fetches total number of methods.private void
Increments to counter by one for the supplied scope.private int
Gets the value of a scope counter.
-
Field Details
-
counts
Maintains the counts. -
scopeDefinition
The surrounding scope definition (class, enum, etc.) which the method counts are connected to. -
total
Tracks the total.
-
-
Constructor Details
-
MethodCounter
Creates an interface.- Parameters:
scopeDefinition
- The surrounding scope definition (class, enum, etc.) which to count all methods for.
-
-
Method Details
-
increment
Increments to counter by one for the supplied scope.- Parameters:
scope
- the scope counter to increment.
-
value
Gets the value of a scope counter.- Parameters:
scope
- the scope counter to get the value of- Returns:
- the value of a scope counter
-
getScopeDefinition
Returns the surrounding scope definition (class, enum, etc.) which the method counts are connected to.- Returns:
- the surrounding scope definition
-
getTotal
Fetches total number of methods.- Returns:
- the total number of methods.
-