diff --git a/src/main/java/de/neemann/digital/analyse/expression/Not.java b/src/main/java/de/neemann/digital/analyse/expression/Not.java index 57d7c197d..2d425d37d 100644 --- a/src/main/java/de/neemann/digital/analyse/expression/Not.java +++ b/src/main/java/de/neemann/digital/analyse/expression/Not.java @@ -40,15 +40,24 @@ public final class Not implements Expression { } /** - * Protects this not against simplification + * Protects this not against simplification. + * So it is possible to create a NAnd: You can create an And and protect the outer Not. + * No simplification will take place in this case and you will end up with a NAnd gate. * - * @return this for call chaning + * @return this for call chaining */ public Not protect() { protect = true; return this; } + /** + * @return true if this not is protected. + */ + public boolean isProtected() { + return protect; + } + @Override public boolean calculate(Context context) throws ExpressionException { return !expression.calculate(context); diff --git a/src/main/java/de/neemann/digital/gui/Main.java b/src/main/java/de/neemann/digital/gui/Main.java index d77abe871..3325823bc 100644 --- a/src/main/java/de/neemann/digital/gui/Main.java +++ b/src/main/java/de/neemann/digital/gui/Main.java @@ -20,7 +20,7 @@ import de.neemann.digital.draw.shapes.ShapeFactory; import de.neemann.digital.gui.components.*; import de.neemann.digital.gui.components.data.DataSetDialog; import de.neemann.digital.gui.components.listing.ROMListingDialog; -import de.neemann.digital.gui.components.table.TableFrame; +import de.neemann.digital.gui.components.table.TableDialog; import de.neemann.digital.gui.state.State; import de.neemann.digital.gui.state.StateManager; import de.neemann.digital.lang.Lang; @@ -445,7 +445,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E public void actionPerformed(ActionEvent e) { try { Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false); - new TableFrame(Main.this, new ModelAnalyser(model).analyse(), shapeFactory).setVisible(true); + new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory).setVisible(true); elementState.activate(); } catch (PinException | NodeException | AnalyseException e1) { showErrorAndStopModel(Lang.get("msg_annalyseErr"), e1); @@ -459,7 +459,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E @Override public void actionPerformed(ActionEvent e) { TruthTable tt = new TruthTable(3).addResult(); - new TableFrame(Main.this, tt, shapeFactory).setVisible(true); + new TableDialog(Main.this, tt, shapeFactory).setVisible(true); elementState.activate(); } } diff --git a/src/main/java/de/neemann/digital/gui/components/table/AllSolutionsFrame.java b/src/main/java/de/neemann/digital/gui/components/table/AllSolutionsDialog.java similarity index 85% rename from src/main/java/de/neemann/digital/gui/components/table/AllSolutionsFrame.java rename to src/main/java/de/neemann/digital/gui/components/table/AllSolutionsDialog.java index 36ac57819..5b930301a 100644 --- a/src/main/java/de/neemann/digital/gui/components/table/AllSolutionsFrame.java +++ b/src/main/java/de/neemann/digital/gui/components/table/AllSolutionsDialog.java @@ -10,7 +10,7 @@ import java.awt.*; * * @author hneemann */ -public class AllSolutionsFrame extends JDialog { +public class AllSolutionsDialog extends JDialog { private final JTextArea textArea; /** @@ -19,7 +19,7 @@ public class AllSolutionsFrame extends JDialog { * @param owner the owner frame * @param font the font to use */ - public AllSolutionsFrame(Frame owner, Font font) { + public AllSolutionsDialog(JFrame owner, Font font) { super(owner, Lang.get("win_allSolutions"), false); setDefaultCloseOperation(HIDE_ON_CLOSE); @@ -39,7 +39,7 @@ public class AllSolutionsFrame extends JDialog { * @param text the text * @return this for call chaining */ - public AllSolutionsFrame setText(String text) { + public AllSolutionsDialog setText(String text) { textArea.setText(text); return this; } diff --git a/src/main/java/de/neemann/digital/gui/components/table/TableFrame.java b/src/main/java/de/neemann/digital/gui/components/table/TableDialog.java similarity index 96% rename from src/main/java/de/neemann/digital/gui/components/table/TableFrame.java rename to src/main/java/de/neemann/digital/gui/components/table/TableDialog.java index 595d751fd..16a944d4a 100644 --- a/src/main/java/de/neemann/digital/gui/components/table/TableFrame.java +++ b/src/main/java/de/neemann/digital/gui/components/table/TableDialog.java @@ -36,7 +36,7 @@ import java.util.HashSet; /** * @author hneemann */ -public class TableFrame extends JFrame { +public class TableDialog extends JDialog { private static final Color MYGRAY = new Color(230, 230, 230); private final JLabel label; private final JTable table; @@ -49,7 +49,7 @@ public class TableFrame extends JFrame { private TruthTableTableModel model; private TableColumn column; private int columnIndex; - private AllSolutionsFrame allSolutionsFrame; + private AllSolutionsDialog allSolutionsDialog; private int variables; /** @@ -58,8 +58,8 @@ public class TableFrame extends JFrame { * @param parent the parent frame * @param truthTable the table to show */ - public TableFrame(JFrame parent, TruthTable truthTable, ShapeFactory shapeFactory) { - super(Lang.get("win_table")); + public TableDialog(JFrame parent, TruthTable truthTable, ShapeFactory shapeFactory) { + super(parent, Lang.get("win_table")); this.shapeFactory = shapeFactory; setDefaultCloseOperation(DISPOSE_ON_CLOSE); @@ -73,7 +73,7 @@ public class TableFrame extends JFrame { table.setDefaultRenderer(Integer.class, new CenterDefaultTableCellRenderer()); table.setRowHeight(25); - allSolutionsFrame = new AllSolutionsFrame(this, font); + allSolutionsDialog = new AllSolutionsDialog(parent, font); header = table.getTableHeader(); header.addMouseListener(new MouseAdapter() { @@ -263,14 +263,14 @@ public class TableFrame extends JFrame { sb.append(expr); count++; if (count == 2) - allSolutionsFrame.setVisible(true); + allSolutionsDialog.setVisible(true); } }.create(); if (sb.length() == 0) label.setText(""); - allSolutionsFrame.setText(sb.toString()); + allSolutionsDialog.setText(sb.toString()); } catch (ExpressionException | FormatterException e1) { new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e1).show(); }