donaldp 01/12/30 03:08:30
Modified:
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka
CovReport.java ReportFilters.java
Added:
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka
Exclude.java FilterElement.java Include.java
Removed:
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka
StringUtil.java
Log:
Moved inner classes to top level classes and merged StringUtil into the class
that uses it
Revision Changes Path
1.14 +1 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
Index: CovReport.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- CovReport.java 30 Dec 2001 10:46:59 -0000 1.13
+++ CovReport.java 30 Dec 2001 11:08:29 -0000 1.14
@@ -395,7 +395,7 @@
{
createFilters();
getLogger().debug( "Adding default include filter to *.*()"
);
- ReportFilters.Include include = new ReportFilters.Include();
+ Include include = new Include();
filters.addInclude( include );
}
try
1.5 +6 -65
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java
Index: ReportFilters.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ReportFilters.java 23 Dec 2001 06:32:00 -0000 1.4
+++ ReportFilters.java 30 Dec 2001 11:08:30 -0000 1.5
@@ -18,20 +18,15 @@
*/
public class ReportFilters
{
-
/**
* user defined filters
*/
- protected ArrayList filters = new ArrayList();
+ private ArrayList filters = new ArrayList();
/**
* cached matcher for each filter
*/
- protected ArrayList matchers = null;
-
- public ReportFilters()
- {
- }
+ private ArrayList m_matchers;
/**
* Check whether a given <classname><method>() is accepted by
@@ -45,7 +40,7 @@
{
// I'm deferring matcher instantiations at runtime to avoid computing
// the filters at parsing time
- if( matchers == null )
+ if( m_matchers == null )
{
createMatchers();
}
@@ -55,7 +50,7 @@
for( int i = 0; i < size; i++ )
{
FilterElement filter = (FilterElement)filters.get( i );
- RegexpMatcher matcher = (RegexpMatcher)matchers.get( i );
+ RegexpMatcher matcher = (RegexpMatcher)m_matchers.get( i );
if( filter instanceof Include )
{
result = result || matcher.matches( methodname );
@@ -95,69 +90,15 @@
{
RegexpMatcherFactory factory = new RegexpMatcherFactory();
final int size = filters.size();
- matchers = new ArrayList();
+ m_matchers = new ArrayList();
for( int i = 0; i < size; i++ )
{
FilterElement filter = (FilterElement)filters.get( i );
RegexpMatcher matcher = factory.newRegexpMatcher();
String pattern = filter.getAsPattern();
matcher.setPattern( pattern );
- matchers.add( matcher );
- }
- }
-
- /**
- * concrete exclude class
- *
- * @author RT
- */
- public static class Exclude extends FilterElement
- {
- }
-
- /**
- * default abstract filter element class
- *
- * @author RT
- */
- public abstract static class FilterElement
- {
- protected String clazz = "*";// default is all classes
- protected String method = "*";// default is all methods
-
- public void setClass( String value )
- {
- clazz = value;
- }
-
- public void setMethod( String value )
- {
- method = value;
+ m_matchers.add( matcher );
}
-
- public String getAsPattern()
- {
- StringBuffer buf = new StringBuffer( toString() );
- StringUtil.replace( buf, ".", "\\." );
- StringUtil.replace( buf, "*", ".*" );
- StringUtil.replace( buf, "(", "\\(" );
- StringUtil.replace( buf, ")", "\\)" );
- return buf.toString();
- }
-
- public String toString()
- {
- return clazz + "." + method + "()";
- }
- }
-
- /**
- * concrete include class
- *
- * @author RT
- */
- public static class Include extends FilterElement
- {
}
}
1.1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Exclude.java
Index: Exclude.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.tools.ant.taskdefs.optional.sitraka;
/**
* concrete exclude class
*/
public class Exclude
extends FilterElement
{
}
1.1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/FilterElement.java
Index: FilterElement.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.tools.ant.taskdefs.optional.sitraka;
/**
* default abstract filter element class
*/
public abstract class FilterElement
{
protected String clazz = "*";// default is all classes
protected String method = "*";// default is all methods
public void setClass( String value )
{
clazz = value;
}
public void setMethod( String value )
{
method = value;
}
public String getAsPattern()
{
StringBuffer buf = new StringBuffer( toString() );
replace( buf, ".", "\\." );
replace( buf, "*", ".*" );
replace( buf, "(", "\\(" );
replace( buf, ")", "\\)" );
return buf.toString();
}
public String toString()
{
return clazz + "." + method + "()";
}
/**
* Replaces all occurences of <tt>find</tt> with <tt>replacement</tt> in
the
* source StringBuffer.
*
* @param src the original string buffer to modify.
* @param find the string to be replaced.
* @param replacement the replacement string for <tt>find</tt> matches.
*/
public static void replace( StringBuffer src, String find, String
replacement )
{
int index = 0;
while( index < src.length() )
{
index = src.toString().indexOf( find, index );
if( index == -1 )
{
break;
}
src.delete( index, index + find.length() );
src.insert( index, replacement );
index += replacement.length() + 1;
}
}
}
1.1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Include.java
Index: Include.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.tools.ant.taskdefs.optional.sitraka;
/**
* concrete include class
*/
public class Include
extends FilterElement
{
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>