net.sf.mmm.util.pattern.base
Class PathPatternCompiler
java.lang.Object
net.sf.mmm.util.pattern.base.AbstractGlobPatternCompiler
net.sf.mmm.util.pattern.base.PathPatternCompiler
- All Implemented Interfaces:
- PatternCompiler
public class PathPatternCompiler
- extends AbstractGlobPatternCompiler
This is an implementation of the PatternCompiler
interface that
compiles
path-glob-patterns. A
path-glob-pattern is like a glob-pattern
but more
specific for matching directory paths:
'?'
matches any character except for a slash (
'/'
or '\\'
).
- A single
'*'
matches a sequence of characters excluding
slashes including the empty sequence.
'**'
matches any sequence of characters (including slashes).
- the character
'/'
matches a slash ('/'
or
'\\'
).
'**/'
matches any sequence terminated by a slash as well as the empty
sequence.
The idea is taken from ant even
though it might be slightly different.
Examples:
A*bc?e
matches Abcde
or
AFOObarbcxe
but NOT abcde
or Abce
.
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
Method Summary |
protected int |
process(char[] chars,
int charIndex,
StringBuilder buffer)
This method processes one or many characters from chars
starting at the given charIndex and adds the translated
regexp-sequence to buffer . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final PatternCompiler INSTANCE
- A singleton instance of this instance.
PathPatternCompiler
public PathPatternCompiler()
- The constructor.
process
protected int process(char[] chars,
int charIndex,
StringBuilder buffer)
- This method processes one or many characters from
chars
starting at the given charIndex
and adds the translated
regexp-sequence to buffer
.
- Overrides:
process
in class AbstractGlobPatternCompiler
- Parameters:
chars
- are the characters of the original pattern string.charIndex
- is the current index in chars
.buffer
- is where the translated regexp-pattern is appended to.
- Returns:
- the index of the next character that has NOT yet been consumed
(typically
charIndex + 1
).
Copyright © 2001-2010 mmm-Team. All Rights Reserved.