1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.eos.trie;
17
18 import java.util.EventListener;
19 import java.util.EventObject;
20 import java.util.Map.Entry;
21
22 public interface TrieSource {
23
24 public static class TrieEntryEvent extends EventObject {
25 public TrieEntryEvent(final TrieEntry source) {
26 super(source);
27 }
28 }
29
30 public static interface TrieEntryListener extends EventListener {
31 void onEntry(final TrieEntryEvent event);
32 }
33
34
35
36
37
38 public static class TrieEntry implements Entry<String, String> {
39
40 private final String key;
41 private String value;
42
43
44
45 public TrieEntry(@SuppressWarnings("hiding") final String key) {
46 this(key, null);
47 }
48
49
50
51
52 @SuppressWarnings("nls")
53 public TrieEntry(@SuppressWarnings("hiding") final String key,
54 @SuppressWarnings("hiding") final String value) {
55 if (key == null) {
56 throw new IllegalArgumentException("key is null");
57 }
58 this.key = key;
59 this.value = value;
60 }
61
62
63
64
65 public String getKey() {
66 return this.key;
67 }
68
69
70
71
72 public String getValue() {
73 return this.value;
74 }
75
76
77
78
79 public String setValue(@SuppressWarnings("hiding") final String value) {
80 final String old = this.value;
81 this.value = value;
82 return old;
83 }
84 }
85
86 public void addTrieEntryListener(final TrieEntryListener listener);
87
88 public void removeTrieEntryListener(final TrieEntryListener listener);
89 }