@Test public void testComputeCyclomaticComplexity() { assertEquals( 5, function.computeCyclomaticComplexity() ); }
public final int computeCyclomaticComplexity() { int cyclomaticComplexity = 0; if ( is( NodeKind.FOREACH ) || is( NodeKind.FORIN ) || is( NodeKind.CASE ) || is( NodeKind.DEFAULT ) ) { cyclomaticComplexity++; } else if ( is( NodeKind.IF ) || is( NodeKind.WHILE ) || is( NodeKind.FOR ) ) { cyclomaticComplexity++; cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.AND ); cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.OR ); } if ( numChildren() > 0 ) { for ( final IParserNode child : getChildren() ) { cyclomaticComplexity += child.computeCyclomaticComplexity(); } } return cyclomaticComplexity; }
NestedNode { public final int computeCyclomaticComplexity() { int cyclomaticComplexity = 0; if ( is( NodeKind.FOREACH ) || is( NodeKind.FORIN ) || is( NodeKind.CASE ) || is( NodeKind.DEFAULT ) ) { cyclomaticComplexity++; } else if ( is( NodeKind.IF ) || is( NodeKind.WHILE ) || is( NodeKind.FOR ) ) { cyclomaticComplexity++; cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.AND ); cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.OR ); } if ( numChildren() > 0 ) { for ( final IParserNode child : getChildren() ) { cyclomaticComplexity += child.computeCyclomaticComplexity(); } } return cyclomaticComplexity; } }
NestedNode { public final int computeCyclomaticComplexity() { int cyclomaticComplexity = 0; if ( is( NodeKind.FOREACH ) || is( NodeKind.FORIN ) || is( NodeKind.CASE ) || is( NodeKind.DEFAULT ) ) { cyclomaticComplexity++; } else if ( is( NodeKind.IF ) || is( NodeKind.WHILE ) || is( NodeKind.FOR ) ) { cyclomaticComplexity++; cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.AND ); cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.OR ); } if ( numChildren() > 0 ) { for ( final IParserNode child : getChildren() ) { cyclomaticComplexity += child.computeCyclomaticComplexity(); } } return cyclomaticComplexity; } protected  NestedNode( final NodeKind idToBeSet ); protected  NestedNode( final NodeKind idToBeSet,
                         final IParserNode childToBeSet ); }
NestedNode { public final int computeCyclomaticComplexity() { int cyclomaticComplexity = 0; if ( is( NodeKind.FOREACH ) || is( NodeKind.FORIN ) || is( NodeKind.CASE ) || is( NodeKind.DEFAULT ) ) { cyclomaticComplexity++; } else if ( is( NodeKind.IF ) || is( NodeKind.WHILE ) || is( NodeKind.FOR ) ) { cyclomaticComplexity++; cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.AND ); cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.OR ); } if ( numChildren() > 0 ) { for ( final IParserNode child : getChildren() ) { cyclomaticComplexity += child.computeCyclomaticComplexity(); } } return cyclomaticComplexity; } protected  NestedNode( final NodeKind idToBeSet ); protected  NestedNode( final NodeKind idToBeSet,
                         final IParserNode childToBeSet ); final int computeCyclomaticComplexity(); final int countNodeFromType( final NodeKind type ); final IParserNode getChild( final int index ); List< IParserNode > getChildren(); NodeKind getId(); IParserNode getLastChild(); final boolean is( final NodeKind expectedType ); final int numChildren(); }
NestedNode { public final int computeCyclomaticComplexity() { int cyclomaticComplexity = 0; if ( is( NodeKind.FOREACH ) || is( NodeKind.FORIN ) || is( NodeKind.CASE ) || is( NodeKind.DEFAULT ) ) { cyclomaticComplexity++; } else if ( is( NodeKind.IF ) || is( NodeKind.WHILE ) || is( NodeKind.FOR ) ) { cyclomaticComplexity++; cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.AND ); cyclomaticComplexity += getChild( 0 ).countNodeFromType( NodeKind.OR ); } if ( numChildren() > 0 ) { for ( final IParserNode child : getChildren() ) { cyclomaticComplexity += child.computeCyclomaticComplexity(); } } return cyclomaticComplexity; } protected  NestedNode( final NodeKind idToBeSet ); protected  NestedNode( final NodeKind idToBeSet,
                         final IParserNode childToBeSet ); final int computeCyclomaticComplexity(); final int countNodeFromType( final NodeKind type ); final IParserNode getChild( final int index ); List< IParserNode > getChildren(); NodeKind getId(); IParserNode getLastChild(); final boolean is( final NodeKind expectedType ); final int numChildren();  }