Specifier class, does it work?

Hi all,

I seem to have a problem with the specifier class.

It claims it recognises patterns like:

s1*s2* -- starts with s1, contains s2

However, that doesn't seem to work. To test it, I've

compiled the following very simple thingy:

import com.sun.tools.doclets.util.*;

public class kk {

public static void main(String args[]){

Specifier sp=new Specifier(args[0]);

System.out.println("Specifier: "+sp.toString());

boolean result=sp.match(args[1]);

System.out.println("Result: "+result);

}

}

Then compile and do:

>java kk "s*a*e" silice

Specifier: s*a*e

Result: true

The result, however, should be false, for there is no

"a" contained in the word "silice".

Does anybody know what's going on?

Cheers,

P.

[881 byte] By [posuna] at [2007-9-26 3:21:48]
# 1

There seems to be a bug in the class itself. Substitue

in the code where it says:

while (plt.hasNext()) {

String x = (String) plt.next();

if (x.equals("*")) continue;

containsStrings.add(x);

}

for:

while (plt.hasNext()) {

contains=true;

String x = (String) plt.next();

if (x.equals("*")) continue;

containsStrings.add(x);

}

and it works.

P.

posuna at 2007-6-29 11:38:57 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...