X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2Fcomponents%2Fgates%2FOrGate.java;h=0050a77a2f812367bda86b06a421f27fd9c73183;hb=4712d3e6ee08461b7754dbfba1c9e82372bb474d;hp=c1d95a7846432f98f393ed6ae9bc6557c7ca537c;hpb=fa95c348b3b8fb9681e4bf5c8284c5ac8eeed518;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/components/gates/OrGate.java b/era.mi/src/era/mi/logic/components/gates/OrGate.java index c1d95a78..0050a77a 100644 --- a/era.mi/src/era/mi/logic/components/gates/OrGate.java +++ b/era.mi/src/era/mi/logic/components/gates/OrGate.java @@ -1,43 +1,12 @@ package era.mi.logic.components.gates; import era.mi.logic.Util; -import era.mi.logic.components.BasicComponent; import era.mi.logic.wires.WireArray; -import era.mi.logic.wires.WireArray.WireArrayInput; -public class OrGate extends BasicComponent +public class OrGate extends MultiInputGate { - private WireArray a, b, out; - private WireArrayInput outI; - - public OrGate(int processTime, WireArray a, WireArray b, WireArray out) + public OrGate(int processTime, WireArray out, WireArray... in) { - super(processTime); - this.a = a; - a.addObserver(this); - this.b = b; - b.addObserver(this); - this.out = out; - this.outI = out.createInput(); - } - - protected void compute() - { - outI.feedSignals(Util.or(a.getValues(), b.getValues())); - } - - public WireArray getA() - { - return a; - } - - public WireArray getB() - { - return b; - } - - public WireArray getOut() - { - return out; + super(processTime, Util::or, out, in); } }