--- /dev/null
+package net.mograsim.logic.ui.model.components;
+
+import net.mograsim.logic.ui.model.ViewModelModifiable;
+
+public class GUINandGate extends SimpleRectangularGUIGate
+{
+ public GUINandGate(ViewModelModifiable model, int logicWidth)
+ {
+ super(model, logicWidth, "&", true);
+ setInputCount(2);// TODO make variable
+ // TODO
+ }
+}
\ No newline at end of file
import net.mograsim.logic.ui.modeladapter.componentadapters.BitDisplayAdapter;
import net.mograsim.logic.ui.modeladapter.componentadapters.ComponentAdapter;
import net.mograsim.logic.ui.modeladapter.componentadapters.ManualSwitchAdapter;
+import net.mograsim.logic.ui.modeladapter.componentadapters.NandGateAdapter;
import net.mograsim.logic.ui.modeladapter.componentadapters.SimpleGateAdapter;
public class ViewLogicModelAdapter
componentAdaptersModifiable.add(new SimpleGateAdapter<>(GUIOrGate.class, OrGate::new));
componentAdaptersModifiable.add(new SimpleGateAdapter<>(GUIAndGate.class, AndGate::new));
componentAdaptersModifiable.add(new SimpleGateAdapter<>(GUINotGate.class, (t, p, o, i) -> new NotGate(t, p, i[0], o)));
+ componentAdaptersModifiable.add(new NandGateAdapter());
componentAdaptersModifiable.add(new ManualSwitchAdapter());
componentAdaptersModifiable.add(new BitDisplayAdapter());
componentAdaptersModifiable.add(new AtomicAm2901NANDBasedAdapter());
--- /dev/null
+package net.mograsim.logic.ui.modeladapter.componentadapters;
+
+import java.util.Map;
+
+import net.mograsim.logic.core.components.gates.AndGate;
+import net.mograsim.logic.core.components.gates.NotGate;
+import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.wires.Wire;
+import net.mograsim.logic.ui.model.components.GUINandGate;
+import net.mograsim.logic.ui.model.wires.Pin;
+import net.mograsim.logic.ui.modeladapter.LogicModelParameters;
+
+public class NandGateAdapter implements ComponentAdapter<GUINandGate>
+{
+ @Override
+ public Class<GUINandGate> getSupportedClass()
+ {
+ return GUINandGate.class;
+ }
+
+ @Override
+ @SuppressWarnings("unused") // AndGate and NotGate
+ public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, GUINandGate guiComponent,
+ Map<Pin, Wire> logicWiresPerPin)
+ {
+ Wire i0 = logicWiresPerPin.get(guiComponent.getInputPins().get(0));
+ Wire i1 = logicWiresPerPin.get(guiComponent.getInputPins().get(1));
+ Wire o = logicWiresPerPin.get(guiComponent.getOutputPin());
+ Wire w = new Wire(timeline, guiComponent.getOutputPin().logicWidth, 1);
+
+ new AndGate(timeline, 1, w.createReadWriteEnd(), i0.createReadOnlyEnd(), i1.createReadOnlyEnd());
+ new NotGate(timeline, Math.max(1, params.gateProcessTime - 2), w.createReadOnlyEnd(), o.createReadWriteEnd());
+ }
+}
\ No newline at end of file