@Test public void testCreate() throws PMDException { final IFlexFile file = getTestFiles().get( "bug.FlexPMD60.as" ); final IParserNode ast = FileSetUtils.buildAst( file ); final IClass classNode = NodeFactory.createPackage( ast ).getClassNode(); final InternalFunctionMetrics classMetrics = InternalFunctionMetrics.create( new ProjectMetrics(), "bug", classNode ); assertEquals( 1, classMetrics.getMultipleLineCommentInClass() ); }
public static InternalFunctionMetrics create( final ProjectMetrics metrics, final String packageFullName, final IClass classNode ) { int ncssInClass = 0; int asDocsInClass = 0; int multipleLineCommentInClass = 0; for ( final IFunction function : classNode.getFunctions() ) { final int multipleDoc = MetricUtils.computeMultiLineComments( function ); final int asDocs = MetricUtils.computeAsDocs( function ); ncssInClass += function.getStatementNbInBody(); multipleLineCommentInClass += multipleDoc; asDocsInClass += asDocs; metrics.getFunctionMetrics().add( FunctionMetrics.create( packageFullName, classNode, function, asDocs, multipleDoc ) ); } for ( final IAttribute attribute : classNode.getAttributes() ) { asDocsInClass += MetricUtils.computeAsDocs( attribute ); } return new InternalFunctionMetrics( ncssInClass, asDocsInClass, multipleLineCommentInClass ); }
InternalFunctionMetrics { public static InternalFunctionMetrics create( final ProjectMetrics metrics, final String packageFullName, final IClass classNode ) { int ncssInClass = 0; int asDocsInClass = 0; int multipleLineCommentInClass = 0; for ( final IFunction function : classNode.getFunctions() ) { final int multipleDoc = MetricUtils.computeMultiLineComments( function ); final int asDocs = MetricUtils.computeAsDocs( function ); ncssInClass += function.getStatementNbInBody(); multipleLineCommentInClass += multipleDoc; asDocsInClass += asDocs; metrics.getFunctionMetrics().add( FunctionMetrics.create( packageFullName, classNode, function, asDocs, multipleDoc ) ); } for ( final IAttribute attribute : classNode.getAttributes() ) { asDocsInClass += MetricUtils.computeAsDocs( attribute ); } return new InternalFunctionMetrics( ncssInClass, asDocsInClass, multipleLineCommentInClass ); } }
InternalFunctionMetrics { public static InternalFunctionMetrics create( final ProjectMetrics metrics, final String packageFullName, final IClass classNode ) { int ncssInClass = 0; int asDocsInClass = 0; int multipleLineCommentInClass = 0; for ( final IFunction function : classNode.getFunctions() ) { final int multipleDoc = MetricUtils.computeMultiLineComments( function ); final int asDocs = MetricUtils.computeAsDocs( function ); ncssInClass += function.getStatementNbInBody(); multipleLineCommentInClass += multipleDoc; asDocsInClass += asDocs; metrics.getFunctionMetrics().add( FunctionMetrics.create( packageFullName, classNode, function, asDocs, multipleDoc ) ); } for ( final IAttribute attribute : classNode.getAttributes() ) { asDocsInClass += MetricUtils.computeAsDocs( attribute ); } return new InternalFunctionMetrics( ncssInClass, asDocsInClass, multipleLineCommentInClass ); } private  InternalFunctionMetrics( final int ncssInClassToBeSet,
                                    final int asDocsInClassToBeSet,
                                    final int multipleLineCommentInClassToBeSet ); }
InternalFunctionMetrics { public static InternalFunctionMetrics create( final ProjectMetrics metrics, final String packageFullName, final IClass classNode ) { int ncssInClass = 0; int asDocsInClass = 0; int multipleLineCommentInClass = 0; for ( final IFunction function : classNode.getFunctions() ) { final int multipleDoc = MetricUtils.computeMultiLineComments( function ); final int asDocs = MetricUtils.computeAsDocs( function ); ncssInClass += function.getStatementNbInBody(); multipleLineCommentInClass += multipleDoc; asDocsInClass += asDocs; metrics.getFunctionMetrics().add( FunctionMetrics.create( packageFullName, classNode, function, asDocs, multipleDoc ) ); } for ( final IAttribute attribute : classNode.getAttributes() ) { asDocsInClass += MetricUtils.computeAsDocs( attribute ); } return new InternalFunctionMetrics( ncssInClass, asDocsInClass, multipleLineCommentInClass ); } private  InternalFunctionMetrics( final int ncssInClassToBeSet,
                                    final int asDocsInClassToBeSet,
                                    final int multipleLineCommentInClassToBeSet ); static InternalFunctionMetrics create( final ProjectMetrics metrics,
                                                 final String packageFullName,
                                                 final IClass classNode ); int getAsDocsInClass(); int getMultipleLineCommentInClass(); int getNcssInClass(); }
InternalFunctionMetrics { public static InternalFunctionMetrics create( final ProjectMetrics metrics, final String packageFullName, final IClass classNode ) { int ncssInClass = 0; int asDocsInClass = 0; int multipleLineCommentInClass = 0; for ( final IFunction function : classNode.getFunctions() ) { final int multipleDoc = MetricUtils.computeMultiLineComments( function ); final int asDocs = MetricUtils.computeAsDocs( function ); ncssInClass += function.getStatementNbInBody(); multipleLineCommentInClass += multipleDoc; asDocsInClass += asDocs; metrics.getFunctionMetrics().add( FunctionMetrics.create( packageFullName, classNode, function, asDocs, multipleDoc ) ); } for ( final IAttribute attribute : classNode.getAttributes() ) { asDocsInClass += MetricUtils.computeAsDocs( attribute ); } return new InternalFunctionMetrics( ncssInClass, asDocsInClass, multipleLineCommentInClass ); } private  InternalFunctionMetrics( final int ncssInClassToBeSet,
                                    final int asDocsInClassToBeSet,
                                    final int multipleLineCommentInClassToBeSet ); static InternalFunctionMetrics create( final ProjectMetrics metrics,
                                                 final String packageFullName,
                                                 final IClass classNode ); int getAsDocsInClass(); int getMultipleLineCommentInClass(); int getNcssInClass();  }