Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 4778:a70de5298248
ImportRiver: Add helper implementation of a CrossSectionParserCallback.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 08 Jan 2013 11:57:03 +0100 |
parents | 03246a8b3869 |
children | 18908a3cbb3a |
comparison
equal
deleted
inserted
replaced
4777:34398f424cfd | 4778:a70de5298248 |
---|---|
154 | 154 |
155 protected AnnotationClassifier annotationClassifier; | 155 protected AnnotationClassifier annotationClassifier; |
156 | 156 |
157 protected River peer; | 157 protected River peer; |
158 | 158 |
159 | |
160 /** Callback-implementation for CrossSectionParsers. */ | |
161 class ImportRiverCrossSectionParserCallback implements CrossSectionParser.Callback { | |
162 Set<HashedFile> files = new HashSet<HashedFile>(); | |
163 String type; | |
164 | |
165 | |
166 /** | |
167 * Create new Callback, given type which is used for logging | |
168 * purposes only. | |
169 */ | |
170 public ImportRiverCrossSectionParserCallback (String type) { | |
171 this.type = type; | |
172 } | |
173 | |
174 | |
175 /** Accept file if not duplicate. */ | |
176 public boolean accept(File file) { | |
177 HashedFile hf = new HashedFile(file); | |
178 boolean success = files.add(hf); | |
179 if (!success) { | |
180 log.warn(type + " file '" + file + "' seems to be a duplicate."); | |
181 } | |
182 return success; | |
183 } | |
184 | |
185 | |
186 /** Add crosssection. */ | |
187 public void parsed(CrossSectionParser parser) { | |
188 log.debug("callback from " + type + " parser"); | |
189 | |
190 addCrossSections(parser); | |
191 } | |
192 } | |
193 | |
194 | |
159 public ImportRiver() { | 195 public ImportRiver() { |
160 hyks = new ArrayList<ImportHYK>(); | 196 hyks = new ArrayList<ImportHYK>(); |
161 crossSections = new ArrayList<ImportCrossSection>(); | 197 crossSections = new ArrayList<ImportCrossSection>(); |
162 extraWsts = new ArrayList<ImportWst>(); | 198 extraWsts = new ArrayList<ImportWst>(); |
163 fixations = new ArrayList<ImportWst>(); | 199 fixations = new ArrayList<ImportWst>(); |