mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 08:55:05 -04:00
renamed the ModelDescription to ModelCreator
This commit is contained in:
parent
51eaa84232
commit
fe8efe1bcc
@ -6,7 +6,7 @@ import de.neemann.digital.core.ObservableValues;
|
|||||||
import de.neemann.digital.core.element.Element;
|
import de.neemann.digital.core.element.Element;
|
||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.elements.PinException;
|
import de.neemann.digital.draw.elements.PinException;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.NetList;
|
import de.neemann.digital.draw.model.NetList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,19 +37,19 @@ public class CustomElement implements Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a {@link ModelDescription} of this circuit.
|
* Gets a {@link ModelCreator} of this circuit.
|
||||||
* Every time this method is called a new {@link ModelDescription} is created.
|
* Every time this method is called a new {@link ModelCreator} is created.
|
||||||
*
|
*
|
||||||
* @param subName name of the circuit, used to name unique elements
|
* @param subName name of the circuit, used to name unique elements
|
||||||
* @return the {@link ModelDescription}
|
* @return the {@link ModelCreator}
|
||||||
* @throws PinException PinException
|
* @throws PinException PinException
|
||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public ModelDescription getModelDescription(String subName) throws PinException, NodeException {
|
public ModelCreator getModelDescription(String subName) throws PinException, NodeException {
|
||||||
if (netList == null)
|
if (netList == null)
|
||||||
netList = new NetList(circuit);
|
netList = new NetList(circuit);
|
||||||
|
|
||||||
return new ModelDescription(circuit, library, true, name, new NetList(netList), subName);
|
return new ModelCreator(circuit, library, true, name, new NetList(netList), subName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public class ModelDescription implements Iterable<ModelEntry> {
|
public class ModelCreator implements Iterable<ModelEntry> {
|
||||||
|
|
||||||
private final Circuit circuit;
|
private final Circuit circuit;
|
||||||
private final NetList netList;
|
private final NetList netList;
|
||||||
@ -42,7 +42,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
* @throws PinException PinException
|
* @throws PinException PinException
|
||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public ModelDescription(Circuit circuit, ElementLibrary library) throws PinException, NodeException {
|
public ModelCreator(Circuit circuit, ElementLibrary library) throws PinException, NodeException {
|
||||||
this(circuit, library, false);
|
this(circuit, library, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
* @throws PinException PinException
|
* @throws PinException PinException
|
||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public ModelDescription(Circuit circuit, ElementLibrary library, boolean readAsCustom) throws PinException, NodeException {
|
public ModelCreator(Circuit circuit, ElementLibrary library, boolean readAsCustom) throws PinException, NodeException {
|
||||||
this(circuit, library, readAsCustom, "unknown", new NetList(circuit), "");
|
this(circuit, library, readAsCustom, "unknown", new NetList(circuit), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
* @throws PinException PinException
|
* @throws PinException PinException
|
||||||
* @throws NodeException NodeException
|
* @throws NodeException NodeException
|
||||||
*/
|
*/
|
||||||
public ModelDescription(Circuit circuit, ElementLibrary library, boolean isNestedCircuit, String fileName, NetList netList, String subName) throws PinException, NodeException {
|
public ModelCreator(Circuit circuit, ElementLibrary library, boolean isNestedCircuit, String fileName, NetList netList, String subName) throws PinException, NodeException {
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
this.netList = netList;
|
this.netList = netList;
|
||||||
entries = new ArrayList<>();
|
entries = new ArrayList<>();
|
||||||
@ -119,13 +119,13 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// connect all custom elements to the parents net
|
// connect all custom elements to the parents net
|
||||||
ArrayList<ModelDescription> cmdl = new ArrayList<>();
|
ArrayList<ModelCreator> cmdl = new ArrayList<>();
|
||||||
Iterator<ModelEntry> it = entries.iterator();
|
Iterator<ModelEntry> it = entries.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
ModelEntry me = it.next();
|
ModelEntry me = it.next();
|
||||||
if (me.getElement() instanceof CustomElement) { // at first look for custom elements
|
if (me.getElement() instanceof CustomElement) { // at first look for custom elements
|
||||||
CustomElement ce = (CustomElement) me.getElement();
|
CustomElement ce = (CustomElement) me.getElement();
|
||||||
ModelDescription child = ce.getModelDescription(combineNames(subName, me.getVisualElement().getElementAttributes().getCleanLabel()));
|
ModelCreator child = ce.getModelDescription(combineNames(subName, me.getVisualElement().getElementAttributes().getCleanLabel()));
|
||||||
cmdl.add(child);
|
cmdl.add(child);
|
||||||
|
|
||||||
for (Pin p : me.getPins()) { // connect the custom elements to the parents net
|
for (Pin p : me.getPins()) { // connect the custom elements to the parents net
|
||||||
@ -143,7 +143,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ModelDescription md : cmdl) { // put the elements of the custom element to the parent
|
for (ModelCreator md : cmdl) { // put the elements of the custom element to the parent
|
||||||
entries.addAll(md.entries);
|
entries.addAll(md.entries);
|
||||||
netList.add(md.netList);
|
netList.add(md.netList);
|
||||||
}
|
}
|
||||||
@ -207,10 +207,11 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be called after create model is called!
|
* Needs to be called after createModel is called!
|
||||||
* Connects the gui to the model
|
* Connects the gui to the model
|
||||||
*
|
*
|
||||||
* @param guiObserver
|
* @param guiObserver the observer which can be attached to {@link de.neemann.digital.core.ObservableValue}s
|
||||||
|
* which have a state dependant graphical representation.
|
||||||
*/
|
*/
|
||||||
public void connectToGui(Observer guiObserver) {
|
public void connectToGui(Observer guiObserver) {
|
||||||
for (ModelEntry e : entries)
|
for (ModelEntry e : entries)
|
||||||
@ -242,7 +243,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all ModelEntries which contain a element of the given name
|
* Returns a list of all ModelEntries which contain an element of the given name
|
||||||
*
|
*
|
||||||
* @param elementName the name of the element
|
* @param elementName the name of the element
|
||||||
* @return the list
|
* @return the list
|
||||||
@ -256,7 +257,7 @@ public class ModelDescription implements Iterable<ModelEntry> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the circuit whih was used to create this model description
|
* @return the circuit which was used to create this model description
|
||||||
*/
|
*/
|
||||||
public Circuit getCircuit() {
|
public Circuit getCircuit() {
|
||||||
return circuit;
|
return circuit;
|
@ -10,7 +10,7 @@ import de.neemann.digital.core.element.PinDescriptions;
|
|||||||
import de.neemann.digital.draw.elements.IOState;
|
import de.neemann.digital.draw.elements.IOState;
|
||||||
import de.neemann.digital.draw.elements.Pins;
|
import de.neemann.digital.draw.elements.Pins;
|
||||||
import de.neemann.digital.draw.graphics.Graphic;
|
import de.neemann.digital.draw.graphics.Graphic;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.ModelEntry;
|
import de.neemann.digital.draw.model.ModelEntry;
|
||||||
import de.neemann.digital.gui.components.CircuitComponent;
|
import de.neemann.digital.gui.components.CircuitComponent;
|
||||||
import de.neemann.digital.gui.components.OrderMerger;
|
import de.neemann.digital.gui.components.OrderMerger;
|
||||||
@ -68,9 +68,9 @@ public class DataShape implements Shape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerModel(ModelDescription modelDescription, Model model, ModelEntry element) {
|
public void registerModel(ModelCreator modelCreator, Model model, ModelEntry element) {
|
||||||
ArrayList<Signal> signals = model.getSignalsCopy();
|
ArrayList<Signal> signals = model.getSignalsCopy();
|
||||||
new OrderMerger<String, Signal>(modelDescription.getCircuit().getMeasurementOrdering()) {
|
new OrderMerger<String, Signal>(modelCreator.getCircuit().getMeasurementOrdering()) {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Signal a, String b) {
|
public boolean equals(Signal a, String b) {
|
||||||
return a.getName().equals(b);
|
return a.getName().equals(b);
|
||||||
|
@ -4,7 +4,7 @@ import de.neemann.digital.core.Model;
|
|||||||
import de.neemann.digital.core.Observer;
|
import de.neemann.digital.core.Observer;
|
||||||
import de.neemann.digital.draw.elements.IOState;
|
import de.neemann.digital.draw.elements.IOState;
|
||||||
import de.neemann.digital.draw.elements.Pins;
|
import de.neemann.digital.draw.elements.Pins;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.ModelEntry;
|
import de.neemann.digital.draw.model.ModelEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,10 +43,10 @@ public interface Shape extends Drawable {
|
|||||||
* Allows the shape to make its drawing dependent of the model by registering a Observer to the model.
|
* Allows the shape to make its drawing dependent of the model by registering a Observer to the model.
|
||||||
* It is used by {@link DataShape} to create and show the data graph.
|
* It is used by {@link DataShape} to create and show the data graph.
|
||||||
*
|
*
|
||||||
* @param modelDescription the models description
|
* @param modelCreator the models description
|
||||||
* @param model the model itself
|
* @param model the model itself
|
||||||
* @param element the ModelElement this shape belongs to
|
* @param element the ModelElement this shape belongs to
|
||||||
*/
|
*/
|
||||||
default void registerModel(ModelDescription modelDescription, Model model, ModelEntry element) {
|
default void registerModel(ModelCreator modelCreator, Model model, ModelEntry element) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import de.neemann.digital.draw.elements.PinException;
|
|||||||
import de.neemann.digital.draw.elements.VisualElement;
|
import de.neemann.digital.draw.elements.VisualElement;
|
||||||
import de.neemann.digital.draw.graphics.*;
|
import de.neemann.digital.draw.graphics.*;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.RealTimeClock;
|
import de.neemann.digital.draw.model.RealTimeClock;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import de.neemann.digital.gui.components.*;
|
import de.neemann.digital.gui.components.*;
|
||||||
@ -102,7 +102,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
private FileHistory fileHistory;
|
private FileHistory fileHistory;
|
||||||
|
|
||||||
private Model model;
|
private Model model;
|
||||||
private ModelDescription modelDescription;
|
private ModelCreator modelCreator;
|
||||||
private boolean realtimeClockRunning;
|
private boolean realtimeClockRunning;
|
||||||
|
|
||||||
private State elementState;
|
private State elementState;
|
||||||
@ -432,7 +432,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
try {
|
try {
|
||||||
model.doMicroStep(false);
|
model.doMicroStep(false);
|
||||||
circuitComponent.removeHighLighted();
|
circuitComponent.removeHighLighted();
|
||||||
modelDescription.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
||||||
circuitComponent.repaint();
|
circuitComponent.repaint();
|
||||||
doStep.setEnabled(model.needsUpdate());
|
doStep.setEnabled(model.needsUpdate());
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
@ -465,7 +465,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
Model model = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
|
||||||
|
|
||||||
SpeedTest speedTest = new SpeedTest(model);
|
SpeedTest speedTest = new SpeedTest(model);
|
||||||
double frequency = speedTest.calculate();
|
double frequency = speedTest.calculate();
|
||||||
@ -515,7 +515,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
Model model = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
Model model = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
|
||||||
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename)
|
new TableDialog(Main.this, new ModelAnalyser(model).analyse(), shapeFactory, filename)
|
||||||
.setPinMap(new PinMap().addModel(model))
|
.setPinMap(new PinMap().addModel(model))
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
@ -542,7 +542,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
|
|
||||||
private void orderMeasurements() {
|
private void orderMeasurements() {
|
||||||
try {
|
try {
|
||||||
Model m = new ModelDescription(circuitComponent.getCircuit(), library).createModel(false);
|
Model m = new ModelCreator(circuitComponent.getCircuit(), library).createModel(false);
|
||||||
elementState.enter();
|
elementState.enter();
|
||||||
ArrayList<String> names = new ArrayList<>();
|
ArrayList<String> names = new ArrayList<>();
|
||||||
for (Signal s : m.getSignals())
|
for (Signal s : m.getSignals())
|
||||||
@ -605,7 +605,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
if (model != null)
|
if (model != null)
|
||||||
model.close();
|
model.close();
|
||||||
|
|
||||||
modelDescription = null;
|
modelCreator = null;
|
||||||
model = null;
|
model = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,12 +614,12 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
circuitComponent.removeHighLighted();
|
circuitComponent.removeHighLighted();
|
||||||
circuitComponent.setModeAndReset(true);
|
circuitComponent.setModeAndReset(true);
|
||||||
|
|
||||||
modelDescription = new ModelDescription(circuitComponent.getCircuit(), library);
|
modelCreator = new ModelCreator(circuitComponent.getCircuit(), library);
|
||||||
|
|
||||||
if (model != null)
|
if (model != null)
|
||||||
model.close();
|
model.close();
|
||||||
|
|
||||||
model = modelDescription.createModel(true);
|
model = modelCreator.createModel(true);
|
||||||
|
|
||||||
statusLabel.setText(Lang.get("msg_N_nodes", model.size()));
|
statusLabel.setText(Lang.get("msg_N_nodes", model.size()));
|
||||||
|
|
||||||
@ -634,11 +634,11 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
if (realtimeClockRunning) {
|
if (realtimeClockRunning) {
|
||||||
// if clock is running, enable automatic update of gui
|
// if clock is running, enable automatic update of gui
|
||||||
GuiModelObserver gmo = new GuiModelObserver(circuitComponent, updateEvent);
|
GuiModelObserver gmo = new GuiModelObserver(circuitComponent, updateEvent);
|
||||||
modelDescription.connectToGui(gmo);
|
modelCreator.connectToGui(gmo);
|
||||||
model.addObserver(gmo);
|
model.addObserver(gmo);
|
||||||
} else
|
} else
|
||||||
// all repainting is initiated by user actions!
|
// all repainting is initiated by user actions!
|
||||||
modelDescription.connectToGui(null);
|
modelCreator.connectToGui(null);
|
||||||
|
|
||||||
doStep.setEnabled(false);
|
doStep.setEnabled(false);
|
||||||
runToBreakAction.setEnabled(!realtimeClockRunning && model.isFastRunModel());
|
runToBreakAction.setEnabled(!realtimeClockRunning && model.isFastRunModel());
|
||||||
@ -676,8 +676,8 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
if (cause instanceof NodeException) {
|
if (cause instanceof NodeException) {
|
||||||
NodeException e = (NodeException) cause;
|
NodeException e = (NodeException) cause;
|
||||||
circuitComponent.addHighLightedWires(e.getValues());
|
circuitComponent.addHighLightedWires(e.getValues());
|
||||||
if (modelDescription != null)
|
if (modelCreator != null)
|
||||||
modelDescription.addNodeElementsTo(e.getNodes(), circuitComponent.getHighLighted());
|
modelCreator.addNodeElementsTo(e.getNodes(), circuitComponent.getHighLighted());
|
||||||
} else if (cause instanceof PinException) {
|
} else if (cause instanceof PinException) {
|
||||||
PinException e = (PinException) cause;
|
PinException e = (PinException) cause;
|
||||||
circuitComponent.addHighLighted(e.getVisualElement());
|
circuitComponent.addHighLighted(e.getVisualElement());
|
||||||
@ -800,7 +800,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hasChanged() {
|
public void hasChanged() {
|
||||||
modelDescription.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
||||||
model.fireManualChangeEvent();
|
model.fireManualChangeEvent();
|
||||||
circuitComponent.repaint();
|
circuitComponent.repaint();
|
||||||
doStep.setEnabled(model.needsUpdate());
|
doStep.setEnabled(model.needsUpdate());
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* classes which you can find in the core package.
|
* classes which you can find in the core package.
|
||||||
* This classes form the simulation model represented by the {@link de.neemann.digital.core.Model} class.
|
* This classes form the simulation model represented by the {@link de.neemann.digital.core.Model} class.
|
||||||
* Furthermore this representation is called the model.
|
* Furthermore this representation is called the model.
|
||||||
* In the package draw.model you can find the class {@link de.neemann.digital.draw.model.ModelDescription}.
|
* In the package draw.model you can find the class {@link de.neemann.digital.draw.model.ModelCreator}.
|
||||||
* This class takes a circuit represented by a Circuit instance and creates
|
* This class takes a circuit represented by a Circuit instance and creates
|
||||||
* a Model instance representation.
|
* a Model instance representation.
|
||||||
* Some of the elements out of the Circuit representation you can also find
|
* Some of the elements out of the Circuit representation you can also find
|
||||||
|
@ -8,7 +8,7 @@ import de.neemann.digital.core.element.Element;
|
|||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.elements.PinException;
|
import de.neemann.digital.draw.elements.PinException;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.ModelEntry;
|
import de.neemann.digital.draw.model.ModelEntry;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import de.neemann.digital.integration.Resources;
|
import de.neemann.digital.integration.Resources;
|
||||||
@ -37,7 +37,7 @@ public class TestExecuter {
|
|||||||
File filename = new File(Resources.getRoot(), name);
|
File filename = new File(Resources.getRoot(), name);
|
||||||
Circuit circuit = Circuit.loadCircuit(filename, new ShapeFactory(library));
|
Circuit circuit = Circuit.loadCircuit(filename, new ShapeFactory(library));
|
||||||
|
|
||||||
ModelDescription mb = new ModelDescription(circuit, library);
|
ModelCreator mb = new ModelCreator(circuit, library);
|
||||||
|
|
||||||
return new TestExecuter(mb.createModel(false), true).setUp(mb);
|
return new TestExecuter(mb.createModel(false), true).setUp(mb);
|
||||||
}
|
}
|
||||||
@ -99,9 +99,9 @@ public class TestExecuter {
|
|||||||
setOutputs(me.getIoState().getInputs());
|
setOutputs(me.getIoState().getInputs());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestExecuter setUp(ModelDescription modelDescription) {
|
public TestExecuter setUp(ModelCreator modelCreator) {
|
||||||
List<ModelEntry> inputs = modelDescription.getEntries("In");
|
List<ModelEntry> inputs = modelCreator.getEntries("In");
|
||||||
List<ModelEntry> outputs = modelDescription.getEntries("Out");
|
List<ModelEntry> outputs = modelCreator.getEntries("Out");
|
||||||
|
|
||||||
for (ModelEntry input : inputs) {
|
for (ModelEntry input : inputs) {
|
||||||
assertEquals(0, input.getIoState().inputCount());
|
assertEquals(0, input.getIoState().inputCount());
|
||||||
|
@ -5,7 +5,7 @@ import de.neemann.digital.analyse.expression.Expression;
|
|||||||
import de.neemann.digital.analyse.expression.Variable;
|
import de.neemann.digital.analyse.expression.Variable;
|
||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class CircuitBuilderTest extends TestCase {
|
|||||||
.addCombinatorial("y", y)
|
.addCombinatorial("y", y)
|
||||||
.createCircuit();
|
.createCircuit();
|
||||||
|
|
||||||
ModelDescription m = new ModelDescription(circuit, library);
|
ModelCreator m = new ModelCreator(circuit, library);
|
||||||
|
|
||||||
TestExecuter te = new TestExecuter(m.createModel(false)).setUp(m);
|
TestExecuter te = new TestExecuter(m.createModel(false)).setUp(m);
|
||||||
te.check(0, 0, 0);
|
te.check(0, 0, 0);
|
||||||
@ -56,7 +56,7 @@ public class CircuitBuilderTest extends TestCase {
|
|||||||
.addCombinatorial("Y_1", y1)
|
.addCombinatorial("Y_1", y1)
|
||||||
.createCircuit();
|
.createCircuit();
|
||||||
|
|
||||||
ModelDescription m = new ModelDescription(circuit, library);
|
ModelCreator m = new ModelCreator(circuit, library);
|
||||||
TestExecuter te = new TestExecuter(m.createModel(false)).setUp(m);
|
TestExecuter te = new TestExecuter(m.createModel(false)).setUp(m);
|
||||||
te.check(0, 0);
|
te.check(0, 0);
|
||||||
te.checkC(1, 0);
|
te.checkC(1, 0);
|
||||||
|
@ -5,7 +5,7 @@ import de.neemann.digital.core.Model;
|
|||||||
import de.neemann.digital.core.Node;
|
import de.neemann.digital.core.Node;
|
||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.model.ModelEntry;
|
import de.neemann.digital.draw.model.ModelEntry;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
@ -30,7 +30,7 @@ public class TestAnd extends TestCase {
|
|||||||
File filename = new File(Resources.getRoot(), "dig/and.dig");
|
File filename = new File(Resources.getRoot(), "dig/and.dig");
|
||||||
Circuit circuit = Circuit.loadCircuit(filename, new ShapeFactory(new ElementLibrary()));
|
Circuit circuit = Circuit.loadCircuit(filename, new ShapeFactory(new ElementLibrary()));
|
||||||
|
|
||||||
ModelDescription md = new ModelDescription(circuit, library);
|
ModelCreator md = new ModelCreator(circuit, library);
|
||||||
Model model = md.createModel(false);
|
Model model = md.createModel(false);
|
||||||
|
|
||||||
List<Node> nodes = model.getNodes();
|
List<Node> nodes = model.getNodes();
|
||||||
|
@ -6,7 +6,7 @@ import de.neemann.digital.core.NodeException;
|
|||||||
import de.neemann.digital.draw.elements.Circuit;
|
import de.neemann.digital.draw.elements.Circuit;
|
||||||
import de.neemann.digital.draw.elements.PinException;
|
import de.neemann.digital.draw.elements.PinException;
|
||||||
import de.neemann.digital.draw.library.ElementLibrary;
|
import de.neemann.digital.draw.library.ElementLibrary;
|
||||||
import de.neemann.digital.draw.model.ModelDescription;
|
import de.neemann.digital.draw.model.ModelCreator;
|
||||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||||
import de.neemann.digital.gui.LibrarySelector;
|
import de.neemann.digital.gui.LibrarySelector;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class ToBreakRunner {
|
|||||||
LibrarySelector librarySelector = new LibrarySelector(library, shapeFactory, null);
|
LibrarySelector librarySelector = new LibrarySelector(library, shapeFactory, null);
|
||||||
librarySelector.setFilePath(filename.getParentFile());
|
librarySelector.setFilePath(filename.getParentFile());
|
||||||
|
|
||||||
ModelDescription md = new ModelDescription(circuit, library);
|
ModelCreator md = new ModelCreator(circuit, library);
|
||||||
model = md.createModel(false);
|
model = md.createModel(false);
|
||||||
if (doInit)
|
if (doInit)
|
||||||
model.init(true);
|
model.init(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user