public class FilePattern extends Object
Modifier and Type | Field and Description |
---|---|
private FilePatternBlock[] |
blocks
List of pattern blocks for this file pattern.
|
private int[] |
endIndex
Indices into the pattern indicating the end of a numerical block.
|
private String[] |
files
File listing for this file pattern.
|
private boolean |
isRegex
Whether or not this FilePattern represents a regular expression.
|
private static org.slf4j.Logger |
LOGGER |
private String |
msg
Error message generated during file pattern construction.
|
private String |
pattern
The file pattern string.
|
private int[] |
startIndex
Indices into the pattern indicating the start of a numerical block.
|
private boolean |
valid
The validity of the file pattern.
|
Constructor and Description |
---|
FilePattern(Location file)
Creates a pattern object using the given file as a template.
|
FilePattern(String pattern)
Creates a pattern object for files with the given pattern string.
|
FilePattern(String name,
String dir)
Creates a pattern object using the given
filename and directory path as a template.
|
Modifier and Type | Method and Description |
---|---|
private void |
buildFiles(String prefix,
int ndx,
List<String> fileList)
Recursive method for building filenames for the file listing.
|
static String |
findPattern(File file)
Identifies the group pattern from a given file within that group.
|
static String |
findPattern(Location file)
Identifies the group pattern from a given file within that group.
|
static String |
findPattern(String path)
Identifies the group pattern from a given file within that group.
|
static String |
findPattern(String[] names)
Generate a pattern from a list of file names.
|
static String |
findPattern(String name,
String dir)
Identifies the group pattern from a given file within that group.
|
private static String |
findPattern(String name,
String[] nameList,
int ndx,
int end,
String p)
Recursive method for parsing a fixed-width numerical block.
|
static String |
findPattern(String name,
String dir,
String[] nameList)
Identifies the group pattern from a given file within that group.
|
static String |
findPattern(String name,
String dir,
String[] nameList,
int[] excludeAxes)
Identifies the group pattern from a given file within that group.
|
static String[] |
findSeriesPatterns(String base) |
static String[] |
findSeriesPatterns(String base,
String dir,
String[] nameList) |
private String[] |
getAllFiles(String dir) |
String |
getBlock(int i)
Gets the specified numerical block.
|
String[] |
getBlocks()
Gets each numerical block.
|
private static String |
getBounds(BigInteger[] numbers,
boolean fixed)
Gets a string containing start, end and step values
for a sorted list of numbers.
|
int[] |
getCount() |
String[][] |
getElements() |
String |
getErrorMessage()
Gets the file pattern error message, if any.
|
String[] |
getFiles()
Gets a listing of all files matching the given file pattern.
|
BigInteger[] |
getFirst() |
BigInteger[] |
getLast() |
String |
getPattern()
Gets the file pattern string.
|
String |
getPrefix()
Gets the pattern's text string before any numerical ranges.
|
String |
getPrefix(int i)
Gets the pattern's text string before the given numerical block.
|
String[] |
getPrefixes()
Gets the pattern's text string before each numerical block.
|
BigInteger[] |
getStep() |
String |
getSuffix()
Gets the pattern's text string after all numerical ranges.
|
boolean |
isRegex()
Returns whether or not this pattern is a regular expression.
|
boolean |
isValid()
Gets whether the file pattern string is valid.
|
static void |
main(String[] args)
Method for testing file pattern logic.
|
private static String[] |
matchFiles(String[] inFiles,
NumberFilter filter)
Filters the given list of filenames according to the specified filter.
|
private static final org.slf4j.Logger LOGGER
private String pattern
private boolean valid
private String msg
private int[] startIndex
private int[] endIndex
private FilePatternBlock[] blocks
private String[] files
private boolean isRegex
public FilePattern(Location file)
public FilePattern(String name, String dir)
public FilePattern(String pattern)
public boolean isRegex()
public String getPattern()
public boolean isValid()
public String getErrorMessage()
public String[] getFiles()
public String[][] getElements()
public int[] getCount()
public String getBlock(int i)
public String[] getBlocks()
public String getPrefix()
public String getSuffix()
public String getPrefix(int i)
public String[] getPrefixes()
public static String findPattern(String path)
path
- The file path to use as a template for the match.public static String findPattern(Location file)
file
- The file to use as a template for the match.public static String findPattern(File file)
file
- The file to use as a template for the match.public static String findPattern(String name, String dir)
name
- The filename to use as a template for the match.dir
- The directory in which to search for matching files.public static String findPattern(String name, String dir, String[] nameList)
name
- The filename to use as a template for the match.dir
- The directory prefix to use for matching files.nameList
- The names through which to search for matching files.public static String findPattern(String name, String dir, String[] nameList, int[] excludeAxes)
name
- The filename to use as a template for the match.dir
- The directory prefix to use for matching files.nameList
- The names through which to search for matching files.excludeAxes
- The list of axis types which should be excluded from the
pattern.public static String findPattern(String[] names)
public static String[] findSeriesPatterns(String base, String dir, String[] nameList)
private static String findPattern(String name, String[] nameList, int ndx, int end, String p)
private static String getBounds(BigInteger[] numbers, boolean fixed)
private static String[] matchFiles(String[] inFiles, NumberFilter filter)
private void buildFiles(String prefix, int ndx, List<String> fileList)
public static void main(String[] args)
public BigInteger[] getFirst()
public BigInteger[] getLast()
public BigInteger[] getStep()
Copyright © 2015 Open Microscopy Environment