ca.utoronto.JCVSReport.metric
Class SyntaxTreeRegexMatchCounter

java.lang.Object
  extended byca.utoronto.JCVSReport.metric.BasicMetric
      extended byca.utoronto.JCVSReport.metric.RegexMatchCounter
          extended byca.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

Field Summary
 
Fields inherited from class ca.utoronto.JCVSReport.metric.BasicMetric
id, insertMetric, props
 
Constructor Summary
SyntaxTreeRegexMatchCounter()
           
 
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 ca.utoronto.JCVSReport.metric.RegexMatchCounter
init, processRevision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyntaxTreeRegexMatchCounter

public SyntaxTreeRegexMatchCounter()
Method Detail

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 string
regex - regular expression to match


JCVSReport: Easy Progress Reports for CVS/Java Projects. By David James.