X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Fcomponents%2FBasicComponent.java;h=e2d2d6540f2f3a194f796342852b3053ff0cc5c5;hb=ecc651406020231ff0ebc8d1bfc6f916693f69c6;hp=426c6a11daddef394b085a24ce11c36bf07fd08f;hpb=67c1d352795802dae0c045cedeed82c883819d4e;p=Mograsim.git diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicComponent.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicComponent.java index 426c6a11..e2d2d654 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicComponent.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicComponent.java @@ -1,36 +1,35 @@ -package net.mograsim.logic.core.components; - -import net.mograsim.logic.core.timeline.Timeline; -import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.core.wires.WireObserver; -import net.mograsim.logic.core.wires.Wire.ReadEnd; - -/** - * A basic component that recomputes all outputs (with a delay), when it is updated. - * - * @author Fabian Stemmler - */ -public abstract class BasicComponent extends Component implements WireObserver -{ - private int processTime; - - /** - * - * @param processTime Amount of time this component takes to update its outputs. Must be more than 0, otherwise 1 is assumed. - * - * @author Fabian Stemmler - */ - public BasicComponent(Timeline timeline, int processTime) - { - super(timeline); - this.processTime = processTime > 0 ? processTime : 1; - } - - @Override - public void update(ReadEnd initiator, BitVector oldValues) - { - timeline.addEvent(e -> compute(), processTime); - } - - protected abstract void compute(); -} +package net.mograsim.logic.core.components; + +import net.mograsim.logic.core.LogicObservable; +import net.mograsim.logic.core.LogicObserver; +import net.mograsim.logic.core.timeline.Timeline; + +/** + * A basic component that recomputes all outputs (with a delay), when it is updated. + * + * @author Fabian Stemmler + */ +public abstract class BasicComponent extends Component implements LogicObserver +{ + private int processTime; + + /** + * + * @param processTime Amount of time this component takes to update its outputs. Must be more than 0, otherwise 1 is assumed. + * + * @author Fabian Stemmler + */ + public BasicComponent(Timeline timeline, int processTime) + { + super(timeline); + this.processTime = processTime > 0 ? processTime : 1; + } + + @Override + public void update(LogicObservable initiator) + { + timeline.addEvent(e -> compute(), processTime); + } + + protected abstract void compute(); +}