Class MethodCountCheck.MethodCounter
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MethodCounter
-
- Enclosing class:
- MethodCountCheck
private static class MethodCountCheck.MethodCounter extends java.lang.ObjectMarker 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 Modifier and Type Field Description private java.util.Map<Scope,java.lang.Integer>countsMaintains the counts.private booleaninInterfaceIndicated is an interface, in which case all methods are public.private inttotalTracks the total.
-
Constructor Summary
Constructors Constructor Description MethodCounter(boolean inInterface)Creates an interface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intgetTotal()Fetches total number of methods.private voidincrement(Scope scope)Increments to counter by one for the supplied scope.private intvalue(Scope scope)Gets the value of a scope counter.
-
-
-
Field Detail
-
counts
private final java.util.Map<Scope,java.lang.Integer> counts
Maintains the counts.
-
inInterface
private final boolean inInterface
Indicated is an interface, in which case all methods are public.
-
total
private int total
Tracks the total.
-
-
Method Detail
-
increment
private void increment(Scope scope)
Increments to counter by one for the supplied scope.- Parameters:
scope- the scope counter to increment.
-
value
private int value(Scope scope)
Gets the value of a scope counter.- Parameters:
scope- the scope counter to get the value of- Returns:
- the value of a scope counter
-
getTotal
private int getTotal()
Fetches total number of methods.- Returns:
- the total number of methods.
-
-