diff --git a/src/main/java/de/neemann/digital/draw/elements/Circuit.java b/src/main/java/de/neemann/digital/draw/elements/Circuit.java index 56d69a10f..861093e01 100644 --- a/src/main/java/de/neemann/digital/draw/elements/Circuit.java +++ b/src/main/java/de/neemann/digital/draw/elements/Circuit.java @@ -261,8 +261,8 @@ public class Circuit { * @param max lower right corner of the rectangle * @return the list */ - public ArrayList getElementsToMove(Vector min, Vector max) { - ArrayList m = new ArrayList<>(); + public ArrayList getElementsToMove(Vector min, Vector max) { + ArrayList m = new ArrayList<>(); for (VisualElement vp : visualElements) if (vp.matches(min, max)) m.add(vp); @@ -312,8 +312,8 @@ public class Circuit { * @param shapeFactory the shape factory * @return the list */ - public ArrayList getElementsToCopy(Vector min, Vector max, ShapeFactory shapeFactory) { - ArrayList m = new ArrayList<>(); + public ArrayList getElementsToCopy(Vector min, Vector max, ShapeFactory shapeFactory) { + ArrayList m = new ArrayList<>(); for (VisualElement vp : visualElements) if (vp.matches(min, max)) m.add(new VisualElement(vp).setShapeFactory(shapeFactory)); diff --git a/src/main/java/de/neemann/digital/draw/elements/Moveable.java b/src/main/java/de/neemann/digital/draw/elements/Movable.java similarity index 92% rename from src/main/java/de/neemann/digital/draw/elements/Moveable.java rename to src/main/java/de/neemann/digital/draw/elements/Movable.java index 7ef723d80..7596e6d74 100644 --- a/src/main/java/de/neemann/digital/draw/elements/Moveable.java +++ b/src/main/java/de/neemann/digital/draw/elements/Movable.java @@ -7,7 +7,7 @@ import de.neemann.digital.draw.graphics.Vector; * * @author hneemann */ -public interface Moveable { +public interface Movable { /** * Moves the instance by the given delta diff --git a/src/main/java/de/neemann/digital/draw/elements/VisualElement.java b/src/main/java/de/neemann/digital/draw/elements/VisualElement.java index 4b37bd1db..82fecd97c 100644 --- a/src/main/java/de/neemann/digital/draw/elements/VisualElement.java +++ b/src/main/java/de/neemann/digital/draw/elements/VisualElement.java @@ -20,7 +20,7 @@ import static de.neemann.digital.draw.shapes.GenericShape.SIZE; * * @author hneemann */ -public class VisualElement implements Drawable, Moveable, AttributeListener { +public class VisualElement implements Drawable, Movable, AttributeListener { private static final int PIN = 2; private transient GraphicMinMax minMax; diff --git a/src/main/java/de/neemann/digital/draw/elements/Wire.java b/src/main/java/de/neemann/digital/draw/elements/Wire.java index 758d61e9b..ec597805a 100644 --- a/src/main/java/de/neemann/digital/draw/elements/Wire.java +++ b/src/main/java/de/neemann/digital/draw/elements/Wire.java @@ -13,7 +13,7 @@ import java.util.Collection; * * @author hneemann */ -public class Wire implements Drawable, Moveable { +public class Wire implements Drawable, Movable { private static final int MIN_LABEL_LEN = 80; //Every value of p1 or p2 is valid. There are no hidden state constrains or dependencies. //So both fields are allowed to by public to allow more readable code. @@ -229,8 +229,8 @@ public class Wire implements Drawable, Moveable { /** * @return a movable representing point one */ - public Moveable getMovableP1() { - return new Moveable() { + public Movable getMovableP1() { + return new Movable() { @Override public void move(Vector delta) { p1 = p1.add(delta); @@ -246,8 +246,8 @@ public class Wire implements Drawable, Moveable { /** * @return a movable representing point two */ - public Moveable getMovableP2() { - return new Moveable() { + public Movable getMovableP2() { + return new Movable() { @Override public void move(Vector delta) { p2 = p2.add(delta); diff --git a/src/main/java/de/neemann/digital/gui/Main.java b/src/main/java/de/neemann/digital/gui/Main.java index 05512730e..8fd1beb13 100644 --- a/src/main/java/de/neemann/digital/gui/Main.java +++ b/src/main/java/de/neemann/digital/gui/Main.java @@ -97,8 +97,8 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS private static final Icon ICON_SAVE_AS = IconCreator.create("document-save-as.png"); private static final Icon ICON_FAST = IconCreator.create("media-skip-forward.png"); private static final Icon ICON_EXPAND = IconCreator.create("View-zoom-fit.png"); - private static final Icon ICON_ZOOMIN = IconCreator.create("View-zoom-in.png"); - private static final Icon ICON_ZOOMOUT = IconCreator.create("View-zoom-out.png"); + private static final Icon ICON_ZOOM_IN = IconCreator.create("View-zoom-in.png"); + private static final Icon ICON_ZOOM_OUT = IconCreator.create("View-zoom-out.png"); private static final Icon ICON_HELP = IconCreator.create("help.png"); private final CircuitComponent circuitComponent; private final ToolTipAction save; @@ -107,7 +107,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS private final JLabel statusLabel; private final StateManager stateManager = new StateManager(); private final ElementAttributes settings = new ElementAttributes(); - private final ScheduledThreadPoolExecutor timerExecuter = new ScheduledThreadPoolExecutor(1); + private final ScheduledThreadPoolExecutor timerExecutor = new ScheduledThreadPoolExecutor(1); private final WindowPosManager windowPosManager = new WindowPosManager(); private final InsertHistory insertHistory; @@ -122,7 +122,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS private Model model; private ModelCreator modelCreator; - private boolean realtimeClockRunning; + private boolean realTimeClockRunning; private State stoppedState; private RunModelState runModelState; @@ -204,7 +204,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS @Override public void windowClosed(WindowEvent e) { clearModelDescription(); // stop model timer if running - timerExecuter.shutdown(); + timerExecutor.shutdown(); library.removeListener(librarySelector); library.removeListener(insertHistory); library.removeListener(circuitComponent); @@ -240,13 +240,13 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS circuitComponent.fitCircuit(); } }; - ToolTipAction zoomIn = new ToolTipAction(Lang.get("menu_zoomIn"), ICON_ZOOMIN) { + ToolTipAction zoomIn = new ToolTipAction(Lang.get("menu_zoomIn"), ICON_ZOOM_IN) { @Override public void actionPerformed(ActionEvent e) { circuitComponent.scaleCircuit(1.25); } }; - ToolTipAction zoomOut = new ToolTipAction(Lang.get("menu_zoomOut"), ICON_ZOOMOUT) { + ToolTipAction zoomOut = new ToolTipAction(Lang.get("menu_zoomOut"), ICON_ZOOM_OUT) { @Override public void actionPerformed(ActionEvent e) { circuitComponent.scaleCircuit(0.8); @@ -379,7 +379,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS fileHistory.setMenu(openRecent); openRecent.setEnabled(allowAll); - ToolTipAction saveas = new ToolTipAction(Lang.get("menu_saveAs"), ICON_SAVE_AS) { + ToolTipAction saveAs = new ToolTipAction(Lang.get("menu_saveAs"), ICON_SAVE_AS) { @Override public void actionPerformed(ActionEvent e) { JFileChooser fc = getJFileChooser(lastFilename); @@ -415,7 +415,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS @Override public void actionPerformed(ActionEvent e) { if (filename == null) - saveas.actionPerformed(e); + saveAs.actionPerformed(e); else saveFile(filename, false); } @@ -435,7 +435,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS file.add(open.createJMenuItem()); file.add(openWin.createJMenuItem()); file.add(save.createJMenuItem()); - file.add(saveas.createJMenuItem()); + file.add(saveAs.createJMenuItem()); file.add(export); toolBar.add(newFile.createJButtonNoText()); @@ -528,9 +528,9 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS try { Object data = clpbrd.getData(DataFlavor.stringFlavor); if (data instanceof String) { - ArrayList elements = CircuitTransferable.createList(data, shapeFactory, new Vector(0, 0)); + ArrayList elements = CircuitTransferable.createList(data, shapeFactory, new Vector(0, 0)); Circuit circuit = new Circuit(); - for (Moveable m : elements) { + for (Movable m : elements) { if (m instanceof Wire) circuit.add((Wire) m); if (m instanceof VisualElement) @@ -688,7 +688,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS if (tsl.isEmpty()) throw new TestingDataException(Lang.get("err_noTestData")); - windowPosManager.register("testresult", new TestResultDialog(Main.this, tsl, circuitComponent.getCircuit(), library)).setVisible(true); + windowPosManager.register("testResult", new TestResultDialog(Main.this, tsl, circuitComponent.getCircuit(), library)).setVisible(true); stoppedState.enter(); } catch (NodeException | ElementNotFoundException | PinException | TestingDataException | RuntimeException e1) { @@ -713,7 +713,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS .setVisible(true); stoppedState.enter(); } catch (PinException | NodeException | AnalyseException | ElementNotFoundException | RuntimeException e1) { - showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1); + showErrorAndStopModel(Lang.get("msg_analyseErr"), e1); } } } @@ -808,22 +808,22 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS statusLabel.setText(Lang.get("msg_N_nodes", model.size())); - realtimeClockRunning = false; + realTimeClockRunning = false; modelSync = null; if (globalRunClock) for (Clock c : model.getClocks()) if (c.getFrequency() > 0) { if (modelSync == null) modelSync = new LockSync(); - model.addObserver(new RealTimeClock(model, c, timerExecuter, this, modelSync, this)); - realtimeClockRunning = true; + model.addObserver(new RealTimeClock(model, c, timerExecutor, this, modelSync, this)); + realTimeClockRunning = true; } if (modelSync == null) modelSync = NoSync.INST; circuitComponent.setModeAndReset(true, modelSync); - if (realtimeClockRunning) { + if (realTimeClockRunning) { // if clock is running, enable automatic update of gui GuiModelObserver gmo = new GuiModelObserver(circuitComponent, updateEvent); modelCreator.connectToGui(gmo); @@ -833,16 +833,16 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS modelCreator.connectToGui(null); doStep.setEnabled(false); - runToBreakAction.setEnabled(!realtimeClockRunning && model.isFastRunModel()); + runToBreakAction.setEnabled(!realTimeClockRunning && model.isFastRunModel()); List ordering = circuitComponent.getCircuit().getMeasurementOrdering(); if (settings.get(Keys.SHOW_DATA_TABLE)) windowPosManager.register("probe", new ProbeDialog(this, model, updateEvent, ordering, modelSync)).setVisible(true); if (settings.get(Keys.SHOW_DATA_GRAPH)) - windowPosManager.register("dataset", new DataSetDialog(this, model, updateEvent == ModelEvent.MICROSTEP, ordering, modelSync)).setVisible(true); + windowPosManager.register("dataSet", new DataSetDialog(this, model, updateEvent == ModelEvent.MICROSTEP, ordering, modelSync)).setVisible(true); if (settings.get(Keys.SHOW_DATA_GRAPH_MICRO)) - windowPosManager.register("datasetMicro", new DataSetDialog(this, model, true, ordering, modelSync)).setVisible(true); + windowPosManager.register("dataSetMicro", new DataSetDialog(this, model, true, ordering, modelSync)).setVisible(true); if (modelModifier != null) modelModifier.preInit(model); @@ -918,8 +918,8 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS try { setFilename(filename, setLibraryRoot); if (setLibraryRoot) library.setRootFilePath(filename.getParentFile()); - Circuit circ = Circuit.loadCircuit(filename, shapeFactory); - circuitComponent.setCircuit(circ); + Circuit circuit = Circuit.loadCircuit(filename, shapeFactory); + circuitComponent.setCircuit(circuit); stoppedState.enter(); windowPosManager.closeAll(); statusLabel.setText(" "); @@ -1058,21 +1058,21 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS //*********************** private static class AddressPicker { - private long addr; + private long address; - private void getProgRomAddr(Model model) { + private void getProgramROMAddress(Model model) { List roms = model.findNode(ROM.class, ROM::isProgramMemory); if (roms.size() == 1) - addr = roms.get(0).getRomAddress(); + address = roms.get(0).getRomAddress(); else - addr = -1; + address = -1; } - String getAddrString() { - if (addr < 0) + String getAddressString() { + if (address < 0) return null; else - return Long.toHexString(addr); + return Long.toHexString(address); } } @@ -1101,7 +1101,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS @Override public String doSingleStep() throws RemoteException { - if (model != null && !realtimeClockRunning) { + if (model != null && !realTimeClockRunning) { try { AddressPicker addressPicker = new AddressPicker(); SwingUtilities.invokeAndWait(() -> { @@ -1116,13 +1116,13 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS model.doStep(); } circuitComponent.hasChanged(); - addressPicker.getProgRomAddr(model); + addressPicker.getProgramROMAddress(model); } catch (NodeException | RuntimeException e) { showErrorAndStopModel(Lang.get("err_remoteExecution"), e); } } }); - return addressPicker.getAddrString(); + return addressPicker.getAddressString(); } catch (InterruptedException | InvocationTargetException e) { throw new RemoteException("error performing a single step " + e.getMessage()); } @@ -1135,11 +1135,11 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS try { AddressPicker addressPicker = new AddressPicker(); SwingUtilities.invokeAndWait(() -> { - if (model != null && model.isFastRunModel() && !realtimeClockRunning) + if (model != null && model.isFastRunModel() && !realTimeClockRunning) runToBreakAction.actionPerformed(null); - addressPicker.getProgRomAddr(model); + addressPicker.getProgramROMAddress(model); }); - return addressPicker.getAddrString(); + return addressPicker.getAddressString(); } catch (InterruptedException | InvocationTargetException e) { throw new RemoteException("error performing a run to break " + e.getMessage()); } diff --git a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java index e2ec51705..3c5ea297f 100644 --- a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java +++ b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java @@ -114,7 +114,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe public void actionPerformed(ActionEvent e) { if (activeMouseController instanceof MouseControllerSelect) { MouseControllerSelect mcs = ((MouseControllerSelect) activeMouseController); - ArrayList elements = circuit.getElementsToCopy(Vector.min(mcs.corner1, mcs.corner2), Vector.max(mcs.corner1, mcs.corner2), shapeFactory); + ArrayList elements = circuit.getElementsToCopy(Vector.min(mcs.corner1, mcs.corner2), Vector.max(mcs.corner1, mcs.corner2), shapeFactory); Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpbrd.setContents(new CircuitTransferable(elements), null); removeHighLighted(); @@ -132,7 +132,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe Object data = clpbrd.getData(DataFlavor.stringFlavor); if (data instanceof String) { Vector posVector = getPosVector(lastMousePos.x, lastMousePos.y); - ArrayList elements = CircuitTransferable.createList(data, shapeFactory, posVector); + ArrayList elements = CircuitTransferable.createList(data, shapeFactory, posVector); if (elements != null) { removeHighLighted(); mouseInsertList.activate(elements, posVector); @@ -1126,7 +1126,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe } } - private void rotateElements(ArrayList elements, Vector pos) { + private void rotateElements(ArrayList elements, Vector pos) { Vector p1 = raster(pos); Transform transform = new TransformRotate(p1, 1) { @@ -1136,7 +1136,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe } }; - for (Moveable m : elements) { + for (Movable m : elements) { if (m instanceof VisualElement) { VisualElement ve = (VisualElement) m; @@ -1160,7 +1160,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe private final class MouseControllerMoveSelected extends MouseController { - private ArrayList elements; + private ArrayList elements; private Vector lastPos; private Vector center; private boolean wasMoved; @@ -1190,7 +1190,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe Vector delta = raster(pos.sub(lastPos)); if (delta.x != 0 || delta.y != 0) { - for (Moveable m : elements) + for (Movable m : elements) m.move(delta); wasMoved = true; @@ -1217,14 +1217,14 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe } private final class MouseControllerInsertCopied extends MouseController { - private ArrayList elements; + private ArrayList elements; private Vector lastPos; private MouseControllerInsertCopied(Cursor cursor) { super(cursor); } - private void activate(ArrayList elements, Vector pos) { + private void activate(ArrayList elements, Vector pos) { super.activate(); this.elements = elements; lastPos = pos; @@ -1239,7 +1239,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe Vector delta = raster(pos.sub(lastPos)); if (delta.x != 0 || delta.y != 0) { - for (Moveable m : elements) + for (Movable m : elements) m.move(delta); repaint(); @@ -1251,7 +1251,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe @Override public void drawTo(Graphic gr) { if (elements != null) - for (Moveable m : elements) + for (Movable m : elements) if (m instanceof Drawable) ((Drawable) m).drawTo(gr, true); } @@ -1264,7 +1264,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe @Override void clicked(MouseEvent e) { if (elements != null && e.getButton() == 1) { - for (Moveable m : elements) { + for (Movable m : elements) { if (m instanceof Wire) circuit.add((Wire) m); if (m instanceof VisualElement) diff --git a/src/main/java/de/neemann/digital/gui/components/CircuitTransferable.java b/src/main/java/de/neemann/digital/gui/components/CircuitTransferable.java index 1042b8b96..4dc1a27c6 100644 --- a/src/main/java/de/neemann/digital/gui/components/CircuitTransferable.java +++ b/src/main/java/de/neemann/digital/gui/components/CircuitTransferable.java @@ -3,7 +3,7 @@ package de.neemann.digital.gui.components; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.PrettyPrintWriter; import de.neemann.digital.draw.elements.Circuit; -import de.neemann.digital.draw.elements.Moveable; +import de.neemann.digital.draw.elements.Movable; import de.neemann.digital.draw.elements.VisualElement; import de.neemann.digital.draw.graphics.GraphicMinMax; import de.neemann.digital.draw.graphics.Vector; @@ -30,7 +30,7 @@ public class CircuitTransferable implements Transferable { * * @param data the data to copy */ - CircuitTransferable(ArrayList data) { + CircuitTransferable(ArrayList data) { XStream xStream = Circuit.getxStream(); try (StringWriter out = new StringWriter()) { out.write("\n"); @@ -69,18 +69,18 @@ public class CircuitTransferable implements Transferable { * @return the elements or null * @throws IOException IOException */ - public static ArrayList createList(Object data, ShapeFactory shapeFactory, Vector lastMousePos) throws IOException { + public static ArrayList createList(Object data, ShapeFactory shapeFactory, Vector lastMousePos) throws IOException { if (!(data instanceof String)) return null; XStream xStream = Circuit.getxStream(); Vector max = null; try (Reader in = new StringReader(data.toString())) { - ArrayList elements = (ArrayList) xStream.fromXML(in); + ArrayList elements = (ArrayList) xStream.fromXML(in); if (elements == null) return null; - for (Moveable m : elements) + for (Movable m : elements) if (m instanceof VisualElement) { ((VisualElement) m).setShapeFactory(shapeFactory); GraphicMinMax mm = ((VisualElement) m).getMinMax(false); @@ -92,7 +92,7 @@ public class CircuitTransferable implements Transferable { if (max != null) { Vector delta = CircuitComponent.raster(lastMousePos.sub(max)); - for (Moveable m : elements) + for (Movable m : elements) m.move(delta); } diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index ace034573..9d2a714ed 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -744,7 +744,7 @@ Geschrieben von Helmut Neemann 2016 Die Icons stammen aus dem Tango Desktop Project. {0} aktive Elemente - Fehler bei der Analyse der Schaltung + Fehler bei der Analyse der Schaltung Fehler bei der Berechnung einer Taktänderung Farbe Fehler beim Berechnen eines Schrittes diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index 15c3d9ca7..4f0f192bf 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -734,7 +734,7 @@ Written bei H.Neemann in 2016. The icons are taken from the Tango Desktop Project. {0} nodes - Error analysing the circuit + Error analysing the circuit Error during a clock state change Color Error calculating a step diff --git a/src/test/resources/dig/test/arith/subTest.dig b/src/test/resources/dig/test/arith/subTest.dig index ca96b7661..7c8af0494 100644 --- a/src/test/resources/dig/test/arith/subTest.dig +++ b/src/test/resources/dig/test/arith/subTest.dig @@ -73,7 +73,7 @@ 5 - + Out @@ -83,12 +83,12 @@ Y - + FullSubRC.dig - + Splitter @@ -130,7 +130,7 @@ 5 - + Testcase @@ -144,37 +144,37 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - + - - + + - + - - + + - + - + - - + + @@ -190,11 +190,11 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - + - - + + @@ -202,7 +202,7 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - + @@ -210,11 +210,11 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - + - - + + @@ -226,35 +226,35 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - + - - + + - + - - + + - - + + - + - + @@ -268,14 +268,14 @@ repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1 - - - - + + + +