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);
}
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);
}
}
Aggregations