1 // $Id: PatternMap.java,v 1.1 2004/02/07 11:24:11 powerpete Exp $
2 // [JMP, 03.02.2004] Created this file.
3 package org.jface.stepmt.core;
4
5 import java.util.Collection;
6 import java.util.HashMap;
7 import java.util.Iterator;
8 import java.util.Map;
9
10 /***
11 * Used to store {@link Pattern}s.
12 *
13 * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
14 * @version $Id: PatternMap.java,v 1.1 2004/02/07 11:24:11 powerpete Exp $
15 */
16 public class PatternMap
17 {
18 private final Map patterns = new HashMap();
19
20 /***
21 * Adds a new {@link Pattern} to this.
22 *
23 * @param pattern The {@link Pattern}.
24 */
25 public void add(final Pattern pattern)
26 {
27 patterns.put(pattern.getName(), pattern);
28 }
29
30 /***
31 * Adds all {@link Pattern}s inside the given {@link Collection}.
32 *
33 * @param patterns The {@link Collection} holding {@link Pattern}
34 * instances.
35 */
36 public void addAll(final Collection patterns)
37 {
38 for (Iterator it = patterns.iterator(); it.hasNext();)
39 {
40 add((Pattern) it.next());
41 }
42 }
43
44 /***
45 * Returns a {@link Pattern} with the given name.
46 *
47 * @param name The name of the {@link Pattern}.
48 *
49 * @return The {@link Pattern}.
50 */
51 public Pattern get(final String name)
52 {
53 return (Pattern) patterns.get(name);
54 }
55 }
This page was automatically generated by Maven