View Javadoc

1   // %317440327:hoplugins.teamAnalyzer.manager%
2   package hoplugins.teamAnalyzer.manager;
3   
4   import java.util.Hashtable;
5   import java.util.Iterator;
6   import java.util.List;
7   import java.util.StringTokenizer;
8   
9   
10  /***
11   * DOCUMENT ME!
12   *
13   * @author Massimiliano Amato
14   */
15  public class NameManager {
16      //~ Static fields/initializers -----------------------------------------------------------------
17  
18      private static Hashtable names = new Hashtable();
19  
20      //~ Methods ------------------------------------------------------------------------------------
21  
22      /***
23       * TODO Missing Method Documentation
24       *
25       * @param name TODO Missing Method Parameter Documentation
26       *
27       * @return TODO Missing Return Method Documentation
28       */
29      public static String getLastName(String name) {
30          String lastName = "";
31  
32          for (Iterator iter = names.keySet().iterator(); iter.hasNext();) {
33              String storedName = (String) iter.next();
34  
35              if (name.indexOf(storedName) > 0) {
36                  return storedName;
37              }
38          }
39  
40          StringTokenizer st = new StringTokenizer(name, " ");
41  
42          while (st.hasMoreTokens()) {
43              lastName = st.nextToken();
44          }
45  
46          return lastName;
47      }
48  
49      /***
50       * TODO Missing Method Documentation
51       *
52       * @param name TODO Missing Method Parameter Documentation
53       */
54      public static void addName(String name) {
55          names.put(name, name);
56      }
57  
58      /***
59       * TODO Missing Method Documentation
60       *
61       * @param nameList TODO Missing Method Parameter Documentation
62       */
63      public static void addNames(List nameList) {
64          for (Iterator iter = nameList.iterator(); iter.hasNext();) {
65              String name = (String) iter.next();
66  
67              names.put(name, name);
68          }
69      }
70  
71      /***
72       * TODO Missing Method Documentation
73       */
74      public static void clean() {
75          names = new Hashtable();
76      }
77  }