mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22: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;
|
package org.diylc.netlist;
|
||||||
|
|
||||||
|
public class Summary implements Comparable<Summary> {
|
||||||
public class Summary {
|
|
||||||
|
|
||||||
private Netlist netlist;
|
private Netlist netlist;
|
||||||
private String summary;
|
private String summary;
|
||||||
@@ -37,6 +36,10 @@ public class Summary {
|
|||||||
return netlist;
|
return netlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void append(Netlist netlist) {
|
||||||
|
this.netlist.getSwitchSetup().addAll(netlist.getSwitchSetup());
|
||||||
|
}
|
||||||
|
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
@@ -76,4 +79,9 @@ public class Summary {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return summary.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;
|
package org.diylc.netlist;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
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 {
|
public List<Summary> summarize(List<Netlist> netlists, Node preferredOutput) throws TreeException {
|
||||||
List<Summary> summaries = new ArrayList<Summary>();
|
Map<String, Summary> summaries = new HashMap<String, Summary>();
|
||||||
for (Netlist n : netlists)
|
for (Netlist n : netlists) {
|
||||||
summaries.add(summarize(n, preferredOutput));
|
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;
|
private int positiveCount;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -2646,6 +2646,10 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Honor all possible combinations of "DIP Switch" positions when creating a netlist</description>
|
<description>Honor all possible combinations of "DIP Switch" positions when creating a netlist</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</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>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Scan "library" folder for any additional JAR files that may contain more components</description>
|
<description>Scan "library" folder for any additional JAR files that may contain more components</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user