# HG changeset patch # User Sascha L. Teichmann # Date 1349512721 -7200 # Node ID ca208b2f35a071365e99d1f18797c05cbcfec8b4 # Parent de6e2b933f33fa2fa83c63f5717935e4a451bf45 LegendProcessor: avoid redundant hashing. removed dead code. diff -r de6e2b933f33 -r ca208b2f35a0 flys-artifacts/ChangeLog --- 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 +2012-10-06 Sascha L. Teichmann + + * 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). diff -r de6e2b933f33 -r ca208b2f35a0 flys-artifacts/src/main/java/de/intevation/flys/exports/LegendProcessor.java --- 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 itemList = entries.get(hash); if (itemList == null) { itemList = new ArrayList(); + 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> cursor: entries.entrySet()) { - List itemList = cursor.getValue(); + for (List 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).