Mangler pattern

Mangler pattern

Mangler is a software design pattern. A Mangler is a pattern that performs multiple operations over a series of data, similar to the MapReduce function inside of BigTable and Amazon's Dynamo. Typically, a mangler is fed a series of Maps from which it performs its internal operations and passes its internal state/data to an external Filter.

A typical usage of the Mangler Pattern is during internal search operations. When parsing a query from an end-user, the system will try and strip out a series of un-needed tokens, reassembling the original query into a more usable, functional query.

An important distinction between the Mangler and other patterns is the "Modify in place" optimization, pioneered by the pattern's creator.

This pattern was created by Dr. John Watson, during his tenure at TransUnion's Research and Development Lab.

Java

// This is a trivial implementation of Mangler in Java.
 
public interface TokenMangler {
        List<String> mangleTokens (List<String> tokens);
}
 
public class LowerCasingTokenMangler implements TokenMangler {
 
        List<String> mangleTokens (List<String> tokens) {
                List<String> results = new ArrayList<String>();
 
                for (String token : tokens) {
                        results.add(token.toLowerCase());
                }
 
                return results;
        }
}

Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Mangler Pattern — Mangler is a software design pattern. A Mangler is a pattern that performs multiple operations over a series of data, similar to the MapReduce function inside of BigTable and Amazon s Dynamo. Typically, a mangler is fed a series of Maps from… …   Wikipedia

  • Kingdom Hospital — Stephen King s Kingdom Hospital Opening title Format Comedy Horror Created by Lars von Trier Developed by Stephe …   Wikipedia

  • Gram Parsons — Infobox musical artist Name = Gram Parsons Img capt = Gram Parsons, wearing his Nudie suit on the lot of A M records. Img size = Landscape = Background = solo singer Birth name = Ingram Cecil Connor III Alias = Born = birth date|1946|11|5|mf=y… …   Wikipedia

  • Parma, Ohio — Infobox Settlement official name = City of Parma settlement type = City nickname = imagesize = image caption = image mapsize = 250px map caption = Location of Parma in Ohio mapsize1 = 250px map caption1 = Location of Parma in Cuyahoga County… …   Wikipedia

  • Grind house — (also known as GrindHouse, Grindhouse, Gryndhouse, Mühlehaus) is a type of electronic house music that conforms to a set of rules known as The Ten Commandments of Grind House. The style is characterized by the absence of harmonic progression, a… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”