jgGlyphs
Class GlyphFilter

java.lang.Object
  extended byjgGlyphs.GlyphFilter
All Implemented Interfaces:
java.io.FileFilter

public class GlyphFilter
extends java.lang.Object
implements java.io.FileFilter

This is a FileFilter implemenation that filters files based on its extension and starting Characters. Supported extensions are "jpeg" or "jpg", "gif", and "png". To filter on a set of Characters, use the constructor GlyphFilter(String); each Character in the passed string denotes acceptable prefixes. To filter on a starting String, you must wrap the String in a GlyphSet or a String[] and use the appropriate constructor.


Field Summary
protected  GlyphSet glyphSet
          This is the GlyphSet to filter on, if any
 
Constructor Summary
GlyphFilter()
          Constructor which will accept any starting glyphs.
GlyphFilter(GlyphSet gs)
          Constructor that takes a GlyphSet.
GlyphFilter(java.lang.String gc)
          Constructs a GlyphFilter using the Characters in the passed String as the list of valid starting Characters.
GlyphFilter(java.lang.String[] ga)
          Constructs a GlyphFilter using the supplied array of Strings as the list of glyphs to filter on.
 
Method Summary
 boolean accept(java.io.File file)
          Accepts a file if it has a supported extension, and optionally if it starts with one of the glyphs specified by the GlyphSet this object was created with.
protected  boolean extensionOK(java.io.File file)
          Checks that the file has a supported extension.
protected  boolean prefixOK(java.io.File file)
          Checks that the file starts with one of the glyphs in the internal GlyphSet.
 java.lang.String toString()
          Returns the string representation of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

glyphSet

protected GlyphSet glyphSet
This is the GlyphSet to filter on, if any

Constructor Detail

GlyphFilter

public GlyphFilter()
Constructor which will accept any starting glyphs.


GlyphFilter

public GlyphFilter(java.lang.String gc)
Constructs a GlyphFilter using the Characters in the passed String as the list of valid starting Characters.

Parameters:
gc - the list of valid starting Characters, all together as one String.

GlyphFilter

public GlyphFilter(java.lang.String[] ga)
Constructs a GlyphFilter using the supplied array of Strings as the list of glyphs to filter on. Each string is taken to be one glyph.

Parameters:
ga - the String array to filter on.

GlyphFilter

public GlyphFilter(GlyphSet gs)
Constructor that takes a GlyphSet. If the GlyphSet is empty, this is effectively the same as GlyphFilter().

Parameters:
gs - the GlyphSet to filter on.
Method Detail

toString

public java.lang.String toString()
Returns the string representation of this class.


accept

public boolean accept(java.io.File file)
Accepts a file if it has a supported extension, and optionally if it starts with one of the glyphs specified by the GlyphSet this object was created with.

Specified by:
accept in interface java.io.FileFilter

extensionOK

protected boolean extensionOK(java.io.File file)
Checks that the file has a supported extension. Supported extensions are ":jpeg", "jpg", "gif", and "png".


prefixOK

protected boolean prefixOK(java.io.File file)
Checks that the file starts with one of the glyphs in the internal GlyphSet.