it.sauronsoftware.grab4j.html.search
Class WildcardPattern

java.lang.Object
  extended by it.sauronsoftware.grab4j.html.search.WildcardPattern

public class WildcardPattern
extends java.lang.Object

A WildcardPattern is a simple pattern for string recognition. In its definition you can use the wildcard character star (*) to identify any character sequence.

Author:
Carlo Pelliccia

Constructor Summary
WildcardPattern(java.lang.String pattern)
          It builds a case-insensitive wildcard pattern.
 
Method Summary
 boolean comprehends(WildcardPattern wildcardPattern)
          This methods compare the current pattern with another one.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getPattern()
          This method returns the pattern as a string.
 boolean isCaseInsensitive()
          This method returns true if the pattern is case-insensitive.
 boolean matches(java.lang.String str)
          This method tests a string against the pattern.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WildcardPattern

public WildcardPattern(java.lang.String pattern)
It builds a case-insensitive wildcard pattern.

Parameters:
pattern - The pattern as a string.
Method Detail

isCaseInsensitive

public boolean isCaseInsensitive()
This method returns true if the pattern is case-insensitive.

Returns:
true if the pattern is case-insensitive.

getPattern

public java.lang.String getPattern()
This method returns the pattern as a string.

Returns:
The pattern as a string.

matches

public boolean matches(java.lang.String str)
This method tests a string against the pattern.

Parameters:
str - The string.
Returns:
true if the given string matches the pattern.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

comprehends

public boolean comprehends(WildcardPattern wildcardPattern)
This methods compare the current pattern with another one. It returns true if the given pattern is a sub-pattern of the current one. A pattern "a" is sub-pattern of "b" if all the strings matched by "a" are also matched by "b".

Parameters:
wildcardPattern - The pattern to compare with the current one.
Returns:
true if the given pattern is a sub-pattern of the current one.