org.shiftone.jrat.util.regex
Class GlobMatcher

java.lang.Object
  extended by org.shiftone.jrat.util.regex.GlobMatcher
All Implemented Interfaces:
Matcher

public class GlobMatcher
extends java.lang.Object
implements Matcher

Class matches simple regular expressions of the form:

  • this*
  • * is so *
  • input_file_*.dat
  • com.ml.gdfs.common.util.text.*
  • ?he q???k br?wn fox
  • java 1.4.?

    Author:
    jeff@shiftone.org (Jeff Drost)

    Field Summary
    static Matcher INCLUDE_ALL
               
     
    Fields inherited from interface org.shiftone.jrat.util.regex.Matcher
    ALL, NONE
     
    Constructor Summary
    GlobMatcher(java.lang.String pattenString)
               
     
    Method Summary
     boolean accept(java.io.File dir, java.lang.String name)
              simple method to allow glob matcher to implement FilenameFilter.
    static Matcher create(java.lang.String pattenString)
               
     boolean isMatch(java.lang.String inputString)
               
    static boolean isMatch(java.lang.String input, char[][] patternParts)
              Method isMatch
    static boolean isMatch(java.lang.String inputString, java.lang.String pattenString)
              used by unit tests only
    static boolean matchesFixed(char[] cs, int offSet, char[] ps)
              Method matchesFixed
    static boolean matchesFixed(java.lang.String cs, int offSet, java.lang.String ps)
              used by unit tests only
    static int nextFixedMatch(char[] cs, int offSet, char[] ps)
              Method nextFixedMatch
    static int nextFixedMatch(java.lang.String cs, int offSet, java.lang.String ps)
              used by unit tests only
     java.lang.String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    INCLUDE_ALL

    public static final Matcher INCLUDE_ALL
    Constructor Detail

    GlobMatcher

    public GlobMatcher(java.lang.String pattenString)
    Parameters:
    pattenString - initializes the matcher with the glob patterm.
    Method Detail

    create

    public static Matcher create(java.lang.String pattenString)

    isMatch

    public boolean isMatch(java.lang.String inputString)
    Specified by:
    isMatch in interface Matcher

    accept

    public boolean accept(java.io.File dir,
                          java.lang.String name)
    simple method to allow glob matcher to implement FilenameFilter. Matches name only.


    isMatch

    public static boolean isMatch(java.lang.String inputString,
                                  java.lang.String pattenString)
    used by unit tests only


    isMatch

    public static boolean isMatch(java.lang.String input,
                                  char[][] patternParts)
    Method isMatch


    nextFixedMatch

    public static int nextFixedMatch(java.lang.String cs,
                                     int offSet,
                                     java.lang.String ps)
    used by unit tests only


    nextFixedMatch

    public static int nextFixedMatch(char[] cs,
                                     int offSet,
                                     char[] ps)
    Method nextFixedMatch


    matchesFixed

    public static boolean matchesFixed(java.lang.String cs,
                                       int offSet,
                                       java.lang.String ps)
    used by unit tests only


    matchesFixed

    public static boolean matchesFixed(char[] cs,
                                       int offSet,
                                       char[] ps)
    Method matchesFixed


    toString

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