removed obsole Part.duplicate
This commit is contained in:
parent
be46107eb5
commit
0616e68f5e
@ -140,14 +140,19 @@ public abstract class Part {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Point translate(final Point p) {
|
||||||
|
return new Point(
|
||||||
|
p.x + position.x * RASTER,
|
||||||
|
p.y + position.y * RASTER
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void click();
|
public abstract void click();
|
||||||
|
|
||||||
public abstract void propagate(final Junction source) throws ShortCircuit;
|
public abstract void propagate(final Junction source) throws ShortCircuit;
|
||||||
|
|
||||||
protected abstract void _render(final Graphics2D g);
|
protected abstract void _render(final Graphics2D g);
|
||||||
|
|
||||||
public abstract Part duplicate(final Point position);
|
|
||||||
|
|
||||||
public static Part of(final PartDto abstractDto) {
|
public static Part of(final PartDto abstractDto) {
|
||||||
return switch (abstractDto) {
|
return switch (abstractDto) {
|
||||||
case final PartBatteryDto dto -> new PartBattery(dto);
|
case final PartBatteryDto dto -> new PartBattery(dto);
|
||||||
@ -159,11 +164,4 @@ public abstract class Part {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point translate(final Point p) {
|
|
||||||
return new Point(
|
|
||||||
p.x + position.x * RASTER,
|
|
||||||
p.y + position.y * RASTER
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,11 +82,6 @@ public class PartBattery extends Part {
|
|||||||
rect(g, HALF + GAP / 2, HALF - PLUS_H / 2, PLUS_W, PLUS_H, null, null, Color.BLACK);
|
rect(g, HALF + GAP / 2, HALF - PLUS_H / 2, PLUS_W, PLUS_H, null, null, Color.BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PartBattery duplicate(final Point newPosition) {
|
|
||||||
return new PartBattery(getName(), newPosition, getOrientation(), voltage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void click() {
|
public void click() {
|
||||||
// nothing
|
// nothing
|
||||||
|
|||||||
@ -90,11 +90,6 @@ public class PartLight extends PartOther {
|
|||||||
line(g, diag, RASTER - diag, RASTER - diag, diag, Color.BLACK, SYMBOL_STROKE);
|
line(g, diag, RASTER - diag, RASTER - diag, diag, Color.BLACK, SYMBOL_STROKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PartLight duplicate(final Point newPosition) {
|
|
||||||
return new PartLight(getName(), newPosition, getOrientation(), maxVoltage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void click() {
|
public void click() {
|
||||||
defect = false;
|
defect = false;
|
||||||
|
|||||||
@ -69,9 +69,4 @@ public class PartSwitch1x1 extends PartOther {
|
|||||||
state = !state;
|
state = !state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PartSwitch1x1 duplicate(final Point newPosition) {
|
|
||||||
return new PartSwitch1x1(getName(), newPosition, getOrientation(), state);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,9 +79,4 @@ public class PartSwitch1x2 extends PartOther {
|
|||||||
state = !state;
|
state = !state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PartSwitch1x2 duplicate(final Point newPosition) {
|
|
||||||
return new PartSwitch1x2(getName(), newPosition, getOrientation(), state);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,9 +95,4 @@ public class PartSwitchCross extends PartOther {
|
|||||||
state = !state;
|
state = !state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PartSwitchCross duplicate(final Point newPosition) {
|
|
||||||
return new PartSwitchCross(getName(), newPosition, getOrientation(), state);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user