Mercurial > dive4elements > river
changeset 4046:ca208b2f35a0
LegendProcessor: avoid redundant hashing. removed dead code.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 06 Oct 2012 10:38:41 +0200 |
parents | de6e2b933f33 |
children | 3dc26ec2558d |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LegendProcessor.java |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Sat Oct 06 00:25:28 2012 +0200 +++ b/flys-artifacts/ChangeLog Sat Oct 06 10:38:41 2012 +0200 @@ -1,4 +1,7 @@ -2012-10-06 Christian Lins <christian.lins@intevation.de> +2012-10-06 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/exports/LegendProcessor.java: + Avoid redundant hashing. Removed dead code. * src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java: Fix for ArrayIndexOutOfBoundsException (#818).
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LegendProcessor.java Sat Oct 06 00:25:28 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LegendProcessor.java Sat Oct 06 10:38:41 2012 +0200 @@ -48,7 +48,7 @@ // boolean isShapeOutlineVisible() // boolean isShapeVisible() String hash = li.getLinePaint().toString(); - String label = li.getLabel(); + // XXX: DEAD CODE // String label = li.getLabel(); /*if (label.startsWith("W (") || label.startsWith("W(")) { hash += "-W-"; } @@ -86,14 +86,13 @@ List<LegendItem> itemList = entries.get(hash); if (itemList == null) { itemList = new ArrayList<LegendItem>(); + entries.put(hash, itemList); } itemList.add(item); if (itemList.size() > maxListSize) { maxListSize = itemList.size(); } - - entries.put(legendItemHash(item), itemList); } if (maxListSize < AGGR_THRESHOLD) { @@ -104,11 +103,10 @@ // Run over collected entries, merge their names and create new // entry if needed. LegendItemCollection newLegend = new LegendItemCollection(); - for (Map.Entry<String, List<LegendItem>> cursor: entries.entrySet()) { - List<LegendItem> itemList = cursor.getValue(); + for (List<LegendItem> itemList: entries.values()) { if (itemList.size() >= AGGR_THRESHOLD) { // Now do merging. - LegendItem item = itemList.get(0); + // XXX: DEAD CODE // LegendItem item = itemList.get(0); // Unfortunately we cannot clone and just setDescription, as this // method was added in JFreeChart 1.0.14 (we are at .13).