@Test public void testCalculateNOM() throws IOException { int expectedNom = 3; int actualNom = analyzer.calculateNOM(TEST_FILEPATH); assertEquals(expectedNom, actualNom); }
@Override public int calculateNOM(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int methodCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (((line.contains("public") || line.contains("private") || line.contains("protected")) || line.contains("void") || line.contains("int") || line.contains("String")) && line.contains("(") && line.contains(")") && line.contains("{")) methodCounter++; } return methodCounter; }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int methodCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (((line.contains("public") || line.contains("private") || line.contains("protected")) || line.contains("void") || line.contains("int") || line.contains("String")) && line.contains("(") && line.contains(")") && line.contains("{")) methodCounter++; } return methodCounter; } }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int methodCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (((line.contains("public") || line.contains("private") || line.contains("protected")) || line.contains("void") || line.contains("int") || line.contains("String")) && line.contains("(") && line.contains(")") && line.contains("{")) methodCounter++; } return methodCounter; }  }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int methodCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (((line.contains("public") || line.contains("private") || line.contains("protected")) || line.contains("void") || line.contains("int") || line.contains("String")) && line.contains("(") && line.contains(")") && line.contains("{")) methodCounter++; } return methodCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath); }
StringComparisonAnalyzer extends SourceCodeAnalyzer { @Override public int calculateNOM(String filepath) throws IOException { List<String> sourceCodeList = contentReader.readFileForStrComp(filepath); int methodCounter = 0; for (String line : sourceCodeList) { line = line.trim(); if (((line.contains("public") || line.contains("private") || line.contains("protected")) || line.contains("void") || line.contains("int") || line.contains("String")) && line.contains("(") && line.contains(")") && line.contains("{")) methodCounter++; } return methodCounter; }  @Override int calculateLOC(String filepath); @Override int calculateNOM(String filepath); @Override int calculateNOC(String filepath);  }