File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Cyclomatic Complexity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Cyclomatic Complexity

John Weir
Greenhorn

Joined: Nov 20, 2004
Posts: 6
Hi
Having successfully coded a program that measures the Cyclomatic Complexity of a Java Source code file using the String Tokenizer class. I am in the middle of coding another using the Java Regex class for learning purposes.

Is it possible by using the Java Regex class to Ignore comments from a file being read without using the slashSlash from the StreamTokenizer? I tried COMMENTS in the Regex class but had no luck.

Also:
Pattern pattern = Pattern.compile("if|for|while|case|switch",Pattern.COMMENTS);

How can the line above get sorted so that my count will only count the keyWords and not be greedy and count the "If" in " I found out " .

Please help !

John Weir
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Please don't post the same question in multiple forums. I'm closing this one and leaving the one in JiG (Intermediate) open.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cyclomatic Complexity