X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Fcomponents%2FBasicCoreComponent.java;fp=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Fcomponents%2FBasicCoreComponent.java;h=0000000000000000000000000000000000000000;hb=7d05144c25daa53e60fc9ed9fd503546a86567f8;hp=c82f2b37ddcb6f746dedd42d471dd163d4ccb154;hpb=8bed58cd47f4e53a0a83e066d38864aa6875502f;p=Mograsim.git diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicCoreComponent.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicCoreComponent.java deleted file mode 100644 index c82f2b37..00000000 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/BasicCoreComponent.java +++ /dev/null @@ -1,43 +0,0 @@ -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; -import net.mograsim.logic.core.timeline.TimelineEventHandler; - -/** - * A basic component that recomputes all outputs (with a delay), when it is updated. - * - * @author Fabian Stemmler - */ -public abstract class BasicCoreComponent extends CoreComponent 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 BasicCoreComponent(Timeline timeline, int processTime) - { - super(timeline); - this.processTime = processTime > 0 ? processTime : 1; - } - - @Override - public final void update(LogicObservable initiator) - { - update(); - } - - public void update() - { - TimelineEventHandler delayedUpdates = compute(); - if (delayedUpdates != null) - timeline.addEvent(delayedUpdates, processTime); - } - - protected abstract TimelineEventHandler compute(); -}