Remote Systems
v6.4.1

com.ibm.etools.systems.core.clientserver.search
Class SystemNonRegexMatcher

java.lang.Object
  extended bycom.ibm.etools.systems.core.clientserver.search.SystemNonRegexMatcher

public class SystemNonRegexMatcher
extends Object

A string pattern matcher, suppporting * and ? wildcards.


Nested Class Summary
static class SystemNonRegexMatcher.Position
           
 
Field Summary
protected  int fBound
           
protected  boolean fHasLeadingStar
           
protected  boolean fHasTrailingStar
           
protected  boolean fIgnoreCase
           
protected  boolean fIgnoreWildCards
           
protected  int fLength
           
protected  String fPattern
           
protected  String[] fSegments
           
protected static char fSingleWildCard
           
 
Constructor Summary
SystemNonRegexMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards)
          StringMatcher constructor takes in a String object that is a simple pattern which may contain '*' for 0 and many characters and '?'
 
Method Summary
 SystemNonRegexMatcher.Position find(String text, int start, int end)
          Find the first occurrence of the pattern between startend(exclusive).
 boolean match(String text)
          match the given text with the pattern
 boolean match(String text, int start, int end)
          Given the starting (inclusive) and the ending (exclusive) positions in the text, determine if the given substring matches with aPattern
protected  int posIn(String text, int start, int end)
           
protected  int regExpPosIn(String text, int start, int end, String p)
           
protected  boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen)
           
protected  int textPosIn(String text, int start, int end, String p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fPattern

protected String fPattern

fLength

protected int fLength

fIgnoreWildCards

protected boolean fIgnoreWildCards

fIgnoreCase

protected boolean fIgnoreCase

fHasLeadingStar

protected boolean fHasLeadingStar

fHasTrailingStar

protected boolean fHasTrailingStar

fSegments

protected String[] fSegments

fBound

protected int fBound

fSingleWildCard

protected static final char fSingleWildCard
See Also:
Constant Field Values
Constructor Detail

SystemNonRegexMatcher

public SystemNonRegexMatcher(String pattern,
                             boolean ignoreCase,
                             boolean ignoreWildCards)
StringMatcher constructor takes in a String object that is a simple pattern which may contain '*' for 0 and many characters and '?' for exactly one character. Literal '*' and '?' characters must be escaped in the pattern e.g., "\*" means literal "*", etc. Escaping any other character (including the escape character itself), just results in that character in the pattern. e.g., "\a" means "a" and "\\" means "\" If invoking the StringMatcher with string literals in Java, don't forget escape characters are represented by "\\".

Parameters:
pattern - the pattern to match text against
ignoreCase - if true, case is ignored
ignoreWildCards - if true, wild cards and their escape sequences are ignored (everything is taken literally).
Method Detail

find

public SystemNonRegexMatcher.Position find(String text,
                                           int start,
                                           int end)
Find the first occurrence of the pattern between startend(exclusive).

Returns:
an StringMatcher.Position object that keeps the starting (inclusive) and ending positions (exclusive) of the first occurrence of the pattern in the specified range of the text; return null if not found or subtext is empty (start==end). A pair of zeros is returned if pattern is empty string Note that for pattern like "*abc*" with leading and trailing stars, position of "abc" is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned

match

public boolean match(String text)
match the given text with the pattern

Returns:
true if matched eitherwise false

match

public boolean match(String text,
                     int start,
                     int end)
Given the starting (inclusive) and the ending (exclusive) positions in the text, determine if the given substring matches with aPattern

Returns:
true if the specified portion of the text matches the pattern

posIn

protected int posIn(String text,
                    int start,
                    int end)
Returns:
the starting index in the text of the pattern , or -1 if not found

regExpPosIn

protected int regExpPosIn(String text,
                          int start,
                          int end,
                          String p)
Returns:
the starting index in the text of the pattern , or -1 if not found

regExpRegionMatches

protected boolean regExpRegionMatches(String text,
                                      int tStart,
                                      String p,
                                      int pStart,
                                      int plen)
Returns:
boolean

textPosIn

protected int textPosIn(String text,
                        int start,
                        int end,
                        String p)
Returns:
the starting index in the text of the pattern , or -1 if not found

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.