org.jutil.io.fileset
Class FileNamePattern

java.lang.Object
  |
  +--org.jutil.io.fileset.FileNamePattern

public class FileNamePattern
extends java.lang.Object

A class of filename patterns.

A pattern consists of a sequence of primitive patterns separated by File.separator. E.g. on unix platforms:

A primitive pattern consists of characters that may appear in a filename or directory name (it may not contain File.separator, which isn't allowed on any platform anyway). The * character has a special meaning. A single * matches any number of characters in a primitive_pattern. A double * matches any pattern. Some examples will make this clear.


Constructor Summary
FileNamePattern(java.lang.String pattern)
          Initialize a new FileNamePattern with the given pattern.
 
Method Summary
 java.lang.String getPattern()
          Return the pattern of this PatternPredicate.
 java.lang.String getRegexPattern()
          Return the regex pattern of this PatternPredicate.
 java.lang.String getRegexSeparator()
          Return a String that represents a file separator in a regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileNamePattern

public FileNamePattern(java.lang.String pattern)
Initialize a new FileNamePattern with the given pattern.

Parameters:
pattern - The pattern for the new PatternPredicate.

Specifications:
public behavior
requires pattern != null;
ensures getPattern() == pattern;
Method Detail

getPattern

public java.lang.String getPattern()
Return the pattern of this PatternPredicate.

Specifications:
public behavior
ensures \result != null;

getRegexPattern

public java.lang.String getRegexPattern()
Return the regex pattern of this PatternPredicate.

Specifications:
public behavior
ensures \result != null;

getRegexSeparator

public java.lang.String getRegexSeparator()

Return a String that represents a file separator in a regular expression. This method is required because \ is used as escape character.

Specifications:
public behavior
ensures \result != null;
ensures File.separator.equals("\") ==> \result .equals("\\");
ensures !File.separator.equals("\") ==> \result .equals(File.separator);