com.ls.util.text
Class WildcardString

java.lang.Object
  |
  +--com.ls.util.text.WildcardString

public class WildcardString
extends Object

Implementation of the UN*X wildcards in Java. So they are available in a portable way and can be used whereever needed.

Scans a set of characters and returns false if the set mismatches at this position in the teststring and true if it is matching wildcard is set to the closing ] and test is unmodified if mismatched and otherwise the char pointer is pointing to the next character
scans an asterisk

Version:
$Revision: 1.2 $
Author:
Last modified by $Author: MFehrenbach $

Constructor Summary
WildcardString()
          Simple constructor
WildcardString(String wildcardPar, String testPar)
          Constructor
 
Method Summary
 boolean areMatching(String wildcardPar, String testPar)
          Retrieves the result of matching
 boolean areMatching(String wildcardPar, String testPar, boolean caseDep)
          Retrieves the result of matching
 boolean areNotMatching(String wildcardPar, String testPar)
          Retrieves the result of "not matching" function
 boolean areNotMatching(String wildcardPar, String testPar, boolean caseDep)
          Retrieves the result of "not matching" function
 boolean getResult()
          Retrieves the result
 void setTest(String testPar)
          set test test
 void setWildcard(String wildcardPar)
          set wildcard test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WildcardString

public WildcardString(String wildcardPar,
                      String testPar)
Constructor
Parameters:
wildcardPar - wildcard string
testPar - test string2

WildcardString

public WildcardString()
Simple constructor
Method Detail

setWildcard

public void setWildcard(String wildcardPar)
set wildcard test
Parameters:
wildcardPar - wildcard string contains the rule for testing

setTest

public void setTest(String testPar)
set test test
Parameters:
testPar - test string to be tested

getResult

public boolean getResult()
Retrieves the result
Returns:
true if test string match wildcard string

areMatching

public boolean areMatching(String wildcardPar,
                           String testPar)
Retrieves the result of matching
Parameters:
wildcardPar - wildcard string contains the rule for testing
testPar - test string to be tested
Returns:
true if the second parameter matches the wildcardPar passed as the first parameter

areMatching

public boolean areMatching(String wildcardPar,
                           String testPar,
                           boolean caseDep)
Retrieves the result of matching
Parameters:
wildcardPar - wildcard string contains the rule for testing
testPar - test string to be tested
caseDep - define if the comparison will be case dependent
Returns:
true if the second parameter matches the wildcardPar passed as the first parameter

areNotMatching

public boolean areNotMatching(String wildcardPar,
                              String testPar)
Retrieves the result of "not matching" function
Parameters:
wildcardPar - wildcard string contains the rule for testing
testPar - test string to be tested
Returns:
true if the second parameter does not match the wildcardPar passed as the first parameter

areNotMatching

public boolean areNotMatching(String wildcardPar,
                              String testPar,
                              boolean caseDep)
Retrieves the result of "not matching" function
Parameters:
wildcardPar - wildcard string contains the rule for testing
testPar - test string to be tested
caseDep - define if the comparison will be case dependent
Returns:
true if the second parameter does not match the wildcardPar passed as the first parameter