mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Merge switch configurations that yield with the same effective wiring
for "Analyze Guitar Wirings" module, for more compact report
This commit is contained in:
@@ -21,8 +21,7 @@
|
||||
*/
|
||||
package org.diylc.netlist;
|
||||
|
||||
|
||||
public class Summary {
|
||||
public class Summary implements Comparable<Summary> {
|
||||
|
||||
private Netlist netlist;
|
||||
private String summary;
|
||||
@@ -36,6 +35,10 @@ public class Summary {
|
||||
public Netlist getNetlist() {
|
||||
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.
@@ -2645,6 +2645,10 @@
|
||||
<org.diylc.appframework.update.Change>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user