Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cyclomatic Complexity

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't post the same question in multiple forums. I'm closing this one and leaving the one in JiG (Intermediate) open.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic