net.sf.mmm.util.filter.base
Class ListCharFilter

java.lang.Object
  extended by net.sf.mmm.util.filter.base.ListCharFilter
All Implemented Interfaces:
CharFilter

public class ListCharFilter
extends Object
implements CharFilter

This is an implementation of the CharFilter interface that filters characters according to a given blacklist or whitelist.

Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  boolean blacklist
           
private  char[] chars
           
 
Fields inherited from interface net.sf.mmm.util.filter.api.CharFilter
ASCII_LETTER_FILTER, ASCII_LOWER_CASE_LETTER_FILTER, ASCII_UPPER_CASE_LETTER_FILTER, IDENTIFIER_FILTER, LATIN_DIGIT_FILTER, LATIN_DIGIT_OR_LETTER_FILTER, WHITESPACE_FILTER
 
Constructor Summary
ListCharFilter(boolean accept, char... charArray)
          The constructor.
 
Method Summary
 boolean accept(char c)
          This method determines if the given character c should be accepted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blacklist

private boolean blacklist
See Also:
accept(char)

chars

private final char[] chars
See Also:
accept(char)
Constructor Detail

ListCharFilter

public ListCharFilter(boolean accept,
                      char... charArray)
The constructor.

Parameters:
accept - - if true exactly the chars given by charArray are accepted (whitelist), if false exactly these chars are NOT accepted (blacklist).
charArray - are the chars to accept or to reject.
Method Detail

accept

public boolean accept(char c)
This method determines if the given character c should be accepted.

Specified by:
accept in interface CharFilter
Parameters:
c - is the character to check.
Returns:
true if the given character c is acceptable, false if it should be filtered.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.