org.ujac.util.text
Class SimplePatternMatcher

java.lang.Object
  extended by org.ujac.util.text.SimplePatternMatcher
All Implemented Interfaces:
PatternMatcher

public class SimplePatternMatcher
extends Object
implements PatternMatcher

Name: SimplePatternMatcher
Description: A simple pattern matcher implementation.
This implementation allows patterns, beginning with a wildcard ('*'), ends with a wildcard or both of each.
In case no wild card is defined, tested texts have to exactly match the pattern.

Author:
lauerc

Nested Class Summary
 class SimplePatternMatcher.PatternDefinition
          Name: PatternDefinition
Description: Defines a pattern.
 
Field Summary
static int MODE_ENDS_WITH
          Constant for exact match mode.
static int MODE_EXACT
          Constant for exact match mode.
static int MODE_INBETWEEN
          Constant for exact match mode.
static int MODE_STARTS_WITH
          Constant for exact match mode.
 
Constructor Summary
SimplePatternMatcher(String pattern)
          Constructs a PatternMatcher instance with specific attributes.
 
Method Summary
 boolean matches(String text)
          Test whether the given text matches the pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_EXACT

public static final int MODE_EXACT
Constant for exact match mode.

See Also:
Constant Field Values

MODE_ENDS_WITH

public static final int MODE_ENDS_WITH
Constant for exact match mode.

See Also:
Constant Field Values

MODE_STARTS_WITH

public static final int MODE_STARTS_WITH
Constant for exact match mode.

See Also:
Constant Field Values

MODE_INBETWEEN

public static final int MODE_INBETWEEN
Constant for exact match mode.

See Also:
Constant Field Values
Constructor Detail

SimplePatternMatcher

public SimplePatternMatcher(String pattern)
Constructs a PatternMatcher instance with specific attributes.

Parameters:
pattern - The pattern to match.
Method Detail

matches

public boolean matches(String text)
Test whether the given text matches the pattern.

Specified by:
matches in interface PatternMatcher
Parameters:
text - The text to test.
Returns:
true if the text matches the pattern, else false.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.