@Override public List<Kind> nodesToVisit() { return ImmutableList.<Kind>builder() .addAll(TreeKinds.functionKinds()) .add(Kind.CALL_EXPRESSION, Kind.NEW_EXPRESSION) .build(); }
@Override public void visitNode(Tree tree) { if (tree.is(CLASS_NODES)) { classComplexity += new ComplexityVisitor(true).getComplexity(tree); } else if (TreeKinds.isFunction(tree)) { int currentFunctionComplexity = new ComplexityVisitor(false).getComplexity(tree); this.functionComplexity += currentFunctionComplexity; functionComplexityDistribution.add(currentFunctionComplexity); } }
@Override public List<Kind> nodesToVisit() { List<Kind> result = new ArrayList<>(TreeKinds.functionKinds()); result.addAll(Arrays.asList(CLASS_NODES)); return result; }