This commit is contained in:
Bane Stojkovic
2025-03-16 22:36:24 +01:00
parent 1c48d7c31f
commit 896a623c7c
4 changed files with 11 additions and 30 deletions
@@ -28,7 +28,7 @@ import java.awt.*;
* *
* @author Branislav Stojkovic * @author Branislav Stojkovic
*/ */
public interface ISwitch { public interface ISwitch extends IContinuity {
Color[] POLE_COLORS = new Color[] { Color[] POLE_COLORS = new Color[] {
Color.decode("#FFD1DC"), // Pastel Pink Color.decode("#FFD1DC"), // Pastel Pink
@@ -74,4 +74,11 @@ public interface ISwitch {
default Boolean getHighlightConnectedTerminals() { default Boolean getHighlightConnectedTerminals() {
return false; return false;
} }
default boolean arePointsConnected(int index1, int index2) {
if (getSelectedPosition() == null) {
return false;
}
return arePointsConnected(index1, index2, getSelectedPosition());
}
} }
@@ -66,8 +66,7 @@ import static org.diylc.utils.SwitchUtils.getConnectedTerminals;
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SW", zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SW",
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram",
transformer = Freeway3x3_03Transformer.class, enableCache = true) transformer = Freeway3x3_03Transformer.class, enableCache = true)
public class Freeway3x3_03 extends AbstractTransparentComponent<Void> implements ISwitch, public class Freeway3x3_03 extends AbstractTransparentComponent<Void> implements ISwitch {
IContinuity {
private static final Logger LOG = Logger.getLogger(Freeway3x3_03.class); private static final Logger LOG = Logger.getLogger(Freeway3x3_03.class);
@@ -491,12 +490,4 @@ public class Freeway3x3_03 extends AbstractTransparentComponent<Void> implements
} }
return false; return false;
} }
@Override
public boolean arePointsConnected(int index1, int index2) {
if (this.selectedPosition == null) {
return false;
}
return arePointsConnected(index1, index2, this.selectedPosition);
}
} }
@@ -56,7 +56,7 @@ import static org.diylc.utils.SwitchUtils.getConnectedTerminals;
description = "Strat-style lever switch", zOrder = IDIYComponent.COMPONENT, description = "Strat-style lever switch", zOrder = IDIYComponent.COMPONENT,
instanceNamePrefix = "SW", keywordPolicy = KeywordPolicy.SHOW_TAG, instanceNamePrefix = "SW", keywordPolicy = KeywordPolicy.SHOW_TAG,
keywordTag = "Guitar Wiring Diagram", transformer = AngledComponentTransformer.class) keywordTag = "Guitar Wiring Diagram", transformer = AngledComponentTransformer.class)
public class LeverSwitch extends AbstractAngledComponent<LeverSwitch.LeverSwitchType> implements ISwitch, IContinuity { public class LeverSwitch extends AbstractAngledComponent<LeverSwitch.LeverSwitchType> implements ISwitch {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -444,14 +444,6 @@ public class LeverSwitch extends AbstractAngledComponent<LeverSwitch.LeverSwitch
return false; return false;
} }
@Override
public boolean arePointsConnected(int index1, int index2) {
if (this.selectedPosition == null) {
return false;
}
return arePointsConnected(index1, index2, this.selectedPosition);
}
@Override @Override
public boolean canPointMoveFreely(int pointIndex) { public boolean canPointMoveFreely(int pointIndex) {
return false; return false;
@@ -60,8 +60,7 @@ import static org.diylc.utils.SwitchUtils.getConnectedTerminals;
author = "Branislav Stojkovic", description = "Several variations of Schaller Megaswitch", author = "Branislav Stojkovic", description = "Several variations of Schaller Megaswitch",
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SW", zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SW",
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", transformer = AngledComponentTransformer.class) keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", transformer = AngledComponentTransformer.class)
public class SchallerMegaSwitch extends AbstractAngledComponent<String> implements ISwitch, public class SchallerMegaSwitch extends AbstractAngledComponent<String> implements ISwitch {
IContinuity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -544,14 +543,6 @@ public class SchallerMegaSwitch extends AbstractAngledComponent<String> implemen
return false; return false;
} }
@Override
public boolean arePointsConnected(int index1, int index2) {
if (this.selectedPosition == null) {
return false;
}
return arePointsConnected(index1, index2, this.selectedPosition);
}
@Override @Override
public String getControlPointNodeName(int index) { public String getControlPointNodeName(int index) {