1
16 package gate.creole.gazetteer;
17
18 import java.util.*;
19
20 import gate.FeatureMap;
21 import gate.creole.ResourceInstantiationException;
22
23
25 public abstract class AbstractGazetteer
26 extends gate.creole.AbstractLanguageAnalyser implements Gazetteer {
27
28
29 protected Set listeners = new HashSet();
30
31
33 protected String annotationSetName;
34
35
36 protected FeatureMap features = null;
37
38
39 protected String encoding = "UTF-8";
40
41
45 protected java.net.URL listsURL;
46
47
50 protected Boolean caseSensitive = new Boolean(true);
51
52
56 protected Boolean wholeWordsOnly;
57
58
59 protected LinearDefinition definition;
60
61
63 protected MappingDefinition mappingDefinition;
64
65
66
70 public void setAnnotationSetName(String newAnnotationSetName) {
71 annotationSetName = newAnnotationSetName;
72 }
73
74
78 public String getAnnotationSetName() {
79 return annotationSetName;
80 }
81
82 public void setEncoding(String newEncoding) {
83 encoding = newEncoding;
84 }
85
86 public String getEncoding() {
87 return encoding;
88 }
89
90 public java.net.URL getListsURL() {
91 return listsURL;
92 }
93
94 public void setListsURL(java.net.URL newListsURL) {
95 listsURL = newListsURL;
96 }
97
98 public void setCaseSensitive(Boolean newCaseSensitive) {
99 caseSensitive = newCaseSensitive;
100 }
101
102 public Boolean getCaseSensitive() {
103 return caseSensitive;
104 }
105
106 public void setMappingDefinition(MappingDefinition mapping) {
107 mappingDefinition = mapping;
108 }
109
110 public MappingDefinition getMappingDefinition(){
111 return mappingDefinition;
112 }
113
114
118 public LinearDefinition getLinearDefinition() {
119 return definition;
120 }
121
122
123 public FeatureMap getFeatures(){
124 return features;
125 }
127
128 public void setFeatures(FeatureMap features){
129 this.features = features;
130 }
132 public void reInit() throws ResourceInstantiationException {
133 super.reInit();
134 fireGazetteerEvent(new GazetteerEvent(this,GazetteerEvent.REINIT));
135 }
137
141 public void fireGazetteerEvent(GazetteerEvent ge) {
142 Iterator li = listeners.iterator();
143 while ( li.hasNext()) {
144 GazetteerListener gl = (GazetteerListener) li.next();
145 gl.processGazetteerEvent(ge);
146 }
147 }
148
149
153 public void addGazetteerListener(GazetteerListener gl){
154 if ( null!=gl )
155 listeners.add(gl);
156 }
157
158
162 public Boolean getWholeWordsOnly() {
163 return wholeWordsOnly;
164 }
165
166
170 public void setWholeWordsOnly(Boolean wholeWordsOnly) {
171 this.wholeWordsOnly = wholeWordsOnly;
172 }
173
174 }