cyclometric complexity

HI Im trying to do a java code to calculate cyclometric complexity for any java file. Could someone explain how it works and how i can code it?Thanx
[169 byte] By [123avaja] at [2007-9-30 2:24:46]
# 1
hi againAnt ideas how i can do some coding to calculate the number of if statements and while loops on any java file? I DONT wanna use any ready made tools like Jdepend.Thanx
123avaja at 2007-7-16 13:34:23 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
any ideas? look u get duke dollars too
123avaja at 2007-7-16 13:34:23 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3

Well, you could read in you someclass.java file and parse it for "if", "while" and other flow control statements and have a counter increment each time one show up...

or have a separate counter for each flow control key word so that you can do you calculations...

In in the process, you get to parse you own file and determine what it cyclometic value is... hopefully its not over 20...

- MaxxDmg...

- ' He who never sleeps... '

MaxxDmga at 2007-7-16 13:34:23 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4
JavaCC, a Java lex/yacc tool, has Java grammars available. Try one of those. - MOD
duffymoa at 2007-7-16 13:34:23 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 5
Just in case Google doesn't work on your machine: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=JavaCCHere's the link to JavaCC:https://javacc.dev.java.net/MOD
duffymoa at 2007-7-16 13:34:23 > top of Java-index,Archived Forums,New To Java Technology Archive...