Extend removal mechanism for all wires.

This commit is contained in:
Sergio Martínez Portela 2020-06-01 16:49:38 +02:00
parent 8b3bbfee78
commit af9352de42
5 changed files with 28 additions and 11 deletions

View File

@ -368,9 +368,7 @@ public class CanvasView extends View implements PartGrid {
List<OutputConnector> outputConnectors = part.getOutputConnectors();
if (outputConnectors != null) {
for (OutputConnector outputConnector : outputConnectors) {
if (outputConnector instanceof SignalRoundOutputConnector) {
SignalRoundOutputConnector conn = (SignalRoundOutputConnector) outputConnector;
List<SignalWire> wires = conn.getWires();
List<SignalWire> wires = outputConnector.getWires();
if (wires == null) {
continue;
}
@ -383,7 +381,6 @@ public class CanvasView extends View implements PartGrid {
}
}
}
}
return null;
}

View File

@ -97,6 +97,7 @@ public class AnyRoundOutputConnector implements Drawable, AnyOutputConnector,
@Override
public void unlinkWire(AnyWire wire) {
_wires.remove(wire);
_connections.remove(wire.getAttachedTo());
}
@Override
@ -162,6 +163,11 @@ public class AnyRoundOutputConnector implements Drawable, AnyOutputConnector,
return _part.query(lastValue);
}
@Override
public List<AnyWire> getWires() {
return _wires;
}
public int getX() {
return _centerX;
}

View File

@ -96,6 +96,7 @@ public class BooleanRoundOutputConnector implements Drawable, BooleanOutputConne
@Override
public void unlinkWire(BooleanWire wire) {
_wires.remove(wire);
_connections.remove(wire.getAttachedTo());
}
@Override
@ -160,4 +161,9 @@ public class BooleanRoundOutputConnector implements Drawable, BooleanOutputConne
public Object query(Object lastValue) {
return _part.query(lastValue);
}
@Override
public List<BooleanWire> getWires() {
return _wires;
}
}

View File

@ -96,6 +96,7 @@ public class StringRoundOutputConnector implements Drawable, StringOutputConnect
@Override
public void unlinkWire(StringWire wire) {
_wires.remove(wire);
_connections.remove(wire.getAttachedTo());
}
@Override
@ -160,4 +161,9 @@ public class StringRoundOutputConnector implements Drawable, StringOutputConnect
public Object query(Object lastValue) {
return _part.query(lastValue);
}
@Override
public List<StringWire> getWires() {
return _wires;
}
}

View File

@ -25,4 +25,6 @@ public interface OutputConnector<T extends WireDataType,
void send(T data);
Object query(Object lastValue);
List<T2> getWires();
}