Merge switch configurations that yield with the same effective wiring

for "Analyze Guitar Wirings" module, for more compact report
This commit is contained in:
Branislav Stojkovic
2019-03-14 22:26:49 +01:00
parent 8d3789a0b0
commit 41d2b73cca
6 changed files with 26 additions and 6 deletions
@@ -21,8 +21,7 @@
*/
package org.diylc.netlist;
public class Summary {
public class Summary implements Comparable<Summary> {
private Netlist netlist;
private String summary;
@@ -37,6 +36,10 @@ public class Summary {
return netlist;
}
public void append(Netlist netlist) {
this.netlist.getSwitchSetup().addAll(netlist.getSwitchSetup());
}
public String getSummary() {
return summary;
}
@@ -76,4 +79,9 @@ public class Summary {
public String toString() {
return summary.toString();
}
@Override
public int compareTo(Summary o) {
return netlist.compareTo(o.netlist);
}
}
Binary file not shown.
@@ -22,6 +22,7 @@
package org.diylc.netlist;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -85,11 +86,18 @@ public class GuitarDiagramAnalyzer extends NetlistAnalyzer implements INetlistAn
}
public List<Summary> summarize(List<Netlist> netlists, Node preferredOutput) throws TreeException {
List<Summary> summaries = new ArrayList<Summary>();
for (Netlist n : netlists)
summaries.add(summarize(n, preferredOutput));
Map<String, Summary> summaries = new HashMap<String, Summary>();
for (Netlist n : netlists) {
Summary s = summarize(n, preferredOutput);
if (summaries.containsKey(s.getSummary()))
summaries.get(s.getSummary()).append(n);
else
summaries.put(s.getSummary(), s);
}
return summaries;
List<Summary> res = new ArrayList<Summary>(summaries.values());
Collections.sort(res);
return res;
}
private int positiveCount;
Binary file not shown.
Binary file not shown.
+4
View File
@@ -2646,6 +2646,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Honor all possible combinations of "DIP Switch" positions when creating a netlist</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Merge switch configurations that yield with the same effective wiring for "Analyze Guitar Wirings" module, for more compact report</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Scan "library" folder for any additional JAR files that may contain more components</description>