comparison flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java @ 4050:975f608dd254

Cleaned up iterating over maps. Removed some dead code.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 06 Oct 2012 12:27:01 +0200
parents b1912514e0f5
children c30771dbf1bd
comparison
equal deleted inserted replaced
4049:8e66293c5369 4050:975f608dd254
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.HashMap; 4 import java.util.HashMap;
5 import java.util.List; 5 import java.util.List;
6 import java.util.Map; 6 import java.util.Map;
7 import java.util.Set;
8 7
9 import org.w3c.dom.Document; 8 import org.w3c.dom.Document;
10 import org.w3c.dom.Element; 9 import org.w3c.dom.Element;
11 import org.w3c.dom.Node; 10 import org.w3c.dom.Node;
12 11
63 return; 62 return;
64 } 63 }
65 64
66 List<String> removeUs = new ArrayList<String>(); 65 List<String> removeUs = new ArrayList<String>();
67 66
68 Set<Map.Entry<String, Output>> entries = outputMap.entrySet(); 67 for (Map.Entry<String, Output> entry: outputMap.entrySet()) {
69 for (Map.Entry<String, Output> entry: entries) {
70 Output o = entry.getValue(); 68 Output o = entry.getValue();
71 69
72 List<Facet> facets = o.getFacets(); 70 List<Facet> facets = o.getFacets();
73 if (facets == null || facets.isEmpty()) { 71 if (facets == null || facets.isEmpty()) {
74 removeUs.add(entry.getKey()); 72 removeUs.add(entry.getKey());
220 if (outputMap == null || outputMap.isEmpty()) { 218 if (outputMap == null || outputMap.isEmpty()) {
221 logger.warn("No Outputs existing."); 219 logger.warn("No Outputs existing.");
222 return allFacets; 220 return allFacets;
223 } 221 }
224 222
225 Set<String> outputNames = outputMap.keySet(); 223 for (String outputName: outputMap.keySet()) {
226
227 for (String outputName: outputNames) {
228 allFacets.addAll(getFacets(outputName)); 224 allFacets.addAll(getFacets(outputName));
229 } 225 }
230 226
231 return allFacets; 227 return allFacets;
232 } 228 }
240 236
241 logger.debug("Append " + outputMap.size() + " Output Elements."); 237 logger.debug("Append " + outputMap.size() + " Output Elements.");
242 238
243 Element outputsEl = ec.create("outputs"); 239 Element outputsEl = ec.create("outputs");
244 240
245 Set<Map.Entry<String, Output>> entrySet = outputMap.entrySet(); 241 for (Map.Entry<String, Output> entry: outputMap.entrySet()) {
246
247 for (Map.Entry<String, Output> entry: entrySet) {
248 appendOutput(outputsEl, entry.getKey(), entry.getValue()); 242 appendOutput(outputsEl, entry.getKey(), entry.getValue());
249 } 243 }
250 244
251 root.appendChild(outputsEl); 245 root.appendChild(outputsEl);
252 } 246 }

http://dive4elements.wald.intevation.org