ca.utoronto.JCVSReport.metric
Class SyntaxTreeRegexMatchCounter
java.lang.Object
ca.utoronto.JCVSReport.metric.BasicMetric
ca.utoronto.JCVSReport.metric.RegexMatchCounter
ca.utoronto.JCVSReport.metric.SyntaxTreeRegexMatchCounter
- All Implemented Interfaces:
- Metric
- public class SyntaxTreeRegexMatchCounter
- extends RegexMatchCounter
This class is an adaptation of RegexLineCounter, targeted towards parsing
.java source files, by ways of Abstract Syntax Trees, via PMD.
- Author:
- David James, Olga Rodimina, Jeffrey Magder
Method Summary |
int |
countMatches(String contents,
Pattern regex)
Returns number of matches for a specified regular expression
in the Java Syntax Tree parsed from the specified string |
String |
getJavaSyntaxTree(Reader reader)
Convert Java source code into an abstract syntax tree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SyntaxTreeRegexMatchCounter
public SyntaxTreeRegexMatchCounter()
getJavaSyntaxTree
public String getJavaSyntaxTree(Reader reader)
- Convert Java source code into an abstract syntax tree
- Parameters:
reader
- Java Source Code
countMatches
public int countMatches(String contents,
Pattern regex)
- Returns number of matches for a specified regular expression
in the Java Syntax Tree parsed from the specified string
- Overrides:
countMatches
in class RegexMatchCounter
- Parameters:
contents
- The contents of the file as a stringregex
- regular expression to match
JCVSReport: Easy Progress Reports for CVS/Java Projects. By David James.