com.jcorporate.expresso.core.security.filters
Class FilterTree
java.lang.Object
com.jcorporate.expresso.core.security.filters.FilterTree
- public class FilterTree
- extends Object
A filter tree is a data structure that allows for quick matching and replacement
of strings. Use it for a fast 'search and replace' system. Construction
and setup is a fairly expensive operation in comparison to the actual searching,
so use it for static types of filters that are usually instantiated for a long time.
- Author:
- Michael Rimov
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
root
protected FilterTreeNode root
FilterTree
public FilterTree()
addFilterString
public void addFilterString(String specialString,
String replacementString)
throws Exception
- Insert a filtering string into the parse tree.
- Parameters:
specialString - the string to look forreplacementString - the string to replace it with.
- Throws:
Exception - if insertNode() or setReplacementstring() fails
getRootNode
public FilterTreeNode getRootNode()
replaceFilter
public String replaceFilter(char[] input)
- Filters a string in a search and replace algorithm. Uses a "greedy" approach
so that it gets the biggest "fitting" string to cut.
- Parameters:
input - character array to examine.
- Returns:
- The filtered string
Please see www.jcorporate.com for information about new Expresso releases.