ProgramixGenericLib v5.0.1

com.programix.gui.text
Class FilterChainDocument.WinnowFilter

java.lang.Object
  extended by com.programix.gui.text.FilterChainDocument.BasicFilter
      extended by com.programix.gui.text.FilterChainDocument.WinnowFilter
All Implemented Interfaces:
FilterChainDocument.Filter
Enclosing class:
FilterChainDocument

public static class FilterChainDocument.WinnowFilter
extends FilterChainDocument.BasicFilter
implements FilterChainDocument.Filter

Winnows out invalid characters from the source String keeping only the characters specified as valid during construction. For more on "winnowing", see StringTools.winnow(String, char[]).

Author:
Paul Hyde

Constructor Summary
FilterChainDocument.WinnowFilter(char[] validChar)
          Constructor used to specify the characters to keep as a char[].
FilterChainDocument.WinnowFilter(String validChar)
          Constructor used to specify the characters to keep as a String.
 
Method Summary
protected  String filter(String src)
          Implement in subclasses for filters that don't need access to the Document or the offset into the document for the current String insertion.
 
Methods inherited from class com.programix.gui.text.FilterChainDocument.BasicFilter
filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.programix.gui.text.FilterChainDocument.Filter
filter
 

Constructor Detail

FilterChainDocument.WinnowFilter

public FilterChainDocument.WinnowFilter(char[] validChar)
Constructor used to specify the characters to keep as a char[].

Parameters:
validChar - characters to keep; does not have to be sorted at all.

FilterChainDocument.WinnowFilter

public FilterChainDocument.WinnowFilter(String validChar)
Constructor used to specify the characters to keep as a String.

Parameters:
validChar - a String containing all the characters to keep; does not have to be sorted at all.
Method Detail

filter

protected String filter(String src)
Description copied from class: FilterChainDocument.BasicFilter
Implement in subclasses for filters that don't need access to the Document or the offset into the document for the current String insertion.

Specified by:
filter in class FilterChainDocument.BasicFilter
Parameters:
src - proposed characters to insert
Returns:
the subset of the proposed characters to insert. If no alterations are needed, the src may be returned.

ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.