source: proiecte/HadoopA51/src/java/ro/pub/cs/pp/a51hadoop/algorithm/testing/DigitHashfn.java @ 166

Last change on this file since 166 was 166, checked in by (none), 14 years ago

HadoopA51: imported git repository from github

File size: 564 bytes
Line 
1package ro.pub.cs.pp.a51hadoop.algorithm.testing;
2
3import ro.pub.cs.pp.a51hadoop.algorithm.Hashfn;
4
5/*
6 * Apply a hash function on a given string.
7 */
8public class DigitHashfn implements Hashfn
9{
10        public String hashfn(String txt)
11        {
12                /*
13                 * This simple hashfn only exchanges the two halves of
14                 * a string and returns their new combination.
15                 *
16                 * This is used only in the testing phase to check
17                 * whether the rest of the framework works correclty.
18                 */
19                return txt.substring(txt.length() / 2, txt.length()) +
20                        txt.substring(0, txt.length() / 2);
21        }
22}
Note: See TracBrowser for help on using the repository browser.