8f3849f92c92af1508f7dba44feb3bec754e2e9f
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / components / atomic / ModelNotGate.java
1 package net.mograsim.logic.model.model.components.atomic;
2
3 import net.mograsim.logic.core.components.gates.CoreNotGate;
4 import net.mograsim.logic.model.model.LogicModelModifiable;
5 import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
6 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleGateAdapter;
7 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
8
9 public class ModelNotGate extends SimpleRectangularModelGate
10 {
11         public ModelNotGate(LogicModelModifiable model, int logicWidth)
12         {
13                 this(model, logicWidth, null);
14         }
15
16         public ModelNotGate(LogicModelModifiable model, int logicWidth, String name)
17         {
18                 super(model, "NotGate", "1", true, logicWidth, name, false);
19                 setInputCount(1);
20                 init();
21         }
22
23         static
24         {
25                 LogicCoreAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelNotGate.class, (t, p, o, i) -> new CoreNotGate(t, p, i[0], o)));
26                 IndirectModelComponentCreator.setComponentSupplier(ModelNotGate.class.getCanonicalName(),
27                                 (m, p, n) -> new ModelNotGate(m, p.getAsInt(), n));
28         }
29 }