Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. while (true) {
  2. String line = br.readLine();
  3. if (line == null) {
  4. break;
  5. }
  6.  
  7. if (line.trim().contains("/*")) {
  8. while (true) {
  9. commentsCounter++;
  10. line = br.readLine();
  11. if (line.contains("*/") || line == null) {
  12. break;
  13. }
  14. }
  15. }
  16.  
  17. if (line.trim().contains("//")) {
  18. commentsCounter++;
  19. }
  20.  
  21. String[] words = line.split(" ");
  22.  
  23. for (String s : words) {
  24. if (s.equals("private") || s.equals("public") || s.equals("protected")) {
  25. accessSpecifierCounter++;
  26. }
  27.  
  28. if (s.equals("private")) {
  29. privateCounter++;
  30. }
  31.  
  32. if (s.equals("public")) {
  33. publicCounter++;
  34. }
  35.  
  36. if (s.equals("protected")) {
  37. protectedCounter++;
  38. }
  39. }
  40.  
  41. lineCounter++;
  42. if (line.trim().length() == 0) {
  43. emptyLineCounter++;
  44. }
  45.  
  46. }
  47. br.close();
  48. } catch (Exception ex) {
  49. ex.printStackTrace();
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement