Search in sources :

Example 86 with ElementAttributes

use of de.neemann.digital.core.element.ElementAttributes in project Digital by hneemann.

the class BusSplitterTest method testBusSplitter.

public void testBusSplitter() throws Exception {
    Model model = new Model();
    ObservableValue oe = new ObservableValue("oe", 1);
    ObservableValue d = new ObservableValue("d", 4);
    ObservableValue d0 = new ObservableValue("d0", 1);
    ObservableValue d1 = new ObservableValue("d1", 1);
    ObservableValue d2 = new ObservableValue("d2", 1);
    ObservableValue d3 = new ObservableValue("d3", 1);
    BusSplitter out = model.add(new BusSplitter(new ElementAttributes().setBits(4)));
    out.setInputs(ovs(oe, d, d0, d1, d2, d3));
    TestExecuter te = new TestExecuter(model).setInputs(oe, d, d0, d1, d2, d3).setOutputs(out.getOutputs());
    te.check(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    te.check(1, 5, 0, 0, 0, 0, 0, 1, 0, 1, 0);
    te.check(1, 15, 0, 0, 0, 0, 0, 1, 1, 1, 1);
    te.check(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    te.check(0, 0, 1, 0, 1, 0, 5, 0, 0, 0, 0);
    te.check(0, 0, 1, 1, 1, 1, 15, 0, 0, 0, 0);
}
Also used : Model(de.neemann.digital.core.Model) ObservableValue(de.neemann.digital.core.ObservableValue) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) TestExecuter(de.neemann.digital.TestExecuter)

Example 87 with ElementAttributes

use of de.neemann.digital.core.element.ElementAttributes in project Digital by hneemann.

the class TableDialog method editColumnName.

private void editColumnName(int columnIndex, Point pos) {
    ElementAttributes attr = new ElementAttributes();
    final String name = model.getColumnName(columnIndex);
    attr.set(Keys.LABEL, name);
    ElementAttributes modified = new AttributeDialog(this, pos, LIST, attr).showDialog();
    if (modified != null) {
        final String newName = modified.get(Keys.LABEL).trim().replace(' ', '_');
        if (!newName.equals(name))
            model.setColumnName(columnIndex, newName);
    }
}
Also used : AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) ElementAttributes(de.neemann.digital.core.element.ElementAttributes)

Aggregations

ElementAttributes (de.neemann.digital.core.element.ElementAttributes)87 ObservableValue (de.neemann.digital.core.ObservableValue)73 TestExecuter (de.neemann.digital.TestExecuter)61 Model (de.neemann.digital.core.Model)52 ObservableValues (de.neemann.digital.core.ObservableValues)16 BitsException (de.neemann.digital.core.BitsException)3 FanIn (de.neemann.digital.core.basic.FanIn)3 NodeException (de.neemann.digital.core.NodeException)2 Delay (de.neemann.digital.core.wiring.Delay)2 Circuit (de.neemann.digital.draw.elements.Circuit)2 And (de.neemann.digital.core.basic.And)1 Not (de.neemann.digital.core.basic.Not)1 Or (de.neemann.digital.core.basic.Or)1 Element (de.neemann.digital.core.element.Element)1 Key (de.neemann.digital.core.element.Key)1 FlipflopD (de.neemann.digital.core.flipflops.FlipflopD)1 FlipflopJK (de.neemann.digital.core.flipflops.FlipflopJK)1 Clock (de.neemann.digital.core.wiring.Clock)1 VisualElement (de.neemann.digital.draw.elements.VisualElement)1 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)1