Renamed core components to have the common prefix Core
[Mograsim.git] / net.mograsim.logic.core / src / net / mograsim / logic / core / components / gates / CoreNotGate.java
1 package net.mograsim.logic.core.components.gates;
2
3 import java.util.List;
4
5 import net.mograsim.logic.core.components.BasicCoreComponent;
6 import net.mograsim.logic.core.timeline.Timeline;
7 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
8 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
9
10 public class CoreNotGate extends BasicCoreComponent
11 {
12         private ReadEnd in;
13         private ReadWriteEnd out;
14
15         public CoreNotGate(Timeline timeline, int processTime, ReadEnd in, ReadWriteEnd out)
16         {
17                 super(timeline, processTime);
18                 this.in = in;
19                 in.registerObserver(this);
20                 this.out = out;
21         }
22
23         @Override
24         protected void compute()
25         {
26                 out.feedSignals(in.getValues().not());
27         }
28
29         public ReadEnd getIn()
30         {
31                 return in;
32         }
33
34         public ReadEnd getOut()
35         {
36                 return out;
37         }
38
39         @Override
40         public List<ReadEnd> getAllInputs()
41         {
42                 return List.of(in);
43         }
44
45         @Override
46         public List<ReadWriteEnd> getAllOutputs()
47         {
48                 return List.of(out);
49         }
50 }