Author: bayard Date: Thu Jul 20 23:43:53 2006 New Revision: 424199 URL: http://svn.apache.org/viewvc?rev=424199&view=rev Log: Changed the matchOnSystem to ignoreCase - that fits the INAME/IPATH functionality in unix find (and stops the test failing on *nix). Also removed two variables that were left over from the inlining of the IO dependency
Modified: jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/filters/NameFilter.java Modified: jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/filters/NameFilter.java URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/filters/NameFilter.java?rev=424199&r1=424198&r2=424199&view=diff ============================================================================== --- jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/filters/NameFilter.java (original) +++ jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/filters/NameFilter.java Thu Jul 20 23:43:53 2006 @@ -27,19 +27,10 @@ * @version $Id$ * @since 0.1 */ +// TODO: Add matchOnSystem variant public class NameFilter extends AbstractFileFilter { - /** - * The Windows separator character. - */ - private static final char WINDOWS_SEPARATOR = '\\'; - - /** - * The system separator character. - */ - private static final char SYSTEM_SEPARATOR = File.separatorChar; - - private boolean matchOnSystem; + private boolean ignoreCase; private String wildcardmatcher; /** @@ -48,23 +39,22 @@ * * @param invert Whether the test criteria should be inverted. * @param wildcardmatcher the wildcard string to match against - * @param matchOnSystem whether to use the system (windows or unix) + * @param ignoreCase whether to ignore the case */ - public NameFilter(boolean invert, String wildcardmatcher, boolean matchOnSystem) { + public NameFilter(boolean invert, String wildcardmatcher, boolean ignoreCase) { super(invert); this.wildcardmatcher = wildcardmatcher; - this.matchOnSystem = matchOnSystem; + this.ignoreCase = ignoreCase; } /** - * Indicates whether the system case sensitivity/insensitivity - * should be taken into account. + * Indicates whether the case is being ignored. * - * @return <code>true</code> if the system case sensitivity/insensitivity - * is taken into account, otherwise <code>false</code> . + * @return <code>true</code> if the case is being ignored, + * otherwise <code>false</code> . */ - public boolean isMatchOnSystem() { - return matchOnSystem; + public boolean isIgnoreCase() { + return ignoreCase; } /** @@ -82,7 +72,7 @@ */ public String toString() { return super.toString() + ", wildcard=[" + getWildcardmatcher() + "]" + - ", matchOnSystem=" + isMatchOnSystem() + "}"; + ", ignoreCase=" + isIgnoreCase() + "}"; } /** @@ -95,7 +85,7 @@ * <code>false</code> . */ protected boolean test(File file) { - if( isMatchOnSystem() ) { + if( isIgnoreCase() ) { // TODO: Switch to using the IOCase API when IO 1.3 comes out return FilenameUtils.wildcardMatch(getName(file).toLowerCase(), getWildcardmatcher().toLowerCase()); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]