loci.formats
Class FilePattern

java.lang.Object
  extended by loci.formats.FilePattern

public class FilePattern
extends Object

FilePattern is a collection of methods for handling file patterns, a way of succinctly representing a collection of files meant to be part of the same data series. Examples:

Source code:
Trac, SVN

Author:
Curtis Rueden ctrueden at wisc.edu

Constructor Summary
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.
 
Method Summary
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 name, String dir)
          Identifies the group pattern from a given file within that group.
static String findPattern(String name, String dir, String[] nameList)
          Identifies the group pattern from a given file within that group.
 String getBlock(int i)
          Gets the specified numerical block.
 String[] getBlocks()
          Gets each numerical block.
 int[] getCount()
          Gets the total count of each numerical block.
 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()
          Gets the first number of each numerical block.
 BigInteger[] getLast()
          Gets the last number of each numerical block.
 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()
          Gets the step increment of each numerical block.
 String getSuffix()
          Gets the pattern's text string after all numerical ranges.
 boolean isValid()
          Gets whether the file pattern string is valid.
static void main(String[] args)
          Method for testing file pattern logic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePattern

public FilePattern(Location file)
Creates a pattern object using the given file as a template.


FilePattern

public FilePattern(String name,
                   String dir)
Creates a pattern object using the given filename and directory path as a template.


FilePattern

public FilePattern(String pattern)
Creates a pattern object for files with the given pattern string.

Method Detail

getPattern

public String getPattern()
Gets the file pattern string.


isValid

public boolean isValid()
Gets whether the file pattern string is valid.


getErrorMessage

public String getErrorMessage()
Gets the file pattern error message, if any.


getFirst

public BigInteger[] getFirst()
Gets the first number of each numerical block.


getLast

public BigInteger[] getLast()
Gets the last number of each numerical block.


getStep

public BigInteger[] getStep()
Gets the step increment of each numerical block.


getCount

public int[] getCount()
Gets the total count of each numerical block.


getFiles

public String[] getFiles()
Gets a listing of all files matching the given file pattern.


getBlock

public String getBlock(int i)
Gets the specified numerical block.


getBlocks

public String[] getBlocks()
Gets each numerical block.


getPrefix

public String getPrefix()
Gets the pattern's text string before any numerical ranges.


getSuffix

public String getSuffix()
Gets the pattern's text string after all numerical ranges.


getPrefix

public String getPrefix(int i)
Gets the pattern's text string before the given numerical block.


getPrefixes

public String[] getPrefixes()
Gets the pattern's text string before each numerical block.


findPattern

public static String findPattern(Location file)
Identifies the group pattern from a given file within that group.

Parameters:
file - The file to use as a template for the match.

findPattern

public static String findPattern(File file)
Identifies the group pattern from a given file within that group.

Parameters:
file - The file to use as a template for the match.

findPattern

public static String findPattern(String name,
                                 String dir)
Identifies the group pattern from a given file within that group.

Parameters:
name - The filename to use as a template for the match.
dir - The directory in which to search for matching files.

findPattern

public static String findPattern(String name,
                                 String dir,
                                 String[] nameList)
Identifies the group pattern from a given file within that group.

Parameters:
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.

main

public static void main(String[] args)
Method for testing file pattern logic.