mavenization

This commit is contained in:
Branislav Stojkovic
2025-03-10 16:12:55 +01:00
parent 2caa91eb2e
commit dac2f8554a
273 changed files with 309 additions and 361 deletions
-28
View File
@@ -80,32 +80,4 @@
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven-Ant integration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>ant-build</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Call your existing Ant build file -->
<ant antfile="${basedir}/build.xml" target="jar">
<!-- Pass Maven properties to Ant if needed -->
<property name="version" value="${project.version}"/>
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -21,6 +21,8 @@
*/
package org.diylc.core.images;
import org.apache.log4j.Logger;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
@@ -57,11 +59,11 @@ public enum IconLoader {
}
public Icon getIcon() {
java.net.URL imgURL = getClass().getResource(name);
java.net.URL imgURL = getClass().getResource("/images/" + name);
if (imgURL != null) {
return new ImageIcon(imgURL, name);
} else {
System.err.println("Couldn't find file: " + name);
Logger.getLogger(IconLoader.class).error("Couldn't find file: " + name);
return null;
}
}
@@ -69,9 +71,9 @@ public enum IconLoader {
public Image getImage() {
BufferedImage img = null;
try {
img = ImageIO.read(getClass().getResourceAsStream(name));
img = ImageIO.read(getClass().getResourceAsStream("/images/" + name));
} catch (IOException e) {
System.err.println("Couldn't find file: " + name);
Logger.getLogger(IconLoader.class).error("Couldn't find file: " + name);
}
return img;
}

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 875 B

Before

Width:  |  Height:  |  Size: 729 B

After

Width:  |  Height:  |  Size: 729 B

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 749 B

Before

Width:  |  Height:  |  Size: 736 B

After

Width:  |  Height:  |  Size: 736 B

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 707 B

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 714 B

Before

Width:  |  Height:  |  Size: 993 B

After

Width:  |  Height:  |  Size: 993 B

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 863 B

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 708 B

Before

Width:  |  Height:  |  Size: 960 B

After

Width:  |  Height:  |  Size: 960 B

Before

Width:  |  Height:  |  Size: 901 B

After

Width:  |  Height:  |  Size: 901 B

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 595 B

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 914 B

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 876 B

Before

Width:  |  Height:  |  Size: 853 B

After

Width:  |  Height:  |  Size: 853 B

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 596 B

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 765 B

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 696 B

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 845 B

After

Width:  |  Height:  |  Size: 845 B

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 928 B

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 697 B

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

Before

Width:  |  Height:  |  Size: 892 B

After

Width:  |  Height:  |  Size: 892 B

Before

Width:  |  Height:  |  Size: 751 B

After

Width:  |  Height:  |  Size: 751 B

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 834 B

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 990 B

Before

Width:  |  Height:  |  Size: 842 B

After

Width:  |  Height:  |  Size: 842 B

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 910 B

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 875 B

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 694 B

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 773 B

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 1004 B

Before

Width:  |  Height:  |  Size: 995 B

After

Width:  |  Height:  |  Size: 995 B

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 656 B

Before

Width:  |  Height:  |  Size: 675 B

After

Width:  |  Height:  |  Size: 675 B

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 708 B

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 898 B

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 852 B

Before

Width:  |  Height:  |  Size: 894 B

After

Width:  |  Height:  |  Size: 894 B

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 789 B

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 785 B

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 833 B

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 747 B

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 709 B

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 783 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 922 B

After

Width:  |  Height:  |  Size: 922 B

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 838 B

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 835 B

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 895 B

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 947 B

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 826 B

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

Before

Width:  |  Height:  |  Size: 879 B

After

Width:  |  Height:  |  Size: 879 B

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 883 B

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

Before

Width:  |  Height:  |  Size: 541 B

After

Width:  |  Height:  |  Size: 541 B

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 775 B

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 858 B

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.
-28
View File
@@ -81,32 +81,4 @@
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven-Ant integration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>ant-build</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Call your existing Ant build file -->
<ant antfile="${basedir}/build.xml" target="jar">
<!-- Pass Maven properties to Ant if needed -->
<property name="version" value="${project.version}"/>
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -285,7 +285,7 @@ public class Freeway3x3_03 extends AbstractTransparentComponent<Void> implements
if (svgDiagram == null) {
try {
byte[] data =
IOUtils.toByteArray(Freeway3x3_03.class.getResourceAsStream("freeway_3x3-03.svg"));
IOUtils.toByteArray(Freeway3x3_03.class.getResourceAsStream("/freeway_3x3-03.svg"));
ByteArrayInputStream bis = new ByteArrayInputStream(data);
SVGUniverse universe = new SVGUniverse();
URI url = universe.loadSVG(bis,
@@ -66,7 +66,7 @@ public class Image extends AbstractTransparentComponent<Void> {
private Orientation orientation;
static {
String name = "image.png";
String name = "/image.png";
java.net.URL imgURL = Image.class.getResource(name);
if (imgURL != null) {
ICON = new ImageIcon(imgURL, name);
@@ -88,7 +88,7 @@ public class Image extends AbstractTransparentComponent<Void> {
public Image() {
try {
data = IOUtils.toByteArray(Image.class.getResourceAsStream("image.png"));
data = IOUtils.toByteArray(Image.class.getResourceAsStream("/image.png"));
} catch (IOException e) {
e.printStackTrace();
}
@@ -81,7 +81,7 @@ public class SVGImage extends AbstractTransparentComponent<Void> {
public SVGImage() {
try {
data = IOUtils.toByteArray(SVGImage.class.getResourceAsStream("diylc.svg"));
data = IOUtils.toByteArray(SVGImage.class.getResourceAsStream("/diylc.svg"));
} catch (IOException e) {
e.printStackTrace();
}

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -1,291 +1,291 @@
/*
*
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
*
* This file is part of DIYLC.
*
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
package org.diylc.netlist;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import org.junit.Test;
import org.diylc.components.electromechanical.OpenJack1_4;
import org.diylc.components.guitar.HumbuckerPickup;
import org.diylc.components.guitar.SingleCoilPickup;
import org.diylc.components.passive.PotentiometerPanel;
import org.diylc.components.passive.RadialCeramicDiskCapacitor;
import org.diylc.netlist.Group;
import org.diylc.netlist.GuitarDiagramAnalyzer;
import org.diylc.netlist.Netlist;
import org.diylc.netlist.Tree;
import org.diylc.netlist.TreeException;
public class GuitarNetlistAnalyzerTests {
@Test
public void testOneSinglePickup() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
SingleCoilPickup pickup = new SingleCoilPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 1);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 2);
netlist.add(tipGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.North<-))", s);
}
@Test
public void testOneSinglePickupVolPot() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
SingleCoilPickup pickup = new SingleCoilPickup();
pickup.setName("Pickup");
PotentiometerPanel vol = new PotentiometerPanel();
vol.setName("Volume");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup, vol));
Group hotGroup = new Group().connect(pickup, 1).connect(vol, 0);
Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 2).connect(vol, 2);
netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Volume.1-2 + Pickup.North<-) || (Volume.2-3))", s);
}
@Test
public void testOneSinglePickupVolTonePot() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
SingleCoilPickup pickup = new SingleCoilPickup();
pickup.setName("Pickup");
PotentiometerPanel vol = new PotentiometerPanel();
vol.setName("Volume");
PotentiometerPanel tone = new PotentiometerPanel();
tone.setName("Tone");
RadialCeramicDiskCapacitor cap = new RadialCeramicDiskCapacitor();
cap.setName("Cap");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup, vol, tone, cap));
Group hotGroup = new Group().connect(pickup, 1).connect(vol, 0).connect(tone, 2);
Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
Group sleeveGroup =
new Group().connect(jack, 1).connect(pickup, 2).connect(vol, 2).connect(cap, 0);
Group toneGroup = new Group().connect(tone, 1).connect(cap, 1);
netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(toneGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("(((Volume.1-2) + ((Pickup.North<-) || (Tone.2-3 + Cap))) || (Volume.2-3))", s);
}
@Test
public void testTwoSinglePickupsMasterVolSeparateTone() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
SingleCoilPickup pickup1 = new SingleCoilPickup();
pickup1.setName("Pickup1");
SingleCoilPickup pickup2 = new SingleCoilPickup();
pickup2.setName("Pickup2");
PotentiometerPanel vol = new PotentiometerPanel();
vol.setName("Volume");
PotentiometerPanel tone1 = new PotentiometerPanel();
tone1.setName("Tone1");
PotentiometerPanel tone2 = new PotentiometerPanel();
tone2.setName("Tone2");
RadialCeramicDiskCapacitor cap1 = new RadialCeramicDiskCapacitor();
cap1.setName("Cap1");
RadialCeramicDiskCapacitor cap2 = new RadialCeramicDiskCapacitor();
cap2.setName("Cap2");
Netlist netlist =
new Netlist(Arrays.asList(jack, pickup1, pickup2, vol, tone1, tone2, cap1, cap2));
Group hotGroup = new Group().connect(pickup1, 1).connect(vol, 0).connect(tone1, 2)
.connect(pickup2, 1).connect(tone2, 2);
Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 2).connect(pickup2, 2)
.connect(vol, 2).connect(cap1, 0).connect(cap2, 0);
Group tone1Group = new Group().connect(tone1, 1).connect(cap1, 1);
Group tone2Group = new Group().connect(tone2, 1).connect(cap2, 1);
netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(tone1Group)
.add(tone2Group);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals(
"(((Volume.1-2) + ((Pickup1.North<-) || (Pickup2.North<-) || (Tone1.2-3 + Cap1) || (Tone2.2-3 + Cap2))) || (Volume.2-3))",
s);
}
@Test
public void testOneSinglePickupReverse() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
SingleCoilPickup pickup = new SingleCoilPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1);
netlist.add(tipGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.North->))", s);
}
@Test
public void testOneHumbuckerSeries() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup = new HumbuckerPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0);
Group coilTapGroup = new Group().connect(pickup, 1).connect(pickup, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 3);
netlist.add(tipGroup).add(coilTapGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.North<- + Pickup.South<-))", s);
}
@Test
public void testOneHumbuckerSeriesReverse() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup = new HumbuckerPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 3);
Group coilTapGroup = new Group().connect(pickup, 1).connect(pickup, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 0);
netlist.add(tipGroup).add(coilTapGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.South-> + Pickup.North->))", s);
}
@Test
public void testOneHumbuckerParallel() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup = new HumbuckerPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0).connect(pickup, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1).connect(pickup, 3);
netlist.add(tipGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.North<-) || (Pickup.South<-))", s);
}
@Test
public void testOneHumbuckerParallelOutOfPhase() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup = new HumbuckerPickup();
pickup.setName("Pickup");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0).connect(pickup, 3);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1).connect(pickup, 2);
netlist.add(tipGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup.North<-) || (Pickup.South->))", s);
}
@Test
public void testTwoHumbuckersSeries() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup1 = new HumbuckerPickup();
pickup1.setName("Pickup1");
HumbuckerPickup pickup2 = new HumbuckerPickup();
pickup2.setName("Pickup2");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0);
Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
Group joinGroup = new Group().connect(pickup1, 3).connect(pickup2, 0);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup2, 3);
netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(joinGroup).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup1.North<- + Pickup1.South<- + Pickup2.North<- + Pickup2.South<-))", s);
}
@Test
public void testTwoHumbuckersParallel() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup1 = new HumbuckerPickup();
pickup1.setName("Pickup1");
HumbuckerPickup pickup2 = new HumbuckerPickup();
pickup2.setName("Pickup2");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0).connect(pickup2, 0);
Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 3);
netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup1.North<- + Pickup1.South<-) || (Pickup2.North<- + Pickup2.South<-))", s);
}
@Test
public void testTwoHumbuckersParallelOutOfPhase() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup1 = new HumbuckerPickup();
pickup1.setName("Pickup1");
HumbuckerPickup pickup2 = new HumbuckerPickup();
pickup2.setName("Pickup2");
Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0).connect(pickup2, 3);
Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 0);
netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(sleeveGroup);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals("((Pickup1.North<- + Pickup1.South<-) || (Pickup2.South-> + Pickup2.North->))", s);
}
@Test
public void testTwoHumbuckersMasterVolSeparateTone() throws TreeException {
OpenJack1_4 jack = new OpenJack1_4();
HumbuckerPickup pickup1 = new HumbuckerPickup();
pickup1.setName("Pickup1");
HumbuckerPickup pickup2 = new HumbuckerPickup();
pickup2.setName("Pickup2");
PotentiometerPanel vol = new PotentiometerPanel();
vol.setName("Volume");
PotentiometerPanel tone1 = new PotentiometerPanel();
tone1.setName("Tone1");
PotentiometerPanel tone2 = new PotentiometerPanel();
tone2.setName("Tone2");
RadialCeramicDiskCapacitor cap1 = new RadialCeramicDiskCapacitor();
cap1.setName("Cap1");
RadialCeramicDiskCapacitor cap2 = new RadialCeramicDiskCapacitor();
cap2.setName("Cap2");
Netlist netlist =
new Netlist(Arrays.asList(jack, pickup1, pickup2, vol, tone1, tone2, cap1, cap2));
Group hotGroup = new Group().connect(pickup1, 0).connect(vol, 0).connect(tone1, 2)
.connect(pickup2, 0).connect(tone2, 2);
Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 3)
.connect(vol, 2).connect(cap1, 0).connect(cap2, 0);
Group tone1Group = new Group().connect(tone1, 1).connect(cap1, 1);
Group tone2Group = new Group().connect(tone2, 1).connect(cap2, 1);
Group coilTap1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
Group coilTap2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(tone1Group)
.add(tone2Group).add(coilTap1).add(coilTap2);
Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
String s = tree.toString();
assertEquals(
"(((Volume.1-2) + ((Pickup1.North<- + Pickup1.South<-) || (Pickup2.North<- + Pickup2.South<-) || (Tone1.2-3 + Cap1) || (Tone2.2-3 + Cap2))) || (Volume.2-3))",
s);
}
}
///*
// *
// * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
// *
// * This file is part of DIYLC.
// *
// * DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
// * General Public License as published by the Free Software Foundation, either version 3 of the
// * License, or (at your option) any later version.
// *
// * DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// * Public License for more details.
// *
// * You should have received a copy of the GNU General Public License along with DIYLC. If not, see
// * <http://www.gnu.org/licenses/>.
// *
// */
//package org.diylc.netlist;
//
//import static org.junit.Assert.assertEquals;
//import java.util.Arrays;
//
//import org.junit.Test;
//
//import org.diylc.components.electromechanical.OpenJack1_4;
//import org.diylc.components.guitar.HumbuckerPickup;
//import org.diylc.components.guitar.SingleCoilPickup;
//import org.diylc.components.passive.PotentiometerPanel;
//import org.diylc.components.passive.RadialCeramicDiskCapacitor;
//import org.diylc.netlist.Group;
//import org.diylc.netlist.GuitarDiagramAnalyzer;
//import org.diylc.netlist.Netlist;
//import org.diylc.netlist.Tree;
//import org.diylc.netlist.TreeException;
//
//public class GuitarNetlistAnalyzerTests {
//
// @Test
// public void testOneSinglePickup() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// SingleCoilPickup pickup = new SingleCoilPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 1);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 2);
// netlist.add(tipGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.North<-))", s);
// }
//
// @Test
// public void testOneSinglePickupVolPot() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// SingleCoilPickup pickup = new SingleCoilPickup();
// pickup.setName("Pickup");
// PotentiometerPanel vol = new PotentiometerPanel();
// vol.setName("Volume");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup, vol));
// Group hotGroup = new Group().connect(pickup, 1).connect(vol, 0);
// Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 2).connect(vol, 2);
// netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Volume.1-2 + Pickup.North<-) || (Volume.2-3))", s);
// }
//
// @Test
// public void testOneSinglePickupVolTonePot() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// SingleCoilPickup pickup = new SingleCoilPickup();
// pickup.setName("Pickup");
// PotentiometerPanel vol = new PotentiometerPanel();
// vol.setName("Volume");
// PotentiometerPanel tone = new PotentiometerPanel();
// tone.setName("Tone");
// RadialCeramicDiskCapacitor cap = new RadialCeramicDiskCapacitor();
// cap.setName("Cap");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup, vol, tone, cap));
// Group hotGroup = new Group().connect(pickup, 1).connect(vol, 0).connect(tone, 2);
// Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
// Group sleeveGroup =
// new Group().connect(jack, 1).connect(pickup, 2).connect(vol, 2).connect(cap, 0);
// Group toneGroup = new Group().connect(tone, 1).connect(cap, 1);
// netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(toneGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("(((Volume.1-2) + ((Pickup.North<-) || (Tone.2-3 + Cap))) || (Volume.2-3))", s);
// }
//
// @Test
// public void testTwoSinglePickupsMasterVolSeparateTone() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// SingleCoilPickup pickup1 = new SingleCoilPickup();
// pickup1.setName("Pickup1");
// SingleCoilPickup pickup2 = new SingleCoilPickup();
// pickup2.setName("Pickup2");
// PotentiometerPanel vol = new PotentiometerPanel();
// vol.setName("Volume");
// PotentiometerPanel tone1 = new PotentiometerPanel();
// tone1.setName("Tone1");
// PotentiometerPanel tone2 = new PotentiometerPanel();
// tone2.setName("Tone2");
// RadialCeramicDiskCapacitor cap1 = new RadialCeramicDiskCapacitor();
// cap1.setName("Cap1");
// RadialCeramicDiskCapacitor cap2 = new RadialCeramicDiskCapacitor();
// cap2.setName("Cap2");
// Netlist netlist =
// new Netlist(Arrays.asList(jack, pickup1, pickup2, vol, tone1, tone2, cap1, cap2));
// Group hotGroup = new Group().connect(pickup1, 1).connect(vol, 0).connect(tone1, 2)
// .connect(pickup2, 1).connect(tone2, 2);
// Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 2).connect(pickup2, 2)
// .connect(vol, 2).connect(cap1, 0).connect(cap2, 0);
// Group tone1Group = new Group().connect(tone1, 1).connect(cap1, 1);
// Group tone2Group = new Group().connect(tone2, 1).connect(cap2, 1);
// netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(tone1Group)
// .add(tone2Group);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals(
// "(((Volume.1-2) + ((Pickup1.North<-) || (Pickup2.North<-) || (Tone1.2-3 + Cap1) || (Tone2.2-3 + Cap2))) || (Volume.2-3))",
// s);
// }
//
// @Test
// public void testOneSinglePickupReverse() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// SingleCoilPickup pickup = new SingleCoilPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1);
// netlist.add(tipGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.North->))", s);
// }
//
// @Test
// public void testOneHumbuckerSeries() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup = new HumbuckerPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0);
// Group coilTapGroup = new Group().connect(pickup, 1).connect(pickup, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 3);
// netlist.add(tipGroup).add(coilTapGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.North<- + Pickup.South<-))", s);
// }
//
// @Test
// public void testOneHumbuckerSeriesReverse() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup = new HumbuckerPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 3);
// Group coilTapGroup = new Group().connect(pickup, 1).connect(pickup, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 0);
// netlist.add(tipGroup).add(coilTapGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.South-> + Pickup.North->))", s);
// }
//
// @Test
// public void testOneHumbuckerParallel() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup = new HumbuckerPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0).connect(pickup, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1).connect(pickup, 3);
// netlist.add(tipGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.North<-) || (Pickup.South<-))", s);
// }
//
// @Test
// public void testOneHumbuckerParallelOutOfPhase() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup = new HumbuckerPickup();
// pickup.setName("Pickup");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup, 0).connect(pickup, 3);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup, 1).connect(pickup, 2);
// netlist.add(tipGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup.North<-) || (Pickup.South->))", s);
// }
//
// @Test
// public void testTwoHumbuckersSeries() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup1 = new HumbuckerPickup();
// pickup1.setName("Pickup1");
// HumbuckerPickup pickup2 = new HumbuckerPickup();
// pickup2.setName("Pickup2");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0);
// Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
// Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
// Group joinGroup = new Group().connect(pickup1, 3).connect(pickup2, 0);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup2, 3);
// netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(joinGroup).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup1.North<- + Pickup1.South<- + Pickup2.North<- + Pickup2.South<-))", s);
// }
//
// @Test
// public void testTwoHumbuckersParallel() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup1 = new HumbuckerPickup();
// pickup1.setName("Pickup1");
// HumbuckerPickup pickup2 = new HumbuckerPickup();
// pickup2.setName("Pickup2");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0).connect(pickup2, 0);
// Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
// Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 3);
// netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup1.North<- + Pickup1.South<-) || (Pickup2.North<- + Pickup2.South<-))", s);
// }
//
// @Test
// public void testTwoHumbuckersParallelOutOfPhase() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup1 = new HumbuckerPickup();
// pickup1.setName("Pickup1");
// HumbuckerPickup pickup2 = new HumbuckerPickup();
// pickup2.setName("Pickup2");
// Netlist netlist = new Netlist(Arrays.asList(jack, pickup1, pickup2));
// Group tipGroup = new Group().connect(jack, 0).connect(pickup1, 0).connect(pickup2, 3);
// Group coilTapGroup1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
// Group coilTapGroup2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 0);
// netlist.add(tipGroup).add(coilTapGroup1).add(coilTapGroup2).add(sleeveGroup);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals("((Pickup1.North<- + Pickup1.South<-) || (Pickup2.South-> + Pickup2.North->))", s);
// }
//
// @Test
// public void testTwoHumbuckersMasterVolSeparateTone() throws TreeException {
// OpenJack1_4 jack = new OpenJack1_4();
// HumbuckerPickup pickup1 = new HumbuckerPickup();
// pickup1.setName("Pickup1");
// HumbuckerPickup pickup2 = new HumbuckerPickup();
// pickup2.setName("Pickup2");
// PotentiometerPanel vol = new PotentiometerPanel();
// vol.setName("Volume");
// PotentiometerPanel tone1 = new PotentiometerPanel();
// tone1.setName("Tone1");
// PotentiometerPanel tone2 = new PotentiometerPanel();
// tone2.setName("Tone2");
// RadialCeramicDiskCapacitor cap1 = new RadialCeramicDiskCapacitor();
// cap1.setName("Cap1");
// RadialCeramicDiskCapacitor cap2 = new RadialCeramicDiskCapacitor();
// cap2.setName("Cap2");
// Netlist netlist =
// new Netlist(Arrays.asList(jack, pickup1, pickup2, vol, tone1, tone2, cap1, cap2));
// Group hotGroup = new Group().connect(pickup1, 0).connect(vol, 0).connect(tone1, 2)
// .connect(pickup2, 0).connect(tone2, 2);
// Group tipGroup = new Group().connect(jack, 0).connect(vol, 1);
// Group sleeveGroup = new Group().connect(jack, 1).connect(pickup1, 3).connect(pickup2, 3)
// .connect(vol, 2).connect(cap1, 0).connect(cap2, 0);
// Group tone1Group = new Group().connect(tone1, 1).connect(cap1, 1);
// Group tone2Group = new Group().connect(tone2, 1).connect(cap2, 1);
// Group coilTap1 = new Group().connect(pickup1, 1).connect(pickup1, 2);
// Group coilTap2 = new Group().connect(pickup2, 1).connect(pickup2, 2);
// netlist.add(tipGroup).add(tipGroup).add(sleeveGroup).add(hotGroup).add(tone1Group)
// .add(tone2Group).add(coilTap1).add(coilTap2);
// Tree tree = new GuitarDiagramAnalyzer().constructTree(netlist);
// String s = tree.toString();
// assertEquals(
// "(((Volume.1-2) + ((Pickup1.North<- + Pickup1.South<-) || (Pickup2.North<- + Pickup2.South<-) || (Tone1.2-3 + Cap1) || (Tone2.2-3 + Cap2))) || (Volume.2-3))",
// s);
// }
//}
-1
View File
@@ -3,7 +3,6 @@
/log/
/build/
/library/
/lib/diylc-core.jar
autoSave.diy
config.xml
/launch4j.log

Some files were not shown because too many files have changed in this diff Show More