Expresso 5-6

com.jcorporate.expresso.core.security.filters
Class FilterTree

java.lang.Object
  extended bycom.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

Field Summary
protected  FilterTreeNode root
           
 
Constructor Summary
FilterTree()
           
 
Method Summary
 void addFilterString(String specialString, String replacementString)
          Insert a filtering string into the parse tree.
 FilterTreeNode getRootNode()
           
 String replaceFilter(char[] input)
          Filters a string in a search and replace algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected FilterTreeNode root
Constructor Detail

FilterTree

public FilterTree()
Method Detail

addFilterString

public void addFilterString(String specialString,
                            String replacementString)
                     throws Exception
Insert a filtering string into the parse tree.

Parameters:
specialString - the string to look for
replacementString - 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

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.