Added support for an exclusion regexp.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1038 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: DriverTask.java,v 1.3 2001/12/03 09:14:11 mdb Exp $
|
// $Id: DriverTask.java,v 1.4 2003/01/28 22:39:34 mdb Exp $
|
||||||
//
|
//
|
||||||
// viztool - a tool for visualizing collections of java classes
|
// viztool - a tool for visualizing collections of java classes
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -79,6 +79,11 @@ public class DriverTask extends Task
|
|||||||
_classes = classes;
|
_classes = classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExclude (String exclude)
|
||||||
|
{
|
||||||
|
_exclude = exclude;
|
||||||
|
}
|
||||||
|
|
||||||
public void setOutput (File output)
|
public void setOutput (File output)
|
||||||
{
|
{
|
||||||
_output = output;
|
_output = output;
|
||||||
@@ -116,10 +121,11 @@ public class DriverTask extends Task
|
|||||||
ClassEnumerator enum = new ClassEnumerator(classpath.toString());
|
ClassEnumerator enum = new ClassEnumerator(classpath.toString());
|
||||||
FilterEnumerator fenum = null;
|
FilterEnumerator fenum = null;
|
||||||
try {
|
try {
|
||||||
fenum = new RegexpEnumerator(_classes, enum);
|
fenum = new RegexpEnumerator(_classes, _exclude, enum);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BuildException("Invalid package regular expression " +
|
throw new BuildException("Invalid package regular expression " +
|
||||||
"[classes=" + _classes + "].", e);
|
"[classes=" + _classes +
|
||||||
|
", exclude=" + _exclude + "].", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList classes = new ArrayList();
|
ArrayList classes = new ArrayList();
|
||||||
@@ -215,7 +221,7 @@ public class DriverTask extends Task
|
|||||||
|
|
||||||
protected String _vizclass;
|
protected String _vizclass;
|
||||||
protected String _pkgroot;
|
protected String _pkgroot;
|
||||||
protected String _classes;
|
protected String _classes, _exclude;
|
||||||
protected File _output;
|
protected File _output;
|
||||||
|
|
||||||
// use use this for accumulating our classpath
|
// use use this for accumulating our classpath
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: RegexpEnumerator.java,v 1.1 2001/12/03 08:34:53 mdb Exp $
|
// $Id: RegexpEnumerator.java,v 1.2 2003/01/28 22:39:35 mdb Exp $
|
||||||
//
|
//
|
||||||
// viztool - a tool for visualizing collections of java classes
|
// viztool - a tool for visualizing collections of java classes
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -30,17 +30,22 @@ import org.apache.regexp.RESyntaxException;
|
|||||||
*/
|
*/
|
||||||
public class RegexpEnumerator extends FilterEnumerator
|
public class RegexpEnumerator extends FilterEnumerator
|
||||||
{
|
{
|
||||||
public RegexpEnumerator (String regexp, Iterator source)
|
public RegexpEnumerator (String regexp, String exregex, Iterator source)
|
||||||
throws RESyntaxException
|
throws RESyntaxException
|
||||||
{
|
{
|
||||||
super(source);
|
super(source);
|
||||||
_regexp = new RE(regexp);
|
_regexp = new RE(regexp);
|
||||||
|
if (exregex != null) {
|
||||||
|
_exreg = new RE(exregex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean filterClass (String clazz)
|
protected boolean filterClass (String clazz)
|
||||||
{
|
{
|
||||||
return !_regexp.match(clazz);
|
return !(_regexp.match(clazz) &&
|
||||||
|
(_exreg == null || !_exreg.match(clazz)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RE _regexp;
|
protected RE _regexp;
|
||||||
|
protected RE _exreg;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user